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