mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-12 07:39:00 +08:00
stream session IDs for single URLs
This commit is contained in:
parent
d82f44c93e
commit
defc80af32
@ -16,6 +16,7 @@ export async function singleAnswerCompletion({
|
||||
systemPrompt,
|
||||
useAgent,
|
||||
extractId,
|
||||
sessionId,
|
||||
}: {
|
||||
singleAnswerDocs: Document[];
|
||||
rSchema: any;
|
||||
@ -24,6 +25,7 @@ export async function singleAnswerCompletion({
|
||||
systemPrompt: string;
|
||||
useAgent: boolean;
|
||||
extractId: string;
|
||||
sessionId: string;
|
||||
}): Promise<{
|
||||
extract: any;
|
||||
tokenUsage: TokenUsage;
|
||||
@ -58,6 +60,7 @@ export async function singleAnswerCompletion({
|
||||
urls: singleAnswerDocs.map(doc => doc.metadata.url || doc.metadata.sourceURL || ""),
|
||||
useAgent,
|
||||
extractId,
|
||||
sessionId,
|
||||
});
|
||||
|
||||
const completion = {
|
||||
|
@ -750,6 +750,8 @@ export async function performExtraction(
|
||||
};
|
||||
}
|
||||
|
||||
let thisSessionId = 'fc-' + crypto.randomUUID();
|
||||
|
||||
await updateExtract(extractId, {
|
||||
status: "processing",
|
||||
steps: [
|
||||
@ -760,6 +762,7 @@ export async function performExtraction(
|
||||
discoveredLinks: links,
|
||||
},
|
||||
],
|
||||
sessionIds: [thisSessionId],
|
||||
});
|
||||
|
||||
// Generate completions
|
||||
@ -781,6 +784,7 @@ export async function performExtraction(
|
||||
systemPrompt: request.systemPrompt ?? "",
|
||||
useAgent: isAgentExtractModelValid(request.agent?.model),
|
||||
extractId,
|
||||
sessionId: thisSessionId,
|
||||
});
|
||||
costTracking.smartScrapeCost += singleAnswerSmartScrapeCost;
|
||||
costTracking.smartScrapeCallCount += singleAnswerSmartScrapeCallCount;
|
||||
|
Loading…
x
Reference in New Issue
Block a user