fix: continue questions after range rectification

This commit is contained in:
Jesse_Chen
2026-07-22 11:49:58 +08:00
parent 8b35925ada
commit c2213cd4e6
3 changed files with 30 additions and 1 deletions
+1 -1
View File
@@ -200,7 +200,7 @@ export async function POST(request: Request) {
}
if (handoff) {
if (parsed.data.consultationMode !== "verified_chart"
if (!["verified_chart", "unverified_birth_time"].includes(parsed.data.consultationMode)
|| parsed.data.entrypoint !== undefined
|| requestId !== handoff.requestId) {
return NextResponse.json(
@@ -126,3 +126,16 @@ test("homepage sends explicit modes and never routes an unverified minute throug
assert.match(route, /旧版生时校正入口已停用/);
assert.ok(route.indexOf("旧版生时校正入口已停用") < route.indexOf("reserveConsultationModel(", route.indexOf("chatRequestSchema.safeParse")));
});
test("range-terminal rectification handoff accepts unverified chart mode without weakening general-mode isolation", () => {
const route = readFileSync(new URL("../src/app/api/consult/route.ts", import.meta.url), "utf8");
const handoffGuard = route.slice(
route.indexOf("if (handoff)"),
route.indexOf("try {", route.indexOf("if (handoff)")),
);
assert.match(handoffGuard, /\["verified_chart", "unverified_birth_time"\]\.includes\(parsed\.data\.consultationMode\)/);
assert.doesNotMatch(handoffGuard, /consultationMode !== "verified_chart"/);
assert.doesNotMatch(handoffGuard, /general_no_birth_time/);
assert.match(handoffGuard, /requestId !== handoff\.requestId/);
});