fix: keep foreground consultations responsive

This commit is contained in:
Jesse_Chen
2026-08-11 11:59:14 +08:00
parent 8eed0603f9
commit 620131d6a8
9 changed files with 191 additions and 36 deletions
+1 -1
View File
@@ -480,7 +480,7 @@ export async function POST(request: Request) {
theme: parsed.data.theme,
});
const workflowContext = applyBirthTimeModeToWorkflowContext(
await runConsultationWorkflow(toolInput),
await runConsultationWorkflow(toolInput, { foreground: true }),
consultationMode,
);
const workflowReceipt = consultationWorkflowReceipt(workflowContext);
+5 -1
View File
@@ -55,7 +55,10 @@ const apiBase = process.env.JYOTISH_API_BASE ?? "http://127.0.0.1:5200";
const jyotishSkillPath = process.env.JYOTISH_SKILL_PATH?.trim()
|| path.resolve(process.cwd(), "..", "skills", "jyotish-vedic-astrology");
export async function runConsultationWorkflow(input: ConsultationInput) {
export async function runConsultationWorkflow(
input: ConsultationInput,
options?: { foreground?: boolean },
) {
const { entryMode, question, theme, ...workflowInput } = input;
const workflowRequest = projectConsultationWorkflowRequest(question, theme);
const response = await fetch(`${apiBase}/api/consultation_workflow`, {
@@ -67,6 +70,7 @@ export async function runConsultationWorkflow(input: ConsultationInput) {
question: workflowRequest.question,
question_text: workflowRequest.question,
theme: workflowRequest.themes,
defer_optional_external_evidence: options?.foreground === true,
}),
signal: AbortSignal.timeout(90_000),
});