mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-04 01:28:51 +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
|
|
@ -87,22 +87,23 @@ const firstLocalConvoKey = LocalStorageKeys.LAST_CONVO_SETUP + '_0';
|
|||
* update without updating last convo setup when same endpoint */
|
||||
export function updateLastSelectedModel({
|
||||
endpoint,
|
||||
model,
|
||||
model = '',
|
||||
}: {
|
||||
endpoint: string;
|
||||
model: string | undefined;
|
||||
model?: string;
|
||||
}) {
|
||||
if (!model) {
|
||||
return;
|
||||
}
|
||||
const lastConversationSetup = JSON.parse(localStorage.getItem(firstLocalConvoKey) || '{}');
|
||||
/* Note: an empty string value is possible */
|
||||
const lastConversationSetup = JSON.parse((localStorage.getItem(firstLocalConvoKey) ?? '{}') || '{}');
|
||||
|
||||
if (lastConversationSetup.endpoint === endpoint) {
|
||||
lastConversationSetup.model = model;
|
||||
localStorage.setItem(firstLocalConvoKey, JSON.stringify(lastConversationSetup));
|
||||
}
|
||||
|
||||
const lastSelectedModels = JSON.parse(localStorage.getItem(LocalStorageKeys.LAST_MODEL) || '{}');
|
||||
const lastSelectedModels = JSON.parse((localStorage.getItem(LocalStorageKeys.LAST_MODEL) ?? '{}') || '{}');
|
||||
lastSelectedModels[endpoint] = model;
|
||||
localStorage.setItem(LocalStorageKeys.LAST_MODEL, JSON.stringify(lastSelectedModels));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue