Skip to content

Commit

Permalink
feat!: Tiny refactoring, changed plugin name (#17)
Browse files Browse the repository at this point in the history
* tiny refactoring naming
  • Loading branch information
mariocandela authored Jan 22, 2023
1 parent 31f5ca9 commit e4ca845
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ address: ":2222"
description: "SSH interactive ChatGPT"
commands:
- regex: "^(.+)$"
plugin: "OpenAIChatGPT"
plugin: "OpenAIGPTLinuxTerminal"
serverVersion: "OpenSSH"
serverName: "ubuntu"
passwordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$"
Expand Down
2 changes: 1 addition & 1 deletion configurations/services/ssh-2222.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ address: ":2222"
description: "SSH interactive ChatGPT"
commands:
- regex: "^(.+)$"
plugin: "OpenAIChatGPT"
plugin: "OpenAIGPTLinuxTerminal"
serverVersion: "OpenSSH"
serverName: "ubuntu"
passwordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$"
Expand Down
6 changes: 3 additions & 3 deletions plugin/OpenAiGPT.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
)

const ChatGPTPluginName = "OpenAIChatGPT"
const ChatGPTPluginName = "OpenAIGPTLinuxTerminal"
const openAIGPTEndpoint = "https://api.openai.com/v1/completions"

type History struct {
Expand Down Expand Up @@ -59,12 +59,12 @@ type gptRequest struct {
}

//Reference: https://www.engraved.blog/building-a-virtual-machine-inside/
const chatGPTFirstQuestion = "I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do no write explanations. Do not type commands unless I instruct you to do so.\n\nA:pwd\n\nQ:/home/user\n\n"
const promptVirtualizeLinuxTerminal = "I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do no write explanations. Do not type commands unless I instruct you to do so.\n\nA:pwd\n\nQ:/home/user\n\n"

func buildPrompt(histories []History, command string) string {
var sb strings.Builder

sb.WriteString(chatGPTFirstQuestion)
sb.WriteString(promptVirtualizeLinuxTerminal)

for _, history := range histories {
sb.WriteString(fmt.Sprintf("A:%s\n\nQ:%s\n\n", history.Input, history.Output))
Expand Down

0 comments on commit e4ca845

Please sign in to comment.