feat: add project-aware agent workspace
This commit is contained in:
@@ -34,6 +34,9 @@ export async function mockAgentApi(page: Page, options: MockAgentApiOptions = {}
|
||||
}
|
||||
|
||||
const pathname = new URL(route.request().url()).pathname;
|
||||
if (pathname.endsWith("/topics") && route.request().method() === "GET") {
|
||||
await route.fulfill({ headers: corsHeaders, json: { topics: [] } }); return;
|
||||
}
|
||||
|
||||
if (pathname.endsWith("/suggestions") && route.request().method() === "POST") {
|
||||
await route.fulfill({ headers: corsHeaders, json: {
|
||||
@@ -94,13 +97,14 @@ export async function mockAgentApi(page: Page, options: MockAgentApiOptions = {}
|
||||
const sessionMatch = pathname.match(/\/session\/([^/]+)$/);
|
||||
if (sessionMatch && route.request().method() === "GET") {
|
||||
const collaboration = sessionMatch[1].startsWith("collaboration-");
|
||||
const stored = options.sessions?.find((session) => (session.session_id ?? session.id) === sessionMatch[1]);
|
||||
await route.fulfill({
|
||||
headers: corsHeaders,
|
||||
json: {
|
||||
id: sessionMatch[1],
|
||||
session_id: sessionMatch[1],
|
||||
title: collaboration ? "任务协作问答" : "水质投诉事件调查",
|
||||
purpose: collaboration ? "task_collaboration" : "ordinary_chat",
|
||||
title: stored?.title ?? (collaboration ? "任务协作问答" : "水质投诉事件调查"),
|
||||
purpose: stored?.purpose ?? (collaboration ? "task_collaboration" : "ordinary_chat"),
|
||||
task_id: collaboration ? sessionMatch[1].slice("collaboration-".length) : undefined,
|
||||
status: "active",
|
||||
created_at: "2026-09-22T02:00:00Z",
|
||||
|
||||
Reference in New Issue
Block a user