mirror of https://github.com/buster-so/buster.git
Update useChatStreamMessage.ts
This commit is contained in:
parent
0fe011396d
commit
6c53cf5cb0
|
@ -68,9 +68,7 @@ export const useChatStreamMessage = () => {
|
||||||
|
|
||||||
const completeChatCallback = useMemoizedFn((d: BusterChat) => {
|
const completeChatCallback = useMemoizedFn((d: BusterChat) => {
|
||||||
const { iChat, iChatMessages } = updateChatToIChat(d, false);
|
const { iChat, iChatMessages } = updateChatToIChat(d, false);
|
||||||
chatRef.current = create(chatRef.current, (draft) => {
|
chatRef.current[iChat.id] = iChat;
|
||||||
draft[iChat.id] = iChat;
|
|
||||||
});
|
|
||||||
normalizeChatMessage(iChatMessages);
|
normalizeChatMessage(iChatMessages);
|
||||||
onUpdateChat(iChat);
|
onUpdateChat(iChat);
|
||||||
});
|
});
|
||||||
|
@ -84,9 +82,7 @@ export const useChatStreamMessage = () => {
|
||||||
|
|
||||||
const initializeNewChatCallback = useMemoizedFn((d: BusterChat) => {
|
const initializeNewChatCallback = useMemoizedFn((d: BusterChat) => {
|
||||||
const { iChat, iChatMessages } = updateChatToIChat(d, true);
|
const { iChat, iChatMessages } = updateChatToIChat(d, true);
|
||||||
chatRef.current = create(chatRef.current, (draft) => {
|
chatRef.current[iChat.id] = iChat;
|
||||||
draft[iChat.id] = iChat;
|
|
||||||
});
|
|
||||||
normalizeChatMessage(iChatMessages);
|
normalizeChatMessage(iChatMessages);
|
||||||
onUpdateChat(iChat);
|
onUpdateChat(iChat);
|
||||||
onChangePage({
|
onChangePage({
|
||||||
|
@ -99,7 +95,6 @@ export const useChatStreamMessage = () => {
|
||||||
({ prompt, messageId }: { prompt: string; messageId: string }) => {
|
({ prompt, messageId }: { prompt: string; messageId: string }) => {
|
||||||
const currentMessage = getChatMessage(messageId);
|
const currentMessage = getChatMessage(messageId);
|
||||||
const currentRequestMessage = currentMessage?.request_message!;
|
const currentRequestMessage = currentMessage?.request_message!;
|
||||||
|
|
||||||
onUpdateChatMessage({
|
onUpdateChatMessage({
|
||||||
id: messageId,
|
id: messageId,
|
||||||
request_message: create(currentRequestMessage, (draft) => {
|
request_message: create(currentRequestMessage, (draft) => {
|
||||||
|
|
Loading…
Reference in New Issue