Refactor selectedToolSchemas logic in DebugDrawer to simplify tool ID normalization. Removed redundant inclusion of DEBUG_CLIENT_TOOLS, enhancing code clarity and performance.
This commit is contained in:
@@ -2449,9 +2449,7 @@ export const DebugDrawer: React.FC<{
|
|||||||
const isClientToolEnabled = (toolId: string) => clientToolEnabledMap[normalizeToolId(toolId)] !== false;
|
const isClientToolEnabled = (toolId: string) => clientToolEnabledMap[normalizeToolId(toolId)] !== false;
|
||||||
const isClientToolEnabledLive = (toolId: string) => clientToolEnabledMapRef.current[normalizeToolId(toolId)] !== false;
|
const isClientToolEnabledLive = (toolId: string) => clientToolEnabledMapRef.current[normalizeToolId(toolId)] !== false;
|
||||||
const selectedToolSchemas = useMemo(() => {
|
const selectedToolSchemas = useMemo(() => {
|
||||||
const ids = Array.from(
|
const ids = Array.from(new Set((assistant.tools || []).map((id) => normalizeToolId(id))));
|
||||||
new Set([...(assistant.tools || []).map((id) => normalizeToolId(id)), ...DEBUG_CLIENT_TOOLS.map((item) => item.id)])
|
|
||||||
);
|
|
||||||
const byId = new Map(tools.map((t) => [normalizeToolId(t.id), { ...t, id: normalizeToolId(t.id) }]));
|
const byId = new Map(tools.map((t) => [normalizeToolId(t.id), { ...t, id: normalizeToolId(t.id) }]));
|
||||||
return ids.map((id) => {
|
return ids.map((id) => {
|
||||||
const item = byId.get(id);
|
const item = byId.get(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user