From 6319ffa23ea87b491701cac3b01c542041964d48 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Wed, 11 Sep 2024 16:44:33 +0800 Subject: [PATCH] Remove initial response and delay in chatStream handler. --- api/chat_main_handler.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/api/chat_main_handler.go b/api/chat_main_handler.go index 993aa658..56af9f20 100644 --- a/api/chat_main_handler.go +++ b/api/chat_main_handler.go @@ -546,13 +546,7 @@ func (h *ChatHandler) chatStream(w http.ResponseWriter, chatSession sqlc_queries if regenerate { answer_id = chatUuid } - - initial_resp := constructChatCompletionStreamReponse(answer_id, "!!!!") - data, _ := json.Marshal(initial_resp) - fmt.Fprintf(w, "data: %v\n\n", string(data)) - flusher.Flush() - log.Println("initial_resp") - time.Sleep(time.Second * 5) + for { response, err := stream.Recv() if errors.Is(err, io.EOF) {