mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 02:10:15 +01:00
👻 refactor: LocalStorage Cleanup and MCP State Optimization (#9528)
* 👻 refactor: MCP Select State with Jotai Atoms
* refactor: Implement timestamp management for ChatArea localStorage entries
* refactor: Integrate MCP Server Manager into BadgeRow context and components to avoid double-calling within BadgeRow
* refactor: add try/catch
* chore: remove comment
This commit is contained in:
parent
519645c0b0
commit
751c2e1d17
14 changed files with 435 additions and 115 deletions
20
client/src/store/mcp.ts
Normal file
20
client/src/store/mcp.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { atomFamily, atomWithStorage } from 'jotai/utils';
|
||||
import { Constants, LocalStorageKeys } from 'librechat-data-provider';
|
||||
|
||||
/**
|
||||
* Creates a storage atom for MCP values per conversation
|
||||
* Uses atomFamily to create unique atoms for each conversation ID
|
||||
*/
|
||||
export const mcpValuesAtomFamily = atomFamily((conversationId: string | null) => {
|
||||
const key = conversationId ?? Constants.NEW_CONVO;
|
||||
const storageKey = `${LocalStorageKeys.LAST_MCP_}${key}`;
|
||||
|
||||
return atomWithStorage<string[]>(storageKey, [], undefined, { getOnInit: true });
|
||||
});
|
||||
|
||||
/**
|
||||
* Global storage atom for MCP pinned state (shared across all conversations)
|
||||
*/
|
||||
export const mcpPinnedAtom = atomWithStorage<boolean>(LocalStorageKeys.PIN_MCP_, true, undefined, {
|
||||
getOnInit: true,
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue