From 68b9010ed53492b3fae2e6896819e09d3eca2c5c Mon Sep 17 00:00:00 2001 From: bel Date: Sat, 17 Jun 2023 15:05:35 -0600 Subject: [PATCH] not sure why stderr to discard makes things funnier.... --- vicuna-tools.d/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vicuna-tools.d/main.go b/vicuna-tools.d/main.go index ec8af64..0a27315 100644 --- a/vicuna-tools.d/main.go +++ b/vicuna-tools.d/main.go @@ -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 {