Performing deep research with SSE endpoint, sometimes returns duplicate the final report text.
Using SSE endpoint, sometimes duplicate final report is returned.
const response = await fetch("http://localhost:3000/api/sse", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
query: formattedPrompt,
provider: "google",
thinkingModel: "gemini-2.5-flash",
taskModel: "gemini-2.5-flash",
searchProvider: "model",
language: "en-US",
maxResult: 5,
enableCitationImage: false,
enableReferences: true
}),
signal: ctrl.signal as any
});
let finalReportResult: {
title: string;
finalReport: string;
sources?: { url: string; title?: string }[];
} | null = null;
const parser = createParser({
onEvent(event) {
const { event: evt, data } = event;
const msgData = JSON.parse(data);
if (evt !== "message") {
//console.log(evt, msgData.step, msgData.status);
}
if (evt === "progress" && msgData.step === "final-report") {
console.log(evt, msgData.step, msgData.status);
}
if (evt === "progress" && msgData.step === "final-report" && msgData.status === "end") {
finalReportResult = msgData.data;
}
}
});
for await (const chunk of response.body) {
parser.feed(chunk.toString());
}
if (!finalReportResult) {
console.error("No final report result received.");
return;
}
const { title, finalReport, sources } = finalReportResult as FinalReportResult;
// if finalReport is empty or small throw an error
if (!finalReport || finalReport.trim() === "" || finalReport.length <= 20000) {
throw new Error("Final report is empty");
}
Single full final report should be returned.
Bug Description
Performing deep research with SSE endpoint, sometimes returns duplicate the final report text.
Version: 0.9.20
Steps to Reproduce
Using SSE endpoint, sometimes duplicate final report is returned.
code:
Expected Behavior
Single full final report should be returned.
Screenshots
No response
Deployment Method
Desktop OS
No response
Desktop Browser
No response
Desktop Browser Version
No response
Smartphone Device
No response
Smartphone OS
No response
Smartphone Browser
No response
Smartphone Browser Version
No response
Additional Logs
No response