mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 17:30:16 +01:00
🤖 feat: Enhance Assistant Model Handling for Model Specs (#4390)
* chore: cleanup type issues in client/src/utils/endpoints * refactor: use Constant enum for 'new' conversationId * refactor: select assistant model if not provided for model spec
This commit is contained in:
parent
2846779603
commit
bab0152c58
4 changed files with 23 additions and 12 deletions
|
|
@ -6,6 +6,7 @@ import {
|
|||
} from 'librechat-data-provider/react-query';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Constants,
|
||||
FileSources,
|
||||
isParamEndpoint,
|
||||
LocalStorageKeys,
|
||||
|
|
@ -116,7 +117,7 @@ const useNewConvo = (index = 0) => {
|
|||
) ?? assistants[0]?.id;
|
||||
}
|
||||
|
||||
if (currentAssistantId && isAssistantEndpoint && conversation.conversationId === 'new') {
|
||||
if (currentAssistantId && isAssistantEndpoint && conversation.conversationId === Constants.NEW_CONVO) {
|
||||
const assistant = assistants.find((asst) => asst.id === currentAssistantId);
|
||||
conversation.model = assistant?.model;
|
||||
updateLastSelectedModel({
|
||||
|
|
@ -147,12 +148,12 @@ const useNewConvo = (index = 0) => {
|
|||
clearAllLatestMessages();
|
||||
}
|
||||
|
||||
if (conversation.conversationId === 'new' && !modelsData) {
|
||||
if (conversation.conversationId === Constants.NEW_CONVO && !modelsData) {
|
||||
const appTitle = localStorage.getItem(LocalStorageKeys.APP_TITLE) ?? '';
|
||||
if (appTitle) {
|
||||
document.title = appTitle;
|
||||
}
|
||||
navigate('/c/new');
|
||||
navigate(`/c/${Constants.NEW_CONVO}`);
|
||||
}
|
||||
|
||||
clearTimeout(timeoutIdRef.current);
|
||||
|
|
@ -189,12 +190,12 @@ const useNewConvo = (index = 0) => {
|
|||
isParamEndpoint(_template.endpoint ?? '', _template.endpointType ?? '') === true ||
|
||||
isParamEndpoint(_preset?.endpoint ?? '', _preset?.endpointType ?? '');
|
||||
const template =
|
||||
paramEndpoint === true && templateConvoId && templateConvoId === 'new'
|
||||
paramEndpoint === true && templateConvoId && templateConvoId === Constants.NEW_CONVO
|
||||
? { endpoint: _template.endpoint }
|
||||
: _template;
|
||||
|
||||
const conversation = {
|
||||
conversationId: 'new',
|
||||
conversationId: Constants.NEW_CONVO as string,
|
||||
title: 'New Chat',
|
||||
endpoint: null,
|
||||
...template,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue