Skip to content

Commit dee32ae

Browse files
committed
feat(ui): 将工具管理功能独立为 ToolManagerModal 组件
- 新增 ToolManagerModal 独立组件,提供完整的工具 CRUD 功能 - ConversationManager 中工具数量标签改为可点击,始终显示(包括 0) - 移除 ContextEditor 中的工具管理标签页,避免功能重复 - 清理 ContextEditor 中未使用的代码(净减少 244 行) - 修复 Vue 警告:移除 ContextEditor 的 context-mode 属性 - 统一架构模式:与 VariableManagerModal 保持一致 变更文件: - 新增:packages/ui/src/components/tool/ToolManagerModal.vue - 修改:ConversationManager, ContextEditor, ContextSystemWorkspace - 修改:App.vue (web & extension), types/components.ts, index.ts
1 parent f7ff77f commit dee32ae

File tree

9 files changed

+615
-341
lines changed

9 files changed

+615
-341
lines changed

packages/extension/src/App.vue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@
190190
@open-global-variables="openVariableManager()"
191191
@open-variable-manager="handleOpenVariableManager"
192192
@open-context-editor="handleOpenContextEditor()"
193+
@open-tool-manager="handleOpenToolManager"
193194
@open-template-manager="openTemplateManager"
194195
@config-model="modelManager.showConfig = true"
195196
@open-input-preview="handleOpenInputPreview"
@@ -801,6 +802,15 @@
801802
:focus-variable="focusVariableName"
802803
/>
803804

805+
<!-- 工具管理弹窗 -->
806+
<ToolManagerModal
807+
v-if="isReady"
808+
v-model:visible="showToolManager"
809+
:tools="optimizationContextTools"
810+
@confirm="handleToolManagerConfirm"
811+
@cancel="showToolManager = false"
812+
/>
813+
804814
<!-- 上下文编辑器弹窗 -->
805815
<ContextEditor
806816
v-if="isReady"
@@ -900,6 +910,7 @@ import {
900910
TestAreaPanel,
901911
UpdaterIcon,
902912
VariableManagerModal,
913+
ToolManagerModal,
903914
ImageWorkspace,
904915
ImageModeSelector,
905916
FunctionModeSelector,
@@ -1100,6 +1111,9 @@ if (typeof window !== "undefined") {
11001111
const showVariableManager = ref(false);
11011112
const focusVariableName = ref<string | undefined>(undefined);
11021113
1114+
// 工具管理状态
1115+
const showToolManager = ref(false);
1116+
11031117
// 上下文模式 - 需要在模板中使用,所以提前声明
11041118
const contextMode = ref<import("@prompt-optimizer/core").ContextMode>("system");
11051119
@@ -1202,6 +1216,16 @@ const handleOpenVariableManager = (variableName?: string) => {
12021216
showVariableManager.value = true;
12031217
};
12041218
1219+
// 工具管理器处理函数
1220+
const handleOpenToolManager = () => {
1221+
showToolManager.value = true;
1222+
};
1223+
1224+
const handleToolManagerConfirm = (tools: any[]) => {
1225+
optimizationContextTools.value = tools;
1226+
showToolManager.value = false;
1227+
};
1228+
12051229
// 上下文管理将在初始化 optimizer 后通过 useContextManagement 提供
12061230
12071231
// 6. 在顶层调用所有 Composables

0 commit comments

Comments
 (0)