fix(rectification): ask spoken collect questions in the agent body
The standalone collect prompt bar reused the choice-card chrome and duplicated the question. Visibility now comes from the spoken reply, with an empty-body fallback that posts the persisted focus prompt. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,7 +10,12 @@ import {
|
||||
transitionV9CaseStatus,
|
||||
} from "@/lib/rectification-agentic/v9/tool-service";
|
||||
import { decideFromDossier, rectificationFollowupCatalog } from "@/lib/rectification-agentic/v9/decision-from-dossier";
|
||||
import { applyRectificationChoice, applyCollectFocusDenial, persistNextInterviewIfIdle } from "@/lib/rectification-agentic/v9/answer-choice";
|
||||
import {
|
||||
applyRectificationChoice,
|
||||
applyCollectFocusDenial,
|
||||
persistNextInterviewIfIdle,
|
||||
persistEmptyCollectSpokenAssistant,
|
||||
} from "@/lib/rectification-agentic/v9/answer-choice";
|
||||
import { mapRectificationRpcError } from "@/lib/rectification-agentic/v9/case-service";
|
||||
import { CHOICE_ACTION, STOP_ACTION } from "@/lib/rectification-agentic/v9/choice-action";
|
||||
import { runV9AgentTurn, type V9RunBilling } from "@/lib/rectification-agentic/v9/agent-run";
|
||||
@@ -674,6 +679,22 @@ export async function POST(request: Request) {
|
||||
`[rectification-v9] persist next interview after turn failed case=${caseId} reason=${error instanceof Error ? error.name : "Unknown"}`,
|
||||
);
|
||||
}
|
||||
if (!result.answerText.trim()) {
|
||||
try {
|
||||
const fallback = await persistEmptyCollectSpokenAssistant({
|
||||
accounting: accounting as never,
|
||||
userId,
|
||||
caseId,
|
||||
requestId: crypto.randomUUID(),
|
||||
answerText: result.answerText,
|
||||
});
|
||||
if (fallback) send({ type: "answer.delta", text: fallback });
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
`[rectification-v9] empty collect spoken fallback failed case=${caseId} reason=${error instanceof Error ? error.name : "Unknown"}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
send({ type: "done", emitted: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user