not sure why stderr to discard makes things funnier....

master
bel 2023-06-17 15:05:35 -06:00
parent 30bd4311a5
commit 68b9010ed5
1 changed files with 3 additions and 2 deletions

View File

@ -302,7 +302,7 @@ func handleAPIChatBotGet(w http.ResponseWriter, r *http.Request) error {
Messages string
Prompt string
}{
Messages: string(messages),
Messages: string(bytes.TrimPrefix(messages, prompt)),
Prompt: string(prompt),
})
}
@ -425,8 +425,8 @@ func chatBotGenerateAndFillInputF(ctx context.Context, cacheF, inputF, reversePr
commands[1:]...,
)
command.Dir = Config.ChatBot.WD
command.Stderr = io.Discard
command.Stderr = log.Writer()
command.Stderr = io.Discard
stdout, err := command.StdoutPipe()
if err != nil {
@ -467,6 +467,7 @@ func chatBotGenerateAndFillInputF(ctx context.Context, cacheF, inputF, reversePr
return nil, err
}
log.Printf("%s generated %q", reversePrompt, justNew)
if !bytes.HasSuffix(append(priorContent, justNew...), []byte(reversePrompt)) {
more, err := chatBotGenerateAndFillInputF(ctx, cacheF, inputF, reversePrompt, depth+1)
if err != nil {