mirror of
https://github.com/simstudioai/sim.git
synced 2026-03-15 03:00:33 -04:00
Compare commits
2 Commits
improvemen
...
cursor/scr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01f02f1169 | ||
|
|
fecc435c10 |
@@ -38,11 +38,12 @@ export const scrapeTool: ToolConfig<ScrapeParams, ScrapeResponse> = {
|
||||
pricing: {
|
||||
type: 'custom',
|
||||
getCost: (_params, output) => {
|
||||
if (output.creditsUsed == null) {
|
||||
const creditsUsedString = (output.metadata as { creditsUsed?: number })?.creditsUsed
|
||||
if (creditsUsedString == null) {
|
||||
throw new Error('Firecrawl response missing creditsUsed field')
|
||||
}
|
||||
|
||||
const creditsUsed = Number(output.creditsUsed)
|
||||
const creditsUsed = Number(creditsUsedString)
|
||||
if (Number.isNaN(creditsUsed)) {
|
||||
throw new Error('Firecrawl response returned a non-numeric creditsUsed field')
|
||||
}
|
||||
@@ -110,7 +111,7 @@ export const scrapeTool: ToolConfig<ScrapeParams, ScrapeResponse> = {
|
||||
markdown: data.data.markdown,
|
||||
html: data.data.html,
|
||||
metadata: data.data.metadata,
|
||||
creditsUsed: data.creditsUsed,
|
||||
creditsUsed: data.data.metadata?.creditsUsed,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user