kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/701/head
rodzic
ec2489da6a
commit
1ae522b610
|
@ -2,6 +2,7 @@ import {
|
|||
aiFunction,
|
||||
AIFunctionsProvider,
|
||||
getEnv,
|
||||
omit,
|
||||
pick,
|
||||
sanitizeSearchParams
|
||||
} from '@agentic/core'
|
||||
|
@ -72,7 +73,7 @@ export class OpenMeteoClient extends AIFunctionsProvider {
|
|||
|
||||
const { start, end } = validateAndSetDates(params.startDate, params.endDate)
|
||||
|
||||
return this.ky
|
||||
const response = await this.ky
|
||||
.get('forecast', {
|
||||
searchParams: sanitizeSearchParams({
|
||||
...(await extractLocation()),
|
||||
|
@ -91,6 +92,20 @@ export class OpenMeteoClient extends AIFunctionsProvider {
|
|||
})
|
||||
})
|
||||
.json<openmeteo.GetV1ForecastResponse>()
|
||||
|
||||
return omit(
|
||||
response,
|
||||
'latitude',
|
||||
'longitude',
|
||||
'elevation',
|
||||
'generationtime_ms',
|
||||
'utc_offset_seconds',
|
||||
'timezone',
|
||||
'timezone_abbreviation',
|
||||
'elevation',
|
||||
'hourly',
|
||||
'hourly_units'
|
||||
)
|
||||
}
|
||||
|
||||
protected async _geocode(
|
||||
|
|
|
@ -20,8 +20,6 @@ import { openmeteo } from './open-meteo'
|
|||
export class OpenMeteoClient extends AIFunctionsProvider {
|
||||
protected readonly ky: KyInstance
|
||||
|
||||
protected readonly apiBaseUrl: string
|
||||
|
||||
constructor({
|
||||
apiBaseUrl,
|
||||
ky = defaultKy
|
||||
|
@ -32,8 +30,6 @@ export class OpenMeteoClient extends AIFunctionsProvider {
|
|||
} = {}) {
|
||||
super()
|
||||
|
||||
this.apiBaseUrl = apiBaseUrl
|
||||
|
||||
this.ky = ky.extend({
|
||||
prefixUrl: apiBaseUrl
|
||||
})
|
||||
|
|
Ładowanie…
Reference in New Issue