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