mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 02:40:14 +01:00
fix(balance/models): request only when authenticated, modelsQuery "optimistic" update (#1031)
* fix(balanceQuery/modelsQuery): request only when authenticated * style: match new chat capitalization to official * fix(modelsQuery): update selected model optimistically * ci: update e2e changes, disable title in ci env * fix(ci): get new chat button by data-testid and not text
This commit is contained in:
parent
2dd545eaa4
commit
b3aac97710
10 changed files with 34 additions and 15 deletions
|
|
@ -1,6 +1,12 @@
|
|||
import { useCallback } from 'react';
|
||||
import { useSetRecoilState, useResetRecoilState, useRecoilCallback, useRecoilValue } from 'recoil';
|
||||
import { TConversation, TMessagesAtom, TSubmission, TPreset } from 'librechat-data-provider';
|
||||
import type {
|
||||
TConversation,
|
||||
TMessagesAtom,
|
||||
TSubmission,
|
||||
TPreset,
|
||||
TModelsConfig,
|
||||
} from 'librechat-data-provider';
|
||||
import { buildDefaultConvo, getDefaultEndpoint } from '~/utils';
|
||||
import store from '~/store';
|
||||
|
||||
|
|
@ -17,8 +23,9 @@ const useConversation = () => {
|
|||
conversation: TConversation,
|
||||
messages: TMessagesAtom = null,
|
||||
preset: TPreset | null = null,
|
||||
modelsData?: TModelsConfig,
|
||||
) => {
|
||||
const modelsConfig = snapshot.getLoadable(store.modelsConfig).contents;
|
||||
const modelsConfig = modelsData ?? snapshot.getLoadable(store.modelsConfig).contents;
|
||||
const { endpoint = null } = conversation;
|
||||
|
||||
if (endpoint === null) {
|
||||
|
|
@ -45,7 +52,7 @@ const useConversation = () => {
|
|||
);
|
||||
|
||||
const newConversation = useCallback(
|
||||
(template = {}, preset?: TPreset) => {
|
||||
(template = {}, preset?: TPreset, modelsData?: TModelsConfig) => {
|
||||
switchToConversation(
|
||||
{
|
||||
conversationId: 'new',
|
||||
|
|
@ -57,6 +64,7 @@ const useConversation = () => {
|
|||
},
|
||||
[],
|
||||
preset,
|
||||
modelsData,
|
||||
);
|
||||
},
|
||||
[switchToConversation],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue