mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 18:00:15 +01:00
👥 fix(assistants): Improve Error handling (#2012)
* feat: make assistants endpoint appendable since message state is not managed by LibreChat * fix(ask): search currentMessages for thread_id if it's not defined * refactor(abortMiddleware): remove use of `overrideProps` and spread unknown fields instead * chore: remove console.log in `abortConversation` * refactor(assistants): improve error handling/cancellation flow
This commit is contained in:
parent
d4fe8fc82d
commit
18edd2660b
7 changed files with 77 additions and 25 deletions
|
|
@ -45,7 +45,9 @@ export default function useTextarea({
|
|||
const localize = useLocalize();
|
||||
|
||||
const { conversationId, jailbreak, endpoint = '', assistant_id } = conversation || {};
|
||||
const isNotAppendable = (latestMessage?.unfinished && !isSubmitting) || latestMessage?.error;
|
||||
const isNotAppendable =
|
||||
((latestMessage?.unfinished && !isSubmitting) || latestMessage?.error) &&
|
||||
endpoint !== EModelEndpoint.assistants;
|
||||
// && (conversationId?.length ?? 0) > 6; // also ensures that we don't show the wrong placeholder
|
||||
|
||||
const assistant = endpoint === EModelEndpoint.assistants && assistantMap?.[assistant_id ?? ''];
|
||||
|
|
|
|||
|
|
@ -418,7 +418,6 @@ export default function useSSE(submission: TSubmission | null, index = 0) {
|
|||
|
||||
const abortConversation = useCallback(
|
||||
async (conversationId = '', submission: TSubmission) => {
|
||||
console.log(submission);
|
||||
let runAbortKey = '';
|
||||
try {
|
||||
const conversation = (JSON.parse(localStorage.getItem('lastConversationSetup') ?? '') ??
|
||||
|
|
|
|||
|
|
@ -140,7 +140,10 @@ export default function useChatHelpers(index = 0, paramId: string | undefined) {
|
|||
(msg) => msg.messageId === latestMessage?.parentMessageId,
|
||||
);
|
||||
|
||||
const thread_id = parentMessage?.thread_id ?? latestMessage?.thread_id;
|
||||
let thread_id = parentMessage?.thread_id ?? latestMessage?.thread_id;
|
||||
if (!thread_id) {
|
||||
thread_id = currentMessages.find((message) => message.thread_id)?.thread_id;
|
||||
}
|
||||
|
||||
const endpointsConfig = queryClient.getQueryData<TEndpointsConfig>([QueryKeys.endpoints]);
|
||||
const endpointType = getEndpointField(endpointsConfig, endpoint, 'type');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue