update chat history after message is received
This commit is contained in:
parent
17c24ef618
commit
9753b5a6c5
1 changed files with 4 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue