From b4407a6ced1e1cf9cadcf8623dd3c6d203a1ec6b Mon Sep 17 00:00:00 2001 From: zhengzijian Date: Wed, 19 Aug 2026 02:54:14 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix=EF=BC=9A=E4=BC=98=E5=8C=96=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=BD=BF=E7=94=A8=E4=BD=93=E9=AA=8C=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=92=8C=E4=BC=98=E5=8C=96=E5=9F=BA=E6=9C=AC=E7=9A=84?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E9=A1=B9=E5=92=8C=E4=BA=A4=E4=BA=92=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E6=81=A2=E5=A4=8D=E9=83=A8=E5=88=86=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E5=B1=95=E7=A4=BA=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=A4=84=E7=90=86=E7=9A=84=E9=80=BB=E8=BE=91?= =?UTF-8?q?=20(1)=20=E6=95=B0=E6=8D=AE=E6=BA=90=E7=AE=A1=E7=90=86=EF=BC=9A?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E3=80=8C=E5=90=8D=E7=A7=B0=20/=20=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=20/=20=E6=95=B0=E6=8D=AE=E5=BA=93=E3=80=8D=E4=B8=89?= =?UTF-8?q?=E4=B8=AA=E7=AD=9B=E9=80=89=E9=A1=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (2) 数据集管理:新增「数据集名称 / 数据集 ID」筛选项;支持从测评页带参跳转后自动回填筛选。 (3) 数据质量-数据源抽样:修复表下拉把对象当表名提交的问题;空表前端拦截提示;表选项展示行数。 (4) Agent 测评列表:新增「任务类型」(全部 / 执行中 / 已完成 / 失败)、「任务 ID」、「数据集 ID」、「数据集名称」筛选项。 (5) Agent 测评列表:列名「数据集」改为「数据集 id」,新增「数据集名称」列并正确展示名称。 (6) 测评详情:增加「数据集名称」展示;文案改为「数据集 id / 数据集名称」。 (7) 测评详情与列表:点击「数据集名称」跳转数据集管理,并自动带上名称、ID 筛选。 (8) Agent 测评顶部统计卡片:改为全量汇总,不随下方筛选项变化。 (9) 创建测评弹窗:数据集下拉选项展示「名称(ID)」更易辨认。 (10) 表格通用交互:选中文字复制时不触发行点击,避免误开详情。 (11) 审计日志:详情字段支持点击复制;Request ID 不再强行当追踪链接。 (12) 审计日志:仅在有真实调用链时显示「追踪 / 查看追踪」按钮,避免无效跳转。 (13) 请求层:404 优先展示后端返回的具体错误文案,而不是一律「资源不存在」。 (14) 测评创建:允许「默认模型」传空 model_id,去掉无效拦截(否则无法用系统默认模型)。 --- apps/cognida-web/src/api/audit/index.ts | 2 + apps/cognida-web/src/api/datasource/index.ts | 21 +- apps/cognida-web/src/api/evaluation/index.ts | 17 +- .../cognida-web/src/components/ui/UiTable.vue | 5 + apps/cognida-web/src/types/evaluation.ts | 4 + apps/cognida-web/src/utils/request.ts | 3 +- .../src/views/audit/AuditLogList.vue | 146 +- .../src/views/datasource/DatasourceList.vue | 66 +- .../src/views/evaluation/DatasetList.vue | 86 +- .../src/views/evaluation/EvaluationDetail.vue | 53 +- .../src/views/evaluation/EvaluationList.vue | 55 +- .../components/CreateEvaluationDialog.vue | 7 +- .../components/EvaluationDetailDialog.vue | 44 +- .../evaluation/components/EvaluationTable.vue | 44 +- .../composables/useEvaluationList.ts | 107 +- .../src/views/quality/QualityCenter.vue | 36 +- .../cognida-web/src/views/trace/TraceList.vue | 5 +- .../internal/handler/audit_handler.go | 32 +- .../internal/handler/datasource_handler.go | 15 +- .../internal/handler/evaluation_handler.go | 1478 +++++++++-------- .../internal/handler/trace_handler.go | 4 + .../cognida-go/internal/model/audit/entity.go | 18 +- .../internal/model/datasource/entity.go | 10 +- .../internal/model/evaluation/repository.go | 35 +- .../cognida-go/internal/model/trace/entity.go | 2 + .../repository/mysql/datasource_model.go | 10 + .../repository/mysql/evaluation_task_repo.go | 11 +- .../internal/repository/mysql/trace_repo.go | 37 +- .../service/evaluation/dataset_loader.go | 51 +- .../internal/service/evaluation/service.go | 95 +- .../internal/service/quality/service.go | 18 +- services/cognida-go/internal/wire/wire.go | 4 +- services/cognida-go/internal/wire/wire_gen.go | 6 +- 33 files changed, 1610 insertions(+), 917 deletions(-) diff --git a/apps/cognida-web/src/api/audit/index.ts b/apps/cognida-web/src/api/audit/index.ts index b76b7be4..5c07f3bf 100644 --- a/apps/cognida-web/src/api/audit/index.ts +++ b/apps/cognida-web/src/api/audit/index.ts @@ -18,6 +18,8 @@ export interface AuditLog { RequestID: string | null DurationMs: number | null CreatedAt: string + /** 该 request_id 在 trace_spans 是否有调用链,无则前端不展示跳转按钮 */ + HasTrace?: boolean } export interface AuditLogPage { diff --git a/apps/cognida-web/src/api/datasource/index.ts b/apps/cognida-web/src/api/datasource/index.ts index 0f409691..97a5f266 100644 --- a/apps/cognida-web/src/api/datasource/index.ts +++ b/apps/cognida-web/src/api/datasource/index.ts @@ -96,9 +96,17 @@ export interface TestDatasourceResult { message?: string } +/** 表清单条目(与后端 TableInfo 对齐) */ +export interface DatasourceTableInfo { + name: string + comment?: string + /** information_schema 估算行数 */ + rows?: number +} + /** 表列表响应 */ export interface DatasourceTablesResponse { - tables: string[] + tables: DatasourceTableInfo[] } /** 表结构详情(列信息等,后端可按需扩展) */ @@ -119,9 +127,16 @@ export interface DatasourceTableDetail { export const datasourceApi = { /** - * 分页获取数据源列表 + * 分页获取数据源列表。 + * 可选筛选:name(名称模糊)、type(mysql|postgres)、database(库名模糊)。 */ - list(params?: { page?: number; page_size?: number }) { + list(params?: { + page?: number + page_size?: number + name?: string + type?: DatasourceType | '' + database?: string + }) { return http.get('/datasources', { params }) }, diff --git a/apps/cognida-web/src/api/evaluation/index.ts b/apps/cognida-web/src/api/evaluation/index.ts index 67ba5870..51c870c0 100644 --- a/apps/cognida-web/src/api/evaluation/index.ts +++ b/apps/cognida-web/src/api/evaluation/index.ts @@ -39,9 +39,18 @@ export const evaluationApi = { }, /** - * 列出测评任务 - */ - list(params?: { page?: number; page_size?: number }) { + * 列出测评任务。 + * 可选筛选:status(running/failed…)、task_id、dataset_id、dataset_name、type。 + */ + list(params?: { + page?: number + page_size?: number + status?: string + type?: string + task_id?: string + dataset_id?: string + dataset_name?: string + }) { return http.get('/evaluation/tasks', { params }) }, @@ -89,7 +98,7 @@ export const evaluationApi = { /** * 列出数据集 */ - listDatasets(params?: { type?: string }) { + listDatasets(params?: { type?: string; name?: string; id?: string }) { return http.get<{ datasets: DatasetInfo[] }>('/evaluation/datasets', { params }) }, diff --git a/apps/cognida-web/src/components/ui/UiTable.vue b/apps/cognida-web/src/components/ui/UiTable.vue index 2a1f8334..b6fa7461 100644 --- a/apps/cognida-web/src/components/ui/UiTable.vue +++ b/apps/cognida-web/src/components/ui/UiTable.vue @@ -202,6 +202,11 @@ function formatCellValue(row: any, column: Column) { } function handleRowClick(row: any, index: number) { + // 拖选/长按选中文字时,mouseup 也会触发 click;有选区则不当作行点击,避免误开详情。 + const sel = window.getSelection() + if (sel && !sel.isCollapsed && sel.toString().trim()) { + return + } emit('row-click', row, index) } diff --git a/apps/cognida-web/src/types/evaluation.ts b/apps/cognida-web/src/types/evaluation.ts index 07641291..094743b2 100644 --- a/apps/cognida-web/src/types/evaluation.ts +++ b/apps/cognida-web/src/types/evaluation.ts @@ -113,6 +113,8 @@ export interface EvaluationTask { id?: string task_id: string dataset_id: string + /** 数据集显示名称(列表接口按 dataset_id 解析) */ + dataset_name?: string type: string status: EvaluationStatus total_count: number @@ -139,6 +141,8 @@ export interface EvaluationTaskDetail extends EvaluationTask { export interface EvaluationDetail { task_id: string dataset_id: string + /** 数据集显示名称(后端按 dataset_id 解析,缺失时可能为空) */ + dataset_name?: string type: string status: EvaluationStatus qa_results: any[] diff --git a/apps/cognida-web/src/utils/request.ts b/apps/cognida-web/src/utils/request.ts index 65552eb4..a2a6171b 100644 --- a/apps/cognida-web/src/utils/request.ts +++ b/apps/cognida-web/src/utils/request.ts @@ -119,7 +119,8 @@ service.interceptors.response.use( // 处理404错误 if (error.response?.status === 404) { - ElMessage.error('请求的资源不存在') + const payload = error.response.data as { message?: string } | undefined + ElMessage.error(payload?.message || '请求的资源不存在') return Promise.reject(error) } diff --git a/apps/cognida-web/src/views/audit/AuditLogList.vue b/apps/cognida-web/src/views/audit/AuditLogList.vue index b9d29c9c..0a8ef230 100644 --- a/apps/cognida-web/src/views/audit/AuditLogList.vue +++ b/apps/cognida-web/src/views/audit/AuditLogList.vue @@ -85,16 +85,17 @@ {{ formatTime(row.CreatedAt) }}