feat: 增强项目 API,添加项目路径和文件过滤功能;更新 BotHelperModal 和 NodeInfo 组件,优化状态管理和交互体验;改进 ProjectDialog,支持多选和项目初始化功能

This commit is contained in:
xiongxiao
2026-03-15 23:19:38 +08:00
committed by cnb
parent fc533701f6
commit 1afd39b970
8 changed files with 448 additions and 48 deletions

View File

@@ -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": "按文件绝对路径过滤,选填",