diff --git a/src/modules/project-api.ts b/src/modules/project-api.ts
index 04f2a6d..321d21a 100644
--- a/src/modules/project-api.ts
+++ b/src/modules/project-api.ts
@@ -276,7 +276,6 @@ const api = {
*
* @param data - Request parameters
* @param data.q - {string} 搜索关键词,选填;留空或不传则返回全部文件
- * @param data.projectPath - {string} 按项目根目录路径过滤,仅返回该项目下的文件,选填
* @param data.filepath - {string} 按文件绝对路径过滤,选填
* @param data.repo - {string} 按代码仓库标识过滤(如 owner/repo),选填
* @param data.title - {string} 按人工标注的标题字段过滤,选填
@@ -287,6 +286,7 @@ const api = {
* @param data.sort - {array} 排序规则数组,格式为 ["字段:asc"] 或 ["字段:desc"],选填,当 q 为空时默认为 ["projectPath:asc"]
* @param data.limit - {number} 返回结果数量上限,选填,当 q 为空时默认为 1000
* @param data.getContent - {boolean} 是否返回文件内容,默认为 false;如果为 true,则在结果中包含 content 字段,内容以 base64 编码返回,适用于前端预览或下载场景
+ * @param data.projects - {array} 按项目名称列表过滤,选填,默认不穿,只过滤当前工作区的项目
*/
"files": {
"path": "project-search",
@@ -300,12 +300,120 @@ const api = {
"type": "string",
"optional": true
},
- "projectPath": {
+ "filepath": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "description": "按项目根目录路径过滤,仅返回该项目下的文件,选填",
+ "description": "按文件绝对路径过滤,选填",
"type": "string",
"optional": true
},
+ "repo": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "description": "按代码仓库标识过滤(如 owner/repo),选填",
+ "type": "string",
+ "optional": true
+ },
+ "title": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "description": "按人工标注的标题字段过滤,选填",
+ "type": "string",
+ "optional": true
+ },
+ "tags": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "description": "按人工标注的标签列表过滤,选填",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "optional": true
+ },
+ "summary": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "description": "按人工标注的摘要字段过滤,选填",
+ "type": "string",
+ "optional": true
+ },
+ "description": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "description": "按人工标注的描述字段过滤,选填",
+ "type": "string",
+ "optional": true
+ },
+ "link": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "description": "按人工标注的外部链接字段过滤,选填",
+ "type": "string",
+ "optional": true
+ },
+ "sort": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "description": "排序规则数组,格式为 [\"字段:asc\"] 或 [\"字段:desc\"],选填,当 q 为空时默认为 [\"projectPath:asc\"]",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "optional": true
+ },
+ "limit": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "description": "返回结果数量上限,选填,当 q 为空时默认为 1000",
+ "type": "number",
+ "optional": true
+ },
+ "getContent": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "description": "是否返回文件内容,默认为 false;如果为 true,则在结果中包含 content 字段,内容以 base64 编码返回,适用于前端预览或下载场景",
+ "type": "boolean",
+ "optional": true
+ },
+ "projects": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "description": "按项目名称列表过滤,选填,默认不穿,只过滤当前工作区的项目",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "optional": true
+ }
+ },
+ "url": "/root/v1/cnb-dev",
+ "source": "query-proxy-api"
+ }
+ },
+ /**
+ * 在已索引的项目文件中执行全文搜索,支持按仓库、目录、标签等字段过滤,以及自定义排序和数量限制
+ *
+ * @param data - Request parameters
+ * @param data.q - {string} 搜索关键词,选填;留空或不传则返回全部文件
+ * @param data.projectPath - {string} 按项目根目录路径过滤,仅返回该项目下的文件,必填
+ * @param data.filepath - {string} 按文件绝对路径过滤,选填
+ * @param data.repo - {string} 按代码仓库标识过滤(如 owner/repo),选填
+ * @param data.title - {string} 按人工标注的标题字段过滤,选填
+ * @param data.tags - {array} 按人工标注的标签列表过滤,选填
+ * @param data.summary - {string} 按人工标注的摘要字段过滤,选填
+ * @param data.description - {string} 按人工标注的描述字段过滤,选填
+ * @param data.link - {string} 按人工标注的外部链接字段过滤,选填
+ * @param data.sort - {array} 排序规则数组,格式为 ["字段:asc"] 或 ["字段:desc"],选填,当 q 为空时默认为 ["projectPath:asc"]
+ * @param data.limit - {number} 返回结果数量上限,选填,当 q 为空时默认为 1000
+ * @param data.getContent - {boolean} 是否返回文件内容,默认为 false;如果为 true,则在结果中包含 content 字段,内容以 base64 编码返回,适用于前端预览或下载场景
+ */
+ "search": {
+ "path": "project-search",
+ "key": "search",
+ "description": "在已索引的项目文件中执行全文搜索,支持按仓库、目录、标签等字段过滤,以及自定义排序和数量限制",
+ "metadata": {
+ "args": {
+ "q": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "description": "搜索关键词,选填;留空或不传则返回全部文件",
+ "type": "string",
+ "optional": true
+ },
+ "projectPath": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "string",
+ "description": "按项目根目录路径过滤,仅返回该项目下的文件,必填"
+ },
"filepath": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "按文件绝对路径过滤,选填",
diff --git a/src/pages/code-graph/components/BotHelperModal.tsx b/src/pages/code-graph/components/BotHelperModal.tsx
index 5c11d1a..7989e92 100644
--- a/src/pages/code-graph/components/BotHelperModal.tsx
+++ b/src/pages/code-graph/components/BotHelperModal.tsx
@@ -1,4 +1,5 @@
-import { BotIcon, XIcon, FileIcon, FolderIcon, DatabaseIcon } from 'lucide-react';
+import { BotIcon, XIcon, FileIcon, FolderIcon, DatabaseIcon, MoreHorizontalIcon } from 'lucide-react';
+import { getDynamicBasename, wrapBasename } from '@/modules/basename';
import { useBotHelperStore, BOT_KEYS, BotKey } from '../store/bot-helper';
import { useShallow } from 'zustand/react/shallow';
import { useCodeGraphStore, NodeInfoData } from '../store';
@@ -18,7 +19,7 @@ function NodeIcon({ kind, color }: { kind: NodeInfoData['kind']; color: string }
}
export function BotHelperModal() {
- const { open, input, setInput, closeModal, activeKey, setActiveKey } = useBotHelperStore(
+ const botHelperStore = useBotHelperStore(
useShallow((s) => ({
open: s.open,
input: s.input,
@@ -40,16 +41,16 @@ export function BotHelperModal() {
const handleConfirm = async () => {
if (nodeInfoData) {
const res = await createQuestion({
- question: input,
+ question: botHelperStore.input,
projectPath: nodeInfoData.projectPath,
- engine: activeKey,
+ engine: botHelperStore.activeKey,
});
console.log(res);
}
- closeModal();
+ botHelperStore.closeModal();
};
- if (!open) return null;
+ if (!botHelperStore.open) return null;
return (
@@ -62,11 +63,22 @@ export function BotHelperModal() {
AI 助手
-
+
+
+
+
{/* 内容区 */}
@@ -88,8 +100,8 @@ export function BotHelperModal() {