mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00: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
|
|
@ -10,10 +10,11 @@ import {
|
|||
} from 'librechat-data-provider';
|
||||
|
||||
import { Nav, MobileNav } from '~/components/Nav';
|
||||
import { useAuthContext, useServerStream } from '~/hooks';
|
||||
import { useAuthContext, useServerStream, useConversation } from '~/hooks';
|
||||
import store from '~/store';
|
||||
|
||||
export default function Root() {
|
||||
const { newConversation } = useConversation();
|
||||
const { user, isAuthenticated } = useAuthContext();
|
||||
const [navVisible, setNavVisible] = useState(() => {
|
||||
const savedNavVisible = localStorage.getItem('navVisible');
|
||||
|
|
@ -30,7 +31,7 @@ export default function Root() {
|
|||
|
||||
const searchEnabledQuery = useGetSearchEnabledQuery();
|
||||
const endpointsQuery = useGetEndpointsQuery();
|
||||
const modelsQuery = useGetModelsQuery();
|
||||
const modelsQuery = useGetModelsQuery({ enabled: isAuthenticated });
|
||||
const presetsQuery = useGetPresetsQuery({ enabled: !!user });
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -48,6 +49,7 @@ export default function Root() {
|
|||
useEffect(() => {
|
||||
if (modelsQuery.data) {
|
||||
setModelsConfig(modelsQuery.data);
|
||||
newConversation(modelsQuery.data);
|
||||
} else if (modelsQuery.isError) {
|
||||
console.error('Failed to get models', modelsQuery.error);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue