mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-04 17:48:50 +01:00
🐛 fix: Ensure Default ModelSpecs Are Set Correctly (#5218)
* 🐛 fix: default modelSpecs not being set
* feat: Add imageDetail parameter for OpenAI endpoints in tQueryParamsSchema
* feat: Implement processModelSpecs function to enhance model specs processing from configuration
* feat: Refactor configuration schemas and types for improved structure and clarity
* feat: Add append_current_datetime parameter to tQueryParamsSchema for enhanced endpoint functionality
* fix: Add endpointType to getSaveOptions and enhance endpoint handling in Settings component
* fix: Change endpointType to be nullable and optional in tConversationSchema for improved flexibility
* fix: allow save & submit for google endpoint
This commit is contained in:
parent
916faf6447
commit
69a9b8b911
15 changed files with 201 additions and 148 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
import { EModelEndpoint } from 'librechat-data-provider';
|
||||
import { useRef, useEffect, useCallback } from 'react';
|
||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useUpdateMessageMutation } from 'librechat-data-provider/react-query';
|
||||
import type { TEditProps } from '~/common';
|
||||
|
|
@ -31,8 +30,6 @@ const EditMessage = ({
|
|||
const textAreaRef = useRef<HTMLTextAreaElement | null>(null);
|
||||
|
||||
const { conversationId, parentMessageId, messageId } = message;
|
||||
const { endpoint: _endpoint, endpointType } = conversation ?? { endpoint: null };
|
||||
const endpoint = endpointType ?? _endpoint;
|
||||
const updateMessageMutation = useUpdateMessageMutation(conversationId ?? '');
|
||||
const localize = useLocalize();
|
||||
|
||||
|
|
@ -181,9 +178,7 @@ const EditMessage = ({
|
|||
<button
|
||||
ref={submitButtonRef}
|
||||
className="btn btn-primary relative mr-2"
|
||||
disabled={
|
||||
isSubmitting || (endpoint === EModelEndpoint.google && !message.isCreatedByUser)
|
||||
}
|
||||
disabled={isSubmitting}
|
||||
onClick={handleSubmit(resubmitMessage)}
|
||||
>
|
||||
{localize('com_ui_save_submit')}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { useRecoilValue } from 'recoil';
|
||||
import { SettingsViews } from 'librechat-data-provider';
|
||||
import { useGetModelsQuery } from 'librechat-data-provider/react-query';
|
||||
import { SettingsViews, TConversation } from 'librechat-data-provider';
|
||||
import { useGetModelsQuery, useGetEndpointsQuery } from 'librechat-data-provider/react-query';
|
||||
import type { TSettingsProps } from '~/common';
|
||||
import { getSettings } from './Settings';
|
||||
import { cn } from '~/utils';
|
||||
import { cn, getEndpointField } from '~/utils';
|
||||
import store from '~/store';
|
||||
|
||||
export default function Settings({
|
||||
|
|
@ -13,15 +13,17 @@ export default function Settings({
|
|||
className = '',
|
||||
}: TSettingsProps) {
|
||||
const modelsQuery = useGetModelsQuery();
|
||||
const { data: endpointsConfig } = useGetEndpointsQuery();
|
||||
const currentSettingsView = useRecoilValue(store.currentSettingsView);
|
||||
if (!conversation?.endpoint || currentSettingsView !== SettingsViews.default) {
|
||||
const endpointType = getEndpointField(endpointsConfig, conversation?.endpoint ?? '', 'type');
|
||||
const endpoint = endpointType ?? conversation?.endpoint ?? '';
|
||||
if (!endpoint || currentSettingsView !== SettingsViews.default) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { settings, multiViewSettings } = getSettings();
|
||||
const { endpoint: _endpoint, endpointType } = conversation;
|
||||
const models = modelsQuery?.data?.[_endpoint] ?? [];
|
||||
const endpoint = endpointType ?? _endpoint;
|
||||
const { endpoint: _endpoint } = conversation as TConversation;
|
||||
const models = modelsQuery.data?.[_endpoint ?? ''] ?? [];
|
||||
const OptionComponent = settings[endpoint];
|
||||
|
||||
if (OptionComponent) {
|
||||
|
|
@ -39,7 +41,7 @@ export default function Settings({
|
|||
|
||||
const MultiViewComponent = multiViewSettings[endpoint];
|
||||
|
||||
if (!MultiViewComponent) {
|
||||
if (MultiViewComponent == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import BedrockSettings from './Bedrock';
|
|||
import BingAISettings from './BingAI';
|
||||
import OpenAISettings from './OpenAI';
|
||||
|
||||
const settings: { [key: string]: FC<TModelSelectProps> } = {
|
||||
const settings: { [key: string]: FC<TModelSelectProps> | undefined } = {
|
||||
[EModelEndpoint.assistants]: AssistantsSettings,
|
||||
[EModelEndpoint.azureAssistants]: AssistantsSettings,
|
||||
[EModelEndpoint.agents]: OpenAISettings,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue