Add config for custom prompt

This commit is contained in:
David DeGraw
2024-05-26 16:04:37 -06:00
parent 281dc362c7
commit 681aa22020
3 changed files with 9 additions and 1 deletions

View File

@@ -210,7 +210,12 @@ func run(cmd *cobra.Command, args []string) error {
defer rl.Close()
prompt := func(counter string) string {
return fmt.Sprintf("[%s] [%s]: ", time.Now().Format("2006-01-02 15:04:05"), counter)
cm := configmanager.New(config.New())
if len(cm.Config.Prompt) != 0 {
return cm.Config.Prompt
} else {
return fmt.Sprintf("[%s] [%s]: ", time.Now().Format("2006-01-02 15:04:05"), counter)
}
}
qNum, usage := 1, 0

View File

@@ -26,6 +26,7 @@ const (
openAITopP = 1.0
openAIFrequencyPenalty = 0.0
openAIPresencePenalty = 0.0
openAIPrompt = ""
)
type ConfigStore interface {
@@ -114,6 +115,7 @@ func (f *FileIO) ReadDefaults() types.Config {
TopP: openAITopP,
FrequencyPenalty: openAIFrequencyPenalty,
PresencePenalty: openAIPresencePenalty,
Prompt: openAIPrompt,
}
}

View File

@@ -18,4 +18,5 @@ type Config struct {
ModelsPath string `yaml:"models_path"`
AuthHeader string `yaml:"auth_header"`
AuthTokenPrefix string `yaml:"auth_token_prefix"`
Prompt string `yaml:"prompt"`
}