fix(ui): always show Settings button for tools with dedicated forms

hasEditableSettings() only checked if tool.settings was non-empty,
hiding the Settings button for web_search, tts, etc. when no settings
existed yet. Now tools with dedicated form components always show the
button so admins can create initial settings.
This commit is contained in:
viettranx committed 2026-04-12 11:45:06 +07:00
1 parent c07aa5cf4b
commit f994335cb1
1 file changed
+8
@@ -13,7 +13,15 @@ import type { BuiltinToolData } from "./hooks/use-builtin-tools";
/* eslint-disable @typescript-eslint/no-explicit-any */
// Tools with dedicated settings forms always show the Settings button,
// even when settings is empty (the form lets the user create settings).
const TOOLS_WITH_DEDICATED_FORM = new Set([
"web_search", "web_fetch", "tts", "knowledge_graph_search",
"create_image", "create_audio", "create_video",
]);
export function hasEditableSettings(tool: BuiltinToolData): boolean {
if (TOOLS_WITH_DEDICATED_FORM.has(tool.name)) return true;
return tool.settings != null && Object.keys(tool.settings).length > 0;
}