kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
rodzic
c60f1a108f
commit
ae60410cc1
|
@ -104,9 +104,9 @@ export class DiffbotTool extends BaseTask<DiffbotInput, DiffbotOutput> {
|
||||||
url: ctx.input!.url
|
url: ctx.input!.url
|
||||||
})
|
})
|
||||||
|
|
||||||
this._logger.info(res, `Diffbot response for url "${ctx.input!.url}"`)
|
// this._logger.info(res, `Diffbot response for url "${ctx.input!.url}"`)
|
||||||
|
|
||||||
const pickedRes = {
|
const output = this.outputSchema.parse({
|
||||||
type: res.type,
|
type: res.type,
|
||||||
title: res.title,
|
title: res.title,
|
||||||
objects: res.objects.map((obj) => ({
|
objects: res.objects.map((obj) => ({
|
||||||
|
@ -126,12 +126,9 @@ export class DiffbotTool extends BaseTask<DiffbotInput, DiffbotOutput> {
|
||||||
// tags: obj.tags?.map((tag) => tag.label)
|
// tags: obj.tags?.map((tag) => tag.label)
|
||||||
// images: obj.images?.map((image) => omit(image, 'diffbotUri'))
|
// images: obj.images?.map((image) => omit(image, 'diffbotUri'))
|
||||||
}))
|
}))
|
||||||
}
|
})
|
||||||
|
|
||||||
this._logger.info(
|
this._logger.info(output, `Diffbot response for url "${ctx.input!.url}"`)
|
||||||
pickedRes,
|
return output
|
||||||
`Diffbot picked response for url "${ctx.input!.url}"`
|
|
||||||
)
|
|
||||||
return this.outputSchema.parse(pickedRes)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,13 +166,12 @@ export class SearchAndCrawlTool extends BaseTask<
|
||||||
)
|
)
|
||||||
).flat()
|
).flat()
|
||||||
|
|
||||||
const result = {
|
const output = this.outputSchema.parse({
|
||||||
...omit(search.result, 'organic_results'),
|
...omit(search.result, 'organic_results'),
|
||||||
scrape_results: scrapeResults
|
scrape_results: scrapeResults
|
||||||
}
|
})
|
||||||
|
|
||||||
this._logger.info(result, `SearchAndCrawl response for query "${query}"`)
|
this._logger.info(output, `SearchAndCrawl response for query "${query}"`)
|
||||||
|
return output
|
||||||
return this.outputSchema.parse(result)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,11 +103,6 @@ export class SerpAPITool extends BaseTask<SerpAPIInput, SerpAPIOutput> {
|
||||||
// results manuall
|
// results manuall
|
||||||
})
|
})
|
||||||
|
|
||||||
this._logger.info(
|
|
||||||
res,
|
|
||||||
`SerpAPI response for query ${JSON.stringify(ctx.input, null, 2)}"`
|
|
||||||
)
|
|
||||||
|
|
||||||
const twitterResults = res.twitter_results
|
const twitterResults = res.twitter_results
|
||||||
? {
|
? {
|
||||||
...res.twitter_results,
|
...res.twitter_results,
|
||||||
|
@ -120,11 +115,15 @@ export class SerpAPITool extends BaseTask<SerpAPIInput, SerpAPIOutput> {
|
||||||
}
|
}
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
return this.outputSchema.parse({
|
const output = this.outputSchema.parse({
|
||||||
knowledge_graph: res.knowledge_graph,
|
knowledge_graph: res.knowledge_graph,
|
||||||
answer_box: res.answer_box,
|
answer_box: res.answer_box,
|
||||||
organic_results: res.organic_results?.slice(0, numResults),
|
organic_results: res.organic_results?.slice(0, numResults),
|
||||||
twitter_results: twitterResults
|
twitter_results: twitterResults
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this._logger.info(output, `SerpAPI response for query "${query}"`)
|
||||||
|
|
||||||
|
return output
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue