mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 01:10:14 +01:00
📛 feat: Chat Badges via Model Specs (#10272)
* refactor: remove `useChatContext` from `useSelectMention`, explicitly pass `conversation` object * feat: ephemeral agents via model specs * refactor: Sync Jotai state with ephemeral agent state, also when Ephemeral Agent has no MCP servers selected * refactor: move `useUpdateEphemeralAgent` to store and clean up imports * refactor: reorder imports and invalidate queries for mcpConnectionStatus in event handler * refactor: replace useApplyModelSpecEffects with useApplyModelSpecAgents and update event handlers to use new agent template logic * ci: update useMCPSelect test to verify mcpValues sync with empty ephemeralAgent.mcp
This commit is contained in:
parent
64df54528d
commit
33d6b337bc
17 changed files with 254 additions and 41 deletions
|
|
@ -1,8 +1,14 @@
|
|||
import { useCallback } from 'react';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { QueryKeys, Constants, dataService } from 'librechat-data-provider';
|
||||
import type { TConversation, TEndpointsConfig, TModelsConfig } from 'librechat-data-provider';
|
||||
import type {
|
||||
TEndpointsConfig,
|
||||
TStartupConfig,
|
||||
TModelsConfig,
|
||||
TConversation,
|
||||
} from 'librechat-data-provider';
|
||||
import {
|
||||
getDefaultEndpoint,
|
||||
clearMessagesCache,
|
||||
|
|
@ -10,15 +16,34 @@ import {
|
|||
getEndpointField,
|
||||
logger,
|
||||
} from '~/utils';
|
||||
import { useApplyModelSpecEffects } from '~/hooks/Agents';
|
||||
import store from '~/store';
|
||||
|
||||
const useNavigateToConvo = (index = 0) => {
|
||||
const navigate = useNavigate();
|
||||
const queryClient = useQueryClient();
|
||||
const clearAllConversations = store.useClearConvoState();
|
||||
const applyModelSpecEffects = useApplyModelSpecEffects();
|
||||
const setSubmission = useSetRecoilState(store.submissionByIndex(index));
|
||||
const clearAllLatestMessages = store.useClearLatestMessages(`useNavigateToConvo ${index}`);
|
||||
const { hasSetConversation, setConversation } = store.useCreateConversationAtom(index);
|
||||
const { hasSetConversation, setConversation: setConvo } = store.useCreateConversationAtom(index);
|
||||
|
||||
const setConversation = useCallback(
|
||||
(conversation: TConversation) => {
|
||||
setConvo(conversation);
|
||||
if (!conversation.spec) {
|
||||
return;
|
||||
}
|
||||
|
||||
const startupConfig = queryClient.getQueryData<TStartupConfig>([QueryKeys.startupConfig]);
|
||||
applyModelSpecEffects({
|
||||
startupConfig,
|
||||
specName: conversation?.spec,
|
||||
convoId: conversation.conversationId,
|
||||
});
|
||||
},
|
||||
[setConvo, queryClient, applyModelSpecEffects],
|
||||
);
|
||||
|
||||
const fetchFreshData = async (conversation?: Partial<TConversation>) => {
|
||||
const conversationId = conversation?.conversationId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue