mirror of
https://github.com/mariocandela/beelzebub.git
synced 2025-07-01 18:47:26 -04:00
Small refactor to reduce LOC and keep code DRY. (#53)
This commit is contained in:
@ -5,19 +5,23 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
|
||||
"github.com/go-resty/resty/v2"
|
||||
)
|
||||
|
||||
const ChatGPTPluginName = "OpenAIGPTLinuxTerminal"
|
||||
const openAIGPTEndpoint = "https://api.openai.com/v1/completions"
|
||||
const (
|
||||
// Reference: https://www.engraved.blog/building-a-virtual-machine-inside/
|
||||
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"
|
||||
ChatGPTPluginName = "OpenAIGPTLinuxTerminal"
|
||||
openAIGPTEndpoint = "https://api.openai.com/v1/completions"
|
||||
)
|
||||
|
||||
type History struct {
|
||||
Input, Output string
|
||||
}
|
||||
|
||||
|
||||
type OpenAIGPTVirtualTerminal struct {
|
||||
Histories []History
|
||||
OpenAPIChatGPTSecretKey string
|
||||
@ -62,7 +66,6 @@ type gptRequest struct {
|
||||
}
|
||||
|
||||
// Reference: https://www.engraved.blog/building-a-virtual-machine-inside/
|
||||
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
|
||||
|
Reference in New Issue
Block a user