🔧 refactor: Consolidate Logging, Model Selection & Actions Optimizations, Minor Fixes (#6553)

* 🔧 feat: Enhance logging configuration for production and debug environments

* 🔒 feat: Implement encryption and decryption functions for sensitive values in ActionService with URL encoding/decoding

* refactor: optimize action service for agent tools

* refactor: optimize action processing for Assistants API

* fix: handle case where agent is not found in loadAgent function

* refactor: improve error handling in API calls by throwing new Error with logAxiosError output

* chore: bump @librechat/agents to 2.3.95, fixes "Invalid tool call structure: No preceding AIMessage with tool_call_ids"

* refactor: enhance error logging in logAxiosError function to include response status

* refactor: remove unused useModelSelection hook from Endpoint

* refactor: add support for assistants in useSelectorEffects hook

* refactor: replace string easing with imported easings in Landing component

* chore: remove duplicate translation

* refactor: update model selection logic and improve localization for UI elements

* refactor: replace endpoint value checks with helper functions for agents and assistants

* refactor: optimize display value logic and utilize useMemo for performance improvements

* refactor: clean up imports and optimize display/icon value logic in endpoint components, fix spec selection

* refactor: enhance error logging in axios utility to include stack traces for better debugging

* refactor: update logging configuration to use DEBUG_LOGGING and streamline log level handling

* refactor: adjust className for export menu button to improve layout consistency and remove unused title prop from ShareButton

* refactor: update import path for logAxiosError utility to improve module organization and clarity

* refactor: implement debounced search value setter in ModelSelectorContext for improved performance
This commit is contained in:
Danny Avila 2025-03-26 14:10:52 -04:00 committed by GitHub
parent 801b602e27
commit 299cabd6ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 970 additions and 1135 deletions

View file

@ -21,22 +21,51 @@ export default function useSelectorEffects({
const agents: t.Agent[] = useMemo(() => {
return Object.values(agentsMap ?? {}) as t.Agent[];
}, [agentsMap]);
const { agent_id: selectedAgentId = null, endpoint } = conversation ?? {};
const {
agent_id: selectedAgentId = null,
assistant_id: selectedAssistantId = null,
endpoint,
} = conversation ?? {};
const assistants: t.Assistant[] = useMemo(() => {
if (!isAssistantsEndpoint(endpoint)) {
return [];
}
return Object.values(assistantsMap?.[endpoint ?? ''] ?? {}) as t.Assistant[];
}, [assistantsMap, endpoint]);
useEffect(() => {
if (!isAgentsEndpoint(endpoint as string)) {
return;
}
if (selectedAgentId == null && agents.length > 0) {
let agent_id = localStorage.getItem(`${LocalStorageKeys.AGENT_ID_PREFIX}${index}`);
if (agent_id == null) {
agent_id = agents[0].id;
agent_id = agents[0]?.id;
}
const agent = agentsMap?.[agent_id];
if (agent !== undefined && isAgentsEndpoint(endpoint as string) === true) {
if (agent !== undefined) {
setOption('model')('');
setOption('agent_id')(agent_id);
}
}
}, [index, agents, selectedAgentId, agentsMap, endpoint, setOption]);
useEffect(() => {
if (!isAssistantsEndpoint(endpoint as string)) {
return;
}
if (selectedAssistantId == null && assistants.length > 0) {
let assistant_id = localStorage.getItem(`${LocalStorageKeys.ASST_ID_PREFIX}${index}`);
if (assistant_id == null) {
assistant_id = assistants[0]?.id;
}
const assistant = assistantsMap?.[endpoint ?? '']?.[assistant_id];
if (assistant !== undefined) {
setOption('model')('');
setOption('assistant_id')(assistant_id);
}
}
}, [index, assistants, selectedAssistantId, assistantsMap, endpoint, setOption]);
const debounceTimeoutRef = useRef<NodeJS.Timeout | null>(null);
@ -64,7 +93,7 @@ export default function useSelectorEffects({
debouncedSetSelectedValues({
endpoint: conversation.endpoint || '',
model: conversation.agent_id ?? '',
modelSpec: '',
modelSpec: conversation.spec || '',
});
return;
} else if (isAssistantsEndpoint(conversation?.endpoint)) {