fix(web): narrow natal-minute consultation mode for the production build

BUG-341 added declared_birth_window, but the natal-minute helper still returned boolean, so next build could not pass that mode into serverChartFromProfile.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-08-21 20:37:44 +08:00
co-authored by Cursor
parent ecb72cc5de
commit eeee0e49af
3 changed files with 28 additions and 1 deletions
@@ -12,10 +12,16 @@ export const consultationBirthTimeModeSchema = z.enum([
]);
export type ConsultationBirthTimeMode = z.infer<typeof consultationBirthTimeModeSchema>;
export type NatalMinuteConsultationMode = Extract<
ConsultationBirthTimeMode,
"verified_chart" | "unverified_birth_time"
>;
export const UNVERIFIED_BIRTH_TIME_NOTICE = "使用未校正填报时间;分钟敏感结论的置信度已降低。";
export function isNatalMinuteConsultationMode(mode: ConsultationBirthTimeMode): boolean {
export function isNatalMinuteConsultationMode(
mode: ConsultationBirthTimeMode,
): mode is NatalMinuteConsultationMode {
return mode === "verified_chart" || mode === "unverified_birth_time";
}
@@ -13,6 +13,11 @@ import { getGeneralJyotishAgent } from "../src/mastra/index.ts";
import type { ResolvedLanguageModel } from "../src/mastra/model.ts";
test("general-no-birth-time is an explicit server mode that never runs a chart workflow", () => {
const source = readFileSync(new URL("../src/lib/consultation-birth-time-mode.ts", import.meta.url), "utf8");
assert.match(
source,
/export function isNatalMinuteConsultationMode\(\s*mode: ConsultationBirthTimeMode,\s*\): mode is NatalMinuteConsultationMode/,
);
assert.equal(consultationBirthTimeModeSchema.safeParse("verified_chart").success, true);
assert.equal(consultationBirthTimeModeSchema.safeParse("unverified_birth_time").success, true);
assert.equal(consultationBirthTimeModeSchema.safeParse("declared_birth_window").success, true);