mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-23 20:00:15 +01:00
🤖 feat: Support o4-mini and o3 Models (#6928)
* feat: Add support for new OpenAI models (o4-mini, o3) and update related logic * 🔧 fix: Rename 'resubmitFiles' to 'isResubmission' for consistency across types and hooks * 🔧 fix: Replace hardcoded 'pending_req' with CacheKeys.PENDING_REQ for consistency in cache handling * 🔧 fix: Update cache handling to use Time.ONE_MINUTE instead of hardcoded TTL and streamline imports * 🔧 fix: Enhance message handling logic to correctly identify parent messages and streamline imports in useSSE
This commit is contained in:
parent
88f4ad7c47
commit
52f146dd97
19 changed files with 69 additions and 53 deletions
|
|
@ -2,7 +2,6 @@ import { useEffect, useState } from 'react';
|
|||
import { v4 } from 'uuid';
|
||||
import { SSE } from 'sse.js';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import {
|
||||
request,
|
||||
Constants,
|
||||
|
|
@ -13,18 +12,12 @@ import {
|
|||
removeNullishValues,
|
||||
isAssistantsEndpoint,
|
||||
} from 'librechat-data-provider';
|
||||
import type {
|
||||
EventSubmission,
|
||||
TConversation,
|
||||
TMessage,
|
||||
TPayload,
|
||||
TSubmission,
|
||||
} from 'librechat-data-provider';
|
||||
import type { TMessage, TPayload, TSubmission, EventSubmission } from 'librechat-data-provider';
|
||||
import type { EventHandlerParams } from './useEventHandlers';
|
||||
import type { TResData } from '~/common';
|
||||
import { useGenTitleMutation, useGetStartupConfig, useGetUserBalance } from '~/data-provider';
|
||||
import useEventHandlers, { getConvoTitle } from './useEventHandlers';
|
||||
import { useAuthContext } from '~/hooks/AuthContext';
|
||||
import useEventHandlers from './useEventHandlers';
|
||||
import store from '~/store';
|
||||
|
||||
const clearDraft = (conversationId?: string | null) => {
|
||||
|
|
@ -53,7 +46,6 @@ export default function useSSE(
|
|||
isAddedRequest = false,
|
||||
runIndex = 0,
|
||||
) {
|
||||
const queryClient = useQueryClient();
|
||||
const genTitle = useGenTitleMutation();
|
||||
const setActiveRunId = useSetRecoilState(store.activeRunFamily(runIndex));
|
||||
|
||||
|
|
@ -107,30 +99,6 @@ export default function useSSE(
|
|||
let { userMessage } = submission;
|
||||
|
||||
const payloadData = createPayload(submission);
|
||||
/**
|
||||
* Helps clear text immediately on submission instead of
|
||||
* restoring draft, which gets deleted on generation end
|
||||
* */
|
||||
const parentId = submission?.isRegenerate
|
||||
? userMessage.overrideParentMessageId
|
||||
: userMessage.parentMessageId;
|
||||
setConversation?.((prev: TConversation | null) => {
|
||||
if (!prev) {
|
||||
return null;
|
||||
}
|
||||
const title =
|
||||
getConvoTitle({
|
||||
parentId,
|
||||
queryClient,
|
||||
currentTitle: prev?.title,
|
||||
conversationId: prev?.conversationId,
|
||||
}) ?? '';
|
||||
return {
|
||||
...prev,
|
||||
title,
|
||||
conversationId: Constants.PENDING_CONVO as string,
|
||||
};
|
||||
});
|
||||
let { payload } = payloadData;
|
||||
if (isAssistantsEndpoint(payload.endpoint) || isAgentsEndpoint(payload.endpoint)) {
|
||||
payload = removeNullishValues(payload) as TPayload;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue