...
This commit is contained in:
@@ -15,7 +15,7 @@ pub mut:
|
|||||||
api_key string
|
api_key string
|
||||||
url string = 'https://openrouter.ai/api/v1'
|
url string = 'https://openrouter.ai/api/v1'
|
||||||
model_default string = 'gpt-oss-120b'
|
model_default string = 'gpt-oss-120b'
|
||||||
conn ?&httpconnection.HTTPConnection @[skip; str: skip]
|
// conn ?&httpconnection.HTTPConnection @[skip; str: skip]
|
||||||
}
|
}
|
||||||
|
|
||||||
// your checking & initialization code if needed
|
// your checking & initialization code if needed
|
||||||
@@ -50,20 +50,16 @@ fn obj_init(mycfg_ OpenAI) !OpenAI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut client OpenAI) connection() !&httpconnection.HTTPConnection {
|
pub fn (mut client OpenAI) connection() !&httpconnection.HTTPConnection {
|
||||||
mut c := client.conn or {
|
|
||||||
mut c2 := httpconnection.new(
|
mut c2 := httpconnection.new(
|
||||||
name: 'openaiconnection_${client.name}'
|
name: 'openaiconnection_${client.name}'
|
||||||
url: client.url
|
url: client.url
|
||||||
cache: false
|
cache: false
|
||||||
retry: 20
|
retry: 20
|
||||||
)!
|
)!
|
||||||
c2
|
|
||||||
}
|
|
||||||
|
|
||||||
// Authorization: 'Bearer <OPENROUTER_API_KEY>',
|
// Authorization: 'Bearer <OPENROUTER_API_KEY>',
|
||||||
c.default_header.set(.authorization, 'Bearer ${client.api_key}')
|
c2.default_header.set(.authorization, 'Bearer ${client.api_key}')
|
||||||
client.conn = c
|
client.conn = c2
|
||||||
return c
|
return c2
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////NORMALLY NO NEED TO TOUCH
|
/////////////NORMALLY NO NEED TO TOUCH
|
||||||
|
|||||||
Reference in New Issue
Block a user