🐞 fix(client): Prevent Async Reset of Latest Message (#2203)

* refactor: use debug statement runStepCompleted message

* fix(ChatRoute): prevent use of `newConversation` from reseting `latestMessage`, which would fire asynchronously and finalize after `latestMessage` was already correctly set
This commit is contained in:
Danny Avila 2024-03-25 11:16:18 -04:00 committed by GitHub
parent 8fc52348e8
commit 3ef46132eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -571,7 +571,7 @@ class StreamRunManager {
const isMessage = step.type === StepTypes.MESSAGE_CREATION; const isMessage = step.type === StepTypes.MESSAGE_CREATION;
if (isMessage) { if (isMessage) {
logger.warn('RunStep Message completion: to be handled by Message Event.', step); logger.debug('RunStep Message completion: to be handled by Message Event.', step);
return; return;
} }

View file

@ -65,6 +65,7 @@ export default function ChatRoute() {
/* this is necessary to load all existing settings */ /* this is necessary to load all existing settings */
preset: initialConvoQuery.data as TPreset, preset: initialConvoQuery.data as TPreset,
modelsData: modelsQuery.data, modelsData: modelsQuery.data,
keepLatestMessage: true,
}); });
hasSetConversation.current = !!assistants; hasSetConversation.current = !!assistants;
} else if (!hasSetConversation.current && conversationId === 'new' && assistants) { } else if (!hasSetConversation.current && conversationId === 'new' && assistants) {
@ -75,6 +76,7 @@ export default function ChatRoute() {
template: initialConvoQuery.data, template: initialConvoQuery.data,
preset: initialConvoQuery.data as TPreset, preset: initialConvoQuery.data as TPreset,
modelsData: modelsQuery.data, modelsData: modelsQuery.data,
keepLatestMessage: true,
}); });
hasSetConversation.current = true; hasSetConversation.current = true;
} }