Skip to content

Commit f347e3f

Browse files
TheodoreSpeaksTheodore Ligreptile-apps[bot]
authored
fix(firecrawl) fix firecrawl scrape credit usage calculation (#3583)
* fix(firecrawl) fix firecrawl scrape credit usage calculation * Update apps/sim/tools/firecrawl/scrape.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Fix syntax --------- Co-authored-by: Theodore Li <theo@sim.ai> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
1 parent e13f52f commit f347e3f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/sim/tools/firecrawl/scrape.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ export const scrapeTool: ToolConfig<ScrapeParams, ScrapeResponse> = {
3838
pricing: {
3939
type: 'custom',
4040
getCost: (_params, output) => {
41-
if (output.creditsUsed == null) {
41+
const creditsUsed = (output.metadata as { creditsUsed?: number })?.creditsUsed
42+
if (creditsUsed == null) {
4243
throw new Error('Firecrawl response missing creditsUsed field')
4344
}
4445

45-
const creditsUsed = Number(output.creditsUsed)
4646
if (Number.isNaN(creditsUsed)) {
4747
throw new Error('Firecrawl response returned a non-numeric creditsUsed field')
4848
}

0 commit comments

Comments
 (0)