mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-27 21:04:08 +01:00
🖥️ feat: Code Interpreter API for Non-Agent Endpoints (#6803)
* fix: Prevent parsing 'undefined' string in useLocalStorage initialization * feat: first pass, code interpreter badge * feat: Integrate API key authentication and default checked value in Code Interpreter Badge * refactor: Rename showMCPServers to showEphemeralBadges and update related components, memoize values in useChatBadges * refactor: Enhance AttachFileChat to support ephemeral agents in file attachment logic * fix: Add baseURL configuration option to legacy function call * refactor: Update dependency array in useDragHelpers to include handleFiles * refactor: Update isEphemeralAgent function to accept optional endpoint parameter * refactor: Update file handling to support ephemeral agents in AttachFileMenu and useDragHelpers * fix: improve compatibility issues with OpenAI usage field handling in createRun function * refactor: usage field compatibility * fix: ensure mcp servers are no longer "selected" if mcp servers are now unavailable
This commit is contained in:
parent
5d668748f9
commit
24c0433dcf
19 changed files with 311 additions and 48 deletions
|
|
@ -1,8 +1,9 @@
|
|||
import { useMemo } from 'react';
|
||||
import { useRecoilCallback } from 'recoil';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { MessageCircleDashed, Box } from 'lucide-react';
|
||||
import type { BadgeItem } from '~/common';
|
||||
import { useLocalize } from '~/hooks';
|
||||
import { useLocalize, TranslationKeys } from '~/hooks';
|
||||
import store from '~/store';
|
||||
|
||||
interface ChatBadgeConfig {
|
||||
|
|
@ -25,15 +26,22 @@ const badgeConfig: ReadonlyArray<ChatBadgeConfig> = [
|
|||
export default function useChatBadges(): BadgeItem[] {
|
||||
const localize = useLocalize();
|
||||
const activeBadges = useRecoilValue(store.chatBadges) as Array<{ id: string }>;
|
||||
const activeBadgeIds = new Set(activeBadges.map((badge) => badge.id));
|
||||
|
||||
return badgeConfig.map((cfg) => ({
|
||||
id: cfg.id,
|
||||
label: localize(cfg.label),
|
||||
icon: cfg.icon,
|
||||
atom: cfg.atom,
|
||||
isAvailable: activeBadgeIds.has(cfg.id),
|
||||
}));
|
||||
const activeBadgeIds = useMemo(
|
||||
() => new Set(activeBadges.map((badge) => badge.id)),
|
||||
[activeBadges],
|
||||
);
|
||||
const allBadges = useMemo(() => {
|
||||
return (
|
||||
badgeConfig.map((cfg) => ({
|
||||
id: cfg.id,
|
||||
label: localize(cfg.label as TranslationKeys),
|
||||
icon: cfg.icon,
|
||||
atom: cfg.atom,
|
||||
isAvailable: activeBadgeIds.has(cfg.id),
|
||||
})) || []
|
||||
);
|
||||
}, [activeBadgeIds, localize]);
|
||||
return allBadges;
|
||||
}
|
||||
|
||||
export function useResetChatBadges() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue