mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Fix GlobalChatPane input delay after AI finishes responding
Check for finish_reason in stream chunks to detect when the AI has finished generating content, and release isLoading immediately rather than waiting for the stream connection to fully close.
This commit is contained in:
1 parent
b1bbf58867
commit
b78a912af1
1 file changed
+7
@@ -141,6 +141,13 @@ export function GlobalChatProvider({ children }: GlobalChatProviderProps) {
|
||||
}
|
||||
return updated;
|
||||
});
|
||||
|
||||
// Check if the stream is finished (finish_reason is set)
|
||||
const finishReason = chunk.choices[0]?.finish_reason;
|
||||
if (finishReason) {
|
||||
// Response is complete, release the input immediately
|
||||
setIsLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Final trim after response is complete
|
||||
|
||||
Reference in new issue
Block a user