fix: OxylabsLoader request params and result processing (#5286)
Fix OxylabsLoader request params and result processing
This commit is contained in:
parent
9b8fee3d8f
commit
6fe5b98d6f
|
|
@ -100,7 +100,7 @@ export class OxylabsLoader extends BaseDocumentLoader {
|
||||||
const params = {
|
const params = {
|
||||||
source: this.params.source,
|
source: this.params.source,
|
||||||
geo_location: this.params.geo_location,
|
geo_location: this.params.geo_location,
|
||||||
render: this.params.render,
|
render: this.params.render ? 'html' : null,
|
||||||
parse: this.params.parse,
|
parse: this.params.parse,
|
||||||
user_agent_type: this.params.user_agent_type,
|
user_agent_type: this.params.user_agent_type,
|
||||||
markdown: !this.params.parse,
|
markdown: !this.params.parse,
|
||||||
|
|
@ -110,11 +110,14 @@ export class OxylabsLoader extends BaseDocumentLoader {
|
||||||
|
|
||||||
const response = await this.sendAPIRequest<OxylabsResponse>(params)
|
const response = await this.sendAPIRequest<OxylabsResponse>(params)
|
||||||
|
|
||||||
const docs: OxylabsDocument[] = response.data.results.map((result, index) => ({
|
const docs: OxylabsDocument[] = response.data.results.map((result, index) => {
|
||||||
id: `${response.data.job.id.toString()}-${index}`,
|
const content = typeof result.content === 'string' ? result.content : JSON.stringify(result.content)
|
||||||
pageContent: result.content,
|
return {
|
||||||
metadata: {}
|
id: `${response.data.job.id.toString()}-${index}`,
|
||||||
}))
|
pageContent: content,
|
||||||
|
metadata: {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
return docs
|
return docs
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue