kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
fix: increase default timeout for jina
rodzic
4cc7bb6f26
commit
c693fddbb6
|
@ -116,10 +116,12 @@ export class JinaClient extends AIFunctionsProvider {
|
||||||
|
|
||||||
constructor({
|
constructor({
|
||||||
apiKey = getEnv('JINA_API_KEY'),
|
apiKey = getEnv('JINA_API_KEY'),
|
||||||
|
timeoutMs = 60_000,
|
||||||
throttle = true,
|
throttle = true,
|
||||||
ky = defaultKy
|
ky = defaultKy
|
||||||
}: {
|
}: {
|
||||||
apiKey?: string
|
apiKey?: string
|
||||||
|
timeoutMs?: number
|
||||||
throttle?: boolean
|
throttle?: boolean
|
||||||
ky?: KyInstance
|
ky?: KyInstance
|
||||||
} = {}) {
|
} = {}) {
|
||||||
|
@ -131,12 +133,14 @@ export class JinaClient extends AIFunctionsProvider {
|
||||||
ky = ky.extend({ headers: { Authorization: `Bearer ${apiKey}` } })
|
ky = ky.extend({ headers: { Authorization: `Bearer ${apiKey}` } })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ky = ky.extend({ timeout: timeoutMs })
|
||||||
|
|
||||||
const throttledKyReader = throttle
|
const throttledKyReader = throttle
|
||||||
? throttleKy(
|
? throttleKy(
|
||||||
ky,
|
ky,
|
||||||
pThrottle({
|
pThrottle({
|
||||||
limit: apiKey ? 200 : 20,
|
limit: apiKey ? 200 : 20,
|
||||||
interval: 60 * 60 * 1000
|
interval: 60 * 60 * 1000 // 60 minutes
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
: ky
|
: ky
|
||||||
|
@ -147,11 +151,11 @@ export class JinaClient extends AIFunctionsProvider {
|
||||||
ky,
|
ky,
|
||||||
pThrottle({
|
pThrottle({
|
||||||
limit: apiKey ? 40 : 5,
|
limit: apiKey ? 40 : 5,
|
||||||
interval: 60 * 60 * 1000
|
interval: 60 * 60 * 1000 // 60 minutes
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
: ky
|
: ky
|
||||||
this.kySearch = throttledKySearch.extend({ prefixUrl: 'https://s.jina.ai ' })
|
this.kySearch = throttledKySearch.extend({ prefixUrl: 'https://s.jina.ai' })
|
||||||
}
|
}
|
||||||
|
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
|
|
Ładowanie…
Reference in New Issue