add onStatus callback to streaming enrichment

This commit is contained in:
Ishaan Jaffer 2026-02-18 20:19:34 -08:00
parent 70cb86befa
commit b0080202c8

View file

@ -5602,7 +5602,8 @@ export const enrichPolicyTemplateStream = async (
guardrailDefinitions: any[];
}) => void,
onError?: (error: string) => void,
options?: { instruction?: string; existingCompetitors?: string[] }
options?: { instruction?: string; existingCompetitors?: string[] },
onStatus?: (message: string) => void
) => {
const url = proxyBaseUrl
? `${proxyBaseUrl}/policy/templates/enrich/stream`
@ -5647,6 +5648,8 @@ export const enrichPolicyTemplateStream = async (
const event = JSON.parse(line.slice(6));
if (event.type === "competitor") {
onCompetitor(event.name);
} else if (event.type === "status") {
onStatus?.(event.message);
} else if (event.type === "done") {
onDone(event);
} else if (event.type === "error") {