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 {