mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-12 07:29:04 +08:00
fix
This commit is contained in:
parent
2193bee133
commit
2245650bc3
@ -8,14 +8,15 @@ import {
|
||||
buildAnalyzeSchemaPrompt,
|
||||
buildAnalyzeSchemaUserPrompt,
|
||||
} from "../build-prompts";
|
||||
import { logger } from "../../../lib/logger";
|
||||
import { jsonSchema } from "ai";
|
||||
import { getModel } from "../../../lib/generic-ai";
|
||||
import { Logger } from "winston";
|
||||
|
||||
export async function analyzeSchemaAndPrompt(
|
||||
urls: string[],
|
||||
schema: any,
|
||||
prompt: string,
|
||||
logger: Logger,
|
||||
): Promise<{
|
||||
isMultiEntity: boolean;
|
||||
multiEntityKeys: string[];
|
||||
@ -26,7 +27,7 @@ export async function analyzeSchemaAndPrompt(
|
||||
}> {
|
||||
let cost = 0;
|
||||
if (!schema) {
|
||||
const genRes = await generateSchemaFromPrompt(prompt);
|
||||
const genRes = await generateSchemaFromPrompt(prompt, logger);
|
||||
schema = genRes.extract;
|
||||
cost = genRes.cost;
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ export async function performExtraction(
|
||||
|
||||
let reqSchema = request.schema;
|
||||
if (!reqSchema && request.prompt) {
|
||||
const schemaGenRes = await generateSchemaFromPrompt(request.prompt);
|
||||
const schemaGenRes = await generateSchemaFromPrompt(request.prompt, logger);
|
||||
reqSchema = schemaGenRes.extract;
|
||||
costTracking.otherCallCount++;
|
||||
costTracking.otherCost += schemaGenRes.cost;
|
||||
@ -214,7 +214,7 @@ export async function performExtraction(
|
||||
keyIndicators,
|
||||
tokenUsage: schemaAnalysisTokenUsage,
|
||||
cost: schemaAnalysisCost,
|
||||
} = await analyzeSchemaAndPrompt(urls, reqSchema, request.prompt ?? "");
|
||||
} = await analyzeSchemaAndPrompt(urls, reqSchema, request.prompt ?? "", logger);
|
||||
|
||||
logger.debug("Analyzed schema.", {
|
||||
isMultiEntity,
|
||||
|
Loading…
x
Reference in New Issue
Block a user