update chat history after message is received

This commit is contained in:
Lucas Oliveira 2025-12-02 18:44:44 -03:00
parent 17c24ef618
commit 9753b5a6c5

View file

@ -4,6 +4,7 @@ import type {
Message,
SelectedFilters,
} from "@/app/chat/_types/types";
import { useChat } from "@/contexts/chat-context";
interface UseChatStreamingOptions {
endpoint?: string;
@ -32,6 +33,8 @@ export function useChatStreaming({
const streamAbortRef = useRef<AbortController | null>(null);
const streamIdRef = useRef(0);
const { refreshConversations } = useChat();
const sendMessage = async ({
prompt,
previousResponseId,
@ -498,6 +501,7 @@ export function useChatStreaming({
// Clear streaming message and call onComplete with final message
setStreamingMessage(null);
onComplete?.(finalMessage, newResponseId);
refreshConversations(true);
return finalMessage;
}