From 40d06b781adc879f0d2356b76d7763a2899def36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=87=AF?= Date: Tue, 25 Aug 2026 11:23:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend-web/.env.development | 2 +- frontend-web/src/core/auth/dashboard-input.ts | 25 ++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/frontend-web/.env.development b/frontend-web/.env.development index 3837c075..b78f859a 100644 --- a/frontend-web/.env.development +++ b/frontend-web/.env.development @@ -8,7 +8,7 @@ VITE_USE_REAL_DATA=true VITE_MOCK_COP_TASK_DETAIL=true # 研判情报报告(大屏绘制智能体深链 selectSqReport)数据源:true 走本地样例假数据(真实接口未就绪时调试用);联调通过后置 false。 -VITE_MOCK_SQ_REPORT=true +VITE_MOCK_SQ_REPORT=false # 深链任务详情(cop-task-detail:任务名称/描述)数据源:true 走本地假数据(真实接口未就绪时调试用);联调通过后置 false。 VITE_MOCK_COP_TASK_DETAIL=true diff --git a/frontend-web/src/core/auth/dashboard-input.ts b/frontend-web/src/core/auth/dashboard-input.ts index d093dbe4..e0ed82b6 100644 --- a/frontend-web/src/core/auth/dashboard-input.ts +++ b/frontend-web/src/core/auth/dashboard-input.ts @@ -1,14 +1,14 @@ /** * 大屏绘制智能体的任务输入适配层。 * - * 报告详情由 Gateway 的 `/api/task-reports/by-task/{taskId}` 提供,返回格式 - * 与原 `selectSqReport` 一致:`{state, msg, data}`。每条 `contentJson` 是 + * 报告详情由 Consumer 的 `/cop/selectSqReport?taskId=` 提供,返回格式为 + * `{state, msg, data}`。每条 `contentJson` 是 * JSON 字符串,本模块将其按 `categoryType` 解析为智能体和大屏页面可直接使用的 * 结构化输入。 */ -import { getTaskReport } from "@/strategy-components/api/task-reports"; -import { readRuntimeFlag } from "@/env"; +import { readRuntimeEnv, readRuntimeFlag } from "@/env"; +import { requestCrudService } from "@/service/request-axios-service"; import { SQ_REPORT_MOCK_RESPONSE } from "@/strategy-components/components/task-components/sq-report-mock-data"; /** 保留给既有调用方的 sessionStorage key;报告本身不再使用 mock 缓存。 */ @@ -32,9 +32,15 @@ function categoryKey(categoryType: unknown, index: number): string { return cleaned || `分类${index + 1}`; } +/** Consumer 研判情报报告接口完整地址。 */ +function sqReportUrl(): string { + const base = readRuntimeEnv("VITE_AIPI_CONSUMER_URL")?.replace(/\/+$/, "") ?? ""; + return base ? `${base}/cop/selectSqReport` : ""; +} + /** * 将接口 envelope 提取为 `{ taskId, source, categories }`。 - * 返回 null 表示该任务尚未保存可用的报告内容。 + * 返回 null 表示接口没有返回可用的报告内容。 */ export function extractSqReport(body: unknown, taskId: string): unknown | null { const data = (body && typeof body === "object" ? (body as { data?: unknown }).data : null) as @@ -51,7 +57,7 @@ export function extractSqReport(body: unknown, taskId: string): unknown | null { categories[key] = content; }); if (Object.keys(categories).length === 0) return null; - return { taskId, source: "api/task-reports", categories }; + return { taskId, source: "cop/selectSqReport", categories }; } /** 兼容旧调用方:报告由接口实时读取,不再在浏览器中缓存。 */ @@ -70,8 +76,7 @@ export async function fetchDashboardInputJson( _opts?: { forceRefresh?: boolean }, ): Promise { if (!taskId) return null; - // 开发演示模式使用与 Gateway 接口同形的本地样例;这样不依赖报告库是否已为 - // 当前深链 taskId 写入数据,同时真实/生产环境仍始终从 Gateway 读取。 + // 开发演示模式不发外部请求,直接返回与 Consumer 接口同形的本地样例。 if (readRuntimeFlag("VITE_MOCK_SQ_REPORT")) { return extractSqReport( { @@ -81,7 +86,9 @@ export async function fetchDashboardInputJson( taskId, ); } - const body = await getTaskReport(taskId); + const url = sqReportUrl(); + if (!url) return null; + const body = await requestCrudService.get(url, { taskId }); return extractSqReport(body, taskId); }