feat(workbench): integrate runtime data and map tooling

This commit is contained in:
2026-09-22 10:45:46 +08:00
parent bf44cc0f25
commit bebcf2a06c
163 changed files with 15642 additions and 1312 deletions
+18
View File
@@ -1,4 +1,5 @@
import { expect, test, type Page } from "@playwright/test";
import { mockScadaApi } from "./support/mock-scada-api";
test("submits a custom answer with the actionable id after a later tool placeholder", async ({
page
@@ -6,6 +7,7 @@ test("submits a custom answer with the actionable id after a later tool placehol
const replies: Array<{ pathname: string; body: unknown }> = [];
await mockQuestionApi(page, replies);
await page.goto("/", { waitUntil: "domcontentloaded" });
await page.getByRole("button", { name: /展开 Agent 助手面板/ }).click();
const prompt = page
.getByPlaceholder(/输入调度问题/)
@@ -60,6 +62,22 @@ test("keeps the custom answer control within a 375px Agent sheet", async ({ page
});
async function mockQuestionApi(page: Page, replies: Array<{ pathname: string; body: unknown }>) {
await mockScadaApi(page);
await page.route("**/runtime-config.js", (route) =>
route.fulfill({
contentType: "application/javascript",
body: `globalThis.__TJWATER_CONFIG__ = ${JSON.stringify({
TJWATER_AUTH_MODE: "disabled",
TJWATER_SERVER_API_BASE_URL: "https://tjwater-api.invalid",
TJWATER_AGENT_API_BASE_URL: "http://127.0.0.1:8787",
TJWATER_MAP_URL: "https://question-map.invalid/geoserver",
TJWATER_GEOSERVER_WORKSPACE: "tjwater_next",
TJWATER_MAPBOX_ACCESS_TOKEN: "",
TJWATER_ENABLE_MSW: "false"
})};`
})
);
await page.route("https://question-map.invalid/**", (route) => route.fulfill({ status: 204 }));
await page.route("**/api/v1/agent/chat/**", async (route) => {
const request = route.request();
const pathname = new URL(request.url()).pathname;