22 lines
528 B
Go
22 lines
528 B
Go
package structs
|
|
|
|
import "github.com/spf13/viper"
|
|
|
|
func GeneratePrompt(config *viper.Viper, history []Message, message Message) string {
|
|
var prompt string = "Below is an instruction. Write a response as " + config.GetString("name") + " that appropriately answers the question.\n"
|
|
|
|
prompt += GenerateHistory(history)
|
|
prompt += message.String()
|
|
|
|
return prompt
|
|
}
|
|
|
|
func GenerateHistory(messages []Message) string {
|
|
var history string = ""
|
|
|
|
for _, message := range messages {
|
|
history += message.String()
|
|
}
|
|
|
|
return history
|
|
}
|