60 lines
2.5 KiB
TypeScript
60 lines
2.5 KiB
TypeScript
import { z } from "zod";
|
|
|
|
export const consultationEntrypointSchema = z.enum([
|
|
"daily_starlanguage",
|
|
"birth_time_rectification",
|
|
]);
|
|
|
|
export type ConsultationEntrypoint = z.infer<typeof consultationEntrypointSchema>;
|
|
|
|
type ConsultationQuestionInput = {
|
|
readonly visibleQuestion: string;
|
|
readonly entrypoint: ConsultationEntrypoint | undefined;
|
|
readonly currentDate: string;
|
|
readonly consultationMode?: "verified_chart" | "unverified_birth_time" | "general_no_birth_time";
|
|
};
|
|
|
|
export type ResolvedConsultationQuestion =
|
|
| { readonly kind: "plain"; readonly modelQuestion: string }
|
|
| { readonly kind: "expanded"; readonly modelQuestion: string };
|
|
|
|
export function resolveConsultationQuestion(
|
|
input: ConsultationQuestionInput,
|
|
): ResolvedConsultationQuestion {
|
|
switch (input.entrypoint) {
|
|
case undefined:
|
|
return { kind: "plain", modelQuestion: input.visibleQuestion };
|
|
case "daily_starlanguage":
|
|
return input.consultationMode === "general_no_birth_time"
|
|
? {
|
|
kind: "expanded",
|
|
modelQuestion: [
|
|
`请依据服务器提供的 ${input.currentDate} 公共 Panchanga 日历摘要,回答今天的整体趋势。`,
|
|
"重点说明适合推进什么、需要注意什么,并给出一个立即可执行的行动建议。",
|
|
"这不是个人命盘结论,不包含个人上升点、宫位、大运或本命过境叠加;不要把公共日历趋势写成确定预测。",
|
|
].join("\n"),
|
|
}
|
|
: {
|
|
kind: "expanded",
|
|
modelQuestion: [
|
|
`请结合已校验的星盘资料,深入解读 ${input.currentDate} 的今日主题。`,
|
|
"请说明今日趋势、适合推进的事、需要避开的事,以及一个可以立即执行的行动建议。",
|
|
"这是探索性日提示,不是确定预测;精确事件日期只能标为候选触发,不能包装成必然结论。",
|
|
].join("\n"),
|
|
};
|
|
case "birth_time_rectification":
|
|
return {
|
|
kind: "expanded",
|
|
modelQuestion: [
|
|
"请基于已校验的出生资料继续进行生时校正辅助。",
|
|
"先判断现有证据与候选结果,再说明最有区分度的下一步;需要补充信息时优先给用户可点击、容易回答的选项。",
|
|
"候选时间必须标为待验证,不能声称是出生记录中的确定分钟,也不能在没有新证据时循环重启相同流程。",
|
|
].join("\n"),
|
|
};
|
|
default: {
|
|
const exhaustive: never = input.entrypoint;
|
|
return exhaustive;
|
|
}
|
|
}
|
|
}
|