- 工具模块
+ {{ t('tool-module') }}
@@ -25,7 +25,10 @@ import { defineProps } from 'vue';
import ToolList from './tool-list.vue';
import ToolExecutor from './tool-executor.vue';
import ToolLogger from './tool-logger.vue';
-import AutoDetector from './auto-detector.vue';
+import AutoDetector from './auto-detector/index.vue';
+import { useI18n } from 'vue-i18n';
+
+const { t } = useI18n();
const props = defineProps({
tabId: {
diff --git a/renderer/src/i18n/ar.json b/renderer/src/i18n/ar.json
index d34053e..37171ca 100644
--- a/renderer/src/i18n/ar.json
+++ b/renderer/src/i18n/ar.json
@@ -185,5 +185,14 @@
"how-to-use": "كيفية الاستخدام؟",
"is-required": "هو حقل مطلوب",
"edit-ai-mook-prompt": "تحرير إشارات AI Mook",
- "start-auto-detect": "بدء عملية الفحص الذاتي"
+ "start-auto-detect": "بدء عملية الفحص الذاتي",
+ "tool-module": "وحدة الأدوات",
+ "prompt-module": "وحدة المطالبات",
+ "not-select-begin-node": "لم يتم تحديد عقدة البداية",
+ "can-make-loop": "سيؤدي الاتصال إلى تكوين حلقة",
+ "this-is-repeat-connection": "هذا رابط مكرر",
+ "ai-gen-error-json": "خطأ في تحليل JSON الذي تم إنشاؤه بواسطة الذكاء الاصطناعي",
+ "ai-invoke-unknown-tool": "استدعت الذكاء الاصطناعي أداة غير معروفة",
+ "click-edge-to-delete": "انقر على الحافة للحذف",
+ "select-node-define-test-tomo": "اختر عقدة أخرى لتحديد طوبولوجيا الاختبار"
}
\ No newline at end of file
diff --git a/renderer/src/i18n/de.json b/renderer/src/i18n/de.json
index 7156329..15e0d2c 100644
--- a/renderer/src/i18n/de.json
+++ b/renderer/src/i18n/de.json
@@ -185,5 +185,14 @@
"how-to-use": "Wie benutzt man?",
"is-required": "ist ein Pflichtfeld",
"edit-ai-mook-prompt": "AI Mook-Prompts bearbeiten",
- "start-auto-detect": "Selbsttest starten"
+ "start-auto-detect": "Selbsttest starten",
+ "tool-module": "Werkzeugmodul",
+ "prompt-module": "Aufforderungsmodul",
+ "not-select-begin-node": "Kein Startknoten ausgewählt",
+ "can-make-loop": "Die Verbindung wird eine Schleife bilden",
+ "this-is-repeat-connection": "Dies ist ein doppelter Link",
+ "ai-gen-error-json": "Fehler beim Parsen von KI-generiertem JSON",
+ "ai-invoke-unknown-tool": "KI hat ein unbekanntes Tool aufgerufen",
+ "click-edge-to-delete": "Klicken Sie auf die Kante, um sie zu löschen",
+ "select-node-define-test-tomo": "Wählen Sie einen anderen Knoten aus, um die Testtopologie zu definieren"
}
\ No newline at end of file
diff --git a/renderer/src/i18n/en.json b/renderer/src/i18n/en.json
index dc025e6..d14a3d1 100644
--- a/renderer/src/i18n/en.json
+++ b/renderer/src/i18n/en.json
@@ -185,5 +185,14 @@
"how-to-use": "How to use?",
"is-required": "is a required field",
"edit-ai-mook-prompt": "Edit AI Mook prompts",
- "start-auto-detect": "Start self-check"
+ "start-auto-detect": "Start self-check",
+ "tool-module": "Tool module",
+ "prompt-module": "Prompt Module",
+ "not-select-begin-node": "No starting node selected",
+ "can-make-loop": "The connection will form a loop",
+ "this-is-repeat-connection": "This is a duplicate link",
+ "ai-gen-error-json": "AI-generated JSON parsing error",
+ "ai-invoke-unknown-tool": "AI called an unknown tool",
+ "click-edge-to-delete": "Click the edge to delete",
+ "select-node-define-test-tomo": "Select another node to define the test topology"
}
\ No newline at end of file
diff --git a/renderer/src/i18n/fr.json b/renderer/src/i18n/fr.json
index c9fb022..827d8d2 100644
--- a/renderer/src/i18n/fr.json
+++ b/renderer/src/i18n/fr.json
@@ -185,5 +185,14 @@
"how-to-use": "Comment utiliser ?",
"is-required": "est un champ obligatoire",
"edit-ai-mook-prompt": "Modifier les invites AI Mook",
- "start-auto-detect": "Démarrer l'autovérification"
+ "start-auto-detect": "Démarrer l'autovérification",
+ "tool-module": "Module d'outils",
+ "prompt-module": "Module d'invite",
+ "not-select-begin-node": "Aucun nœud de départ sélectionné",
+ "can-make-loop": "La connexion formera une boucle",
+ "this-is-repeat-connection": "Ceci est un lien en double",
+ "ai-gen-error-json": "Erreur d'analyse JSON générée par IA",
+ "ai-invoke-unknown-tool": "L'IA a appelé un outil inconnu",
+ "click-edge-to-delete": "Cliquez sur le bord pour supprimer",
+ "select-node-define-test-tomo": "Sélectionnez un autre nœud pour définir la topologie de test"
}
\ No newline at end of file
diff --git a/renderer/src/i18n/ja.json b/renderer/src/i18n/ja.json
index cfb28a9..bf0f0c5 100644
--- a/renderer/src/i18n/ja.json
+++ b/renderer/src/i18n/ja.json
@@ -185,5 +185,14 @@
"how-to-use": "使用方法",
"is-required": "は必須フィールドです",
"edit-ai-mook-prompt": "AI Mookプロンプトを編集",
- "start-auto-detect": "自己診断を開始"
+ "start-auto-detect": "自己診断を開始",
+ "tool-module": "ツールモジュール",
+ "prompt-module": "プロンプトモジュール",
+ "not-select-begin-node": "開始ノードが選択されていません",
+ "can-make-loop": "接続によりループが形成されます",
+ "this-is-repeat-connection": "これは重複したリンクです",
+ "ai-gen-error-json": "AI生成JSONの解析エラー",
+ "ai-invoke-unknown-tool": "AIが未知のツールを呼び出しました",
+ "click-edge-to-delete": "クリックして削除",
+ "select-node-define-test-tomo": "テストトポロジを定義するために別のノードを選択してください"
}
\ No newline at end of file
diff --git a/renderer/src/i18n/ko.json b/renderer/src/i18n/ko.json
index 146ec48..c6aba2f 100644
--- a/renderer/src/i18n/ko.json
+++ b/renderer/src/i18n/ko.json
@@ -185,5 +185,14 @@
"how-to-use": "사용 방법?",
"is-required": "는 필수 필드입니다",
"edit-ai-mook-prompt": "AI Mook 프롬프트 편집",
- "start-auto-detect": "자체 점검 시작"
+ "start-auto-detect": "자체 점검 시작",
+ "tool-module": "도구 모듈",
+ "prompt-module": "프롬프트 모듈",
+ "not-select-begin-node": "시작 노드가 선택되지 않았습니다",
+ "can-make-loop": "연결이 루프를 형성합니다",
+ "this-is-repeat-connection": "이것은 중복된 링크입니다",
+ "ai-gen-error-json": "AI 생성 JSON 구문 분석 오류",
+ "ai-invoke-unknown-tool": "AI가 알 수 없는 도구를 호출했습니다",
+ "click-edge-to-delete": "가장자리를 클릭하여 삭제",
+ "select-node-define-test-tomo": "테스트 토폴로지를 정의하려면 다른 노드를 선택하세요"
}
\ No newline at end of file
diff --git a/renderer/src/i18n/ru.json b/renderer/src/i18n/ru.json
index e464edb..4f1d062 100644
--- a/renderer/src/i18n/ru.json
+++ b/renderer/src/i18n/ru.json
@@ -185,5 +185,14 @@
"how-to-use": "Как использовать?",
"is-required": "является обязательным полем",
"edit-ai-mook-prompt": "Редактировать подсказки AI Mook",
- "start-auto-detect": "Запустить самопроверку"
+ "start-auto-detect": "Запустить самопроверку",
+ "tool-module": "Модуль инструментов",
+ "prompt-module": "Модуль подсказок",
+ "not-select-begin-node": "Начальный узел не выбран",
+ "can-make-loop": "Соединение образует петлю",
+ "this-is-repeat-connection": "Это повторяющаяся ссылка",
+ "ai-gen-error-json": "Ошибка разбора JSON, созданного ИИ",
+ "ai-invoke-unknown-tool": "ИИ вызвал неизвестный инструмент",
+ "click-edge-to-delete": "Нажмите на край, чтобы удалить",
+ "select-node-define-test-tomo": "Выберите другой узел для определения тестовой топологии"
}
\ No newline at end of file
diff --git a/renderer/src/i18n/zh-cn.json b/renderer/src/i18n/zh-cn.json
index 0d66ce4..1080577 100644
--- a/renderer/src/i18n/zh-cn.json
+++ b/renderer/src/i18n/zh-cn.json
@@ -185,5 +185,14 @@
"how-to-use": "如何使用?",
"is-required": "是必填字段",
"edit-ai-mook-prompt": "编辑 AI Mook 提示词",
- "start-auto-detect": "开启自检程序"
+ "start-auto-detect": "开启自检程序",
+ "tool-module": "工具模块",
+ "prompt-module": "提示词模块",
+ "not-select-begin-node": "未选择起始节点",
+ "can-make-loop": "连接会形成环路",
+ "this-is-repeat-connection": "这是一个重复的连接",
+ "ai-gen-error-json": "AI 生成的 JSON 解析错误",
+ "ai-invoke-unknown-tool": "AI 调用了未知的工具",
+ "click-edge-to-delete": "点击边以删除",
+ "select-node-define-test-tomo": "选择另一个节点以定义测试拓扑"
}
\ No newline at end of file
diff --git a/renderer/src/i18n/zh-tw.json b/renderer/src/i18n/zh-tw.json
index c957837..077e7b7 100644
--- a/renderer/src/i18n/zh-tw.json
+++ b/renderer/src/i18n/zh-tw.json
@@ -185,5 +185,14 @@
"how-to-use": "如何使用?",
"is-required": "是必填欄位",
"edit-ai-mook-prompt": "編輯AI Mook提示詞",
- "start-auto-detect": "開啟自檢程序"
+ "start-auto-detect": "開啟自檢程序",
+ "tool-module": "工具模組",
+ "prompt-module": "提示詞模組",
+ "not-select-begin-node": "未選擇起始節點",
+ "can-make-loop": "連接會形成環路",
+ "this-is-repeat-connection": "這是一個重複的連結",
+ "ai-gen-error-json": "AI 生成的 JSON 解析錯誤",
+ "ai-invoke-unknown-tool": "AI調用了未知的工具",
+ "click-edge-to-delete": "點擊邊緣以刪除",
+ "select-node-define-test-tomo": "選擇另一個節點以定義測試拓撲"
}
\ No newline at end of file
From 13673d798b6bf9cda5f4949fd76867b7488b76df Mon Sep 17 00:00:00 2001
From: Kirigaya <1193466151@qq.com>
Date: Thu, 3 Jul 2025 19:06:55 +0800
Subject: [PATCH 17/20] support self-check
---
.../auto-detector/diagram-item-record.vue | 50 +++++--
.../main-panel/tool/auto-detector/diagram.ts | 34 ++++-
.../main-panel/tool/auto-detector/diagram.vue | 130 ++++++++++++++----
.../main-panel/tool/auto-detector/index.vue | 67 +++++----
.../src/components/main-panel/tool/tools.ts | 6 +
5 files changed, 211 insertions(+), 76 deletions(-)
diff --git a/renderer/src/components/main-panel/tool/auto-detector/diagram-item-record.vue b/renderer/src/components/main-panel/tool/auto-detector/diagram-item-record.vue
index 6f2b50e..5b860d9 100644
--- a/renderer/src/components/main-panel/tool/auto-detector/diagram-item-record.vue
+++ b/renderer/src/components/main-panel/tool/auto-detector/diagram-item-record.vue
@@ -5,21 +5,36 @@
{{ props.dataView.status }}
{{ props.dataView.tool.description }}
-
-
Input Schema:
-
{{ formatJson(props.dataView.tool.inputSchema) }}
-
-
-
Result:
-
{{ formatJson(props.dataView.result) }}
+
+
+
Function
+
{{ props.dataView.function.name }}
+
Arguments
+
{{ formatJson(props.dataView.function.arguments) }}
+
+
+
Result
+
+
+
{{ item.text }}
+
{{ formatJson(item) }}
+
+
+
{{ props.dataView.result }}
+
{{ formatJson(props.dataView.result) }}
+
+
+
+
+
Please select a tool to view its details.
-
-
-
Please select a tool to view its details.
-
@@ -556,7 +633,6 @@ function getNodePopupStyle(node: any): any {
position: absolute;
background: var(--background);
border: 1px solid var(--main-color);
- width: 240px;
border-radius: 8px;
padding: 8px 12px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
diff --git a/renderer/src/components/main-panel/tool/auto-detector/index.vue b/renderer/src/components/main-panel/tool/auto-detector/index.vue
index 5414f4c..1578360 100644
--- a/renderer/src/components/main-panel/tool/auto-detector/index.vue
+++ b/renderer/src/components/main-panel/tool/auto-detector/index.vue
@@ -17,12 +17,10 @@
placeholder="请输入 prompt" />
- XML
+ XML
{{ t("cancel") }}
@@ -34,7 +32,7 @@
-
+
@@ -49,10 +47,10 @@ import { nextTick, provide, ref } from 'vue';
import Diagram from './diagram.vue';
import { makeNodeTest, topoSortParallel, type DiagramContext, type DiagramState } from './diagram';
import { ElMessage } from 'element-plus';
-import { tabs } from '../../panel';
-import type { ToolStorage } from '../tools';
import { useI18n } from 'vue-i18n';
+import type { ToolStorage } from '../tools';
+import { tabs } from '../../panel';
const showDiagram = ref(true);
const { t } = useI18n();
@@ -67,14 +65,6 @@ const props = defineProps({
}
});
-
-const tab = tabs.content[props.tabId];
-const tabStorage = tab.storage as ToolStorage;
-
-if (!tabStorage.formData) {
- tabStorage.formData = {};
-}
-
function setCaption(text: string) {
caption.value = text;
if (caption.value) {
@@ -89,14 +79,27 @@ function setCaption(text: string) {
}
const context: DiagramContext = {
- reset: () => {},
- render: () => {},
+ reset: () => { },
+ render: () => { },
state: undefined,
setCaption
};
provide('context', context);
+const tab = tabs.content[props.tabId];
+const tabStorage = tab.storage as ToolStorage;
+const autoDetectDiagram = tabStorage.autoDetectDiagram;
+
+if (autoDetectDiagram) {
+ // ...
+} else {
+ tabStorage.autoDetectDiagram = {
+ edges: [],
+ views: []
+ };
+}
+
// 新增:自检参数表单相关
const testFormVisible = ref(false);
const enableXmlWrapper = ref(false);
@@ -106,21 +109,31 @@ async function onTestConfirm() {
testFormVisible.value = false;
// 这里可以将 enableXmlWrapper.value 和 testPrompt.value 传递给自检逻辑
const state = context.state;
+
+
+ tabStorage.autoDetectDiagram!.views = [];
+
if (state) {
const dispatches = topoSortParallel(state);
for (const nodeIds of dispatches) {
- await Promise.all(
- nodeIds.map(id => {
- const node = state.dataView.get(id);
- if (node) {
- return makeNodeTest(node, enableXmlWrapper.value, testPrompt.value, context)
- }
- })
- )
+ for (const id of nodeIds) {
+ const view = state.dataView.get(id);
+ if (view) {
+ await makeNodeTest(view, enableXmlWrapper.value, testPrompt.value, context)
+ tabStorage.autoDetectDiagram!.views!.push({
+ tool: view.tool,
+ status: view.status,
+ function: view.function,
+ result: view.result
+ });
+ }
+ }
}
} else {
ElMessage.error('error');
}
+
+
}
diff --git a/renderer/src/components/main-panel/tool/tools.ts b/renderer/src/components/main-panel/tool/tools.ts
index 030200b..53106f9 100644
--- a/renderer/src/components/main-panel/tool/tools.ts
+++ b/renderer/src/components/main-panel/tool/tools.ts
@@ -1,8 +1,14 @@
import type { ToolCallResponse } from '@/hook/type';
+import type { Edge, Node, NodeDataView } from './auto-detector/diagram';
export interface ToolStorage {
activeNames: any[];
currentToolName: string;
lastToolCallResponse?: ToolCallResponse | string;
formData: Record;
+ autoDetectDiagram?: {
+ edges?: Edge[];
+ views?: NodeDataView[];
+ [key: string]: any;
+ }
}
From 8a6d555da1426eb618caba473eb482ac5daaab0a Mon Sep 17 00:00:00 2001
From: Kirigaya <1193466151@qq.com>
Date: Thu, 3 Jul 2025 19:15:53 +0800
Subject: [PATCH 18/20] support self-check
---
.../auto-detector/diagram-item-record.vue | 86 ++++++++++++-------
1 file changed, 54 insertions(+), 32 deletions(-)
diff --git a/renderer/src/components/main-panel/tool/auto-detector/diagram-item-record.vue b/renderer/src/components/main-panel/tool/auto-detector/diagram-item-record.vue
index 5b860d9..7da1eb6 100644
--- a/renderer/src/components/main-panel/tool/auto-detector/diagram-item-record.vue
+++ b/renderer/src/components/main-panel/tool/auto-detector/diagram-item-record.vue
@@ -5,29 +5,31 @@
{{ props.dataView.status }}
{{ props.dataView.tool.description }}
-
+
-
Function
-
{{ props.dataView.function.name }}
-
Arguments
-
{{ formatJson(props.dataView.function.arguments) }}
+
Function
+
{{ props.dataView.function.name }}
-
-
Result
-
-
-
{{ item.text }}
-
{{ formatJson(item) }}
-
-
-
{{ props.dataView.result }}
-
{{ formatJson(props.dataView.result) }}
-
+
+ Arguments
+
+
+
+
+
Result
+
+
+
{{ item.text }}
+
{{ formatJson(item) }}
+
+
+
{{ props.dataView.result }}
+
{{ formatJson(props.dataView.result) }}
+