...
This commit is contained in:
@@ -86,8 +86,11 @@ pub fn (mut f OpenAI) chat_completion(args_ CompletionArgs) !ChatCompletion {
|
||||
data := json.encode(m)
|
||||
// println('data: ${data}')
|
||||
mut conn := f.connection()!
|
||||
println(f)
|
||||
r := conn.post_json_str(prefix: 'chat/completions', data: data)!
|
||||
// println('res: ${r}')
|
||||
println('res: ${r}')
|
||||
if true{panic("TO DEBUG, SOMETHING IS NOT RIGHT IN LINE WITH AUTHENTICATION")}
|
||||
|
||||
|
||||
res := json.decode(ChatCompletionRaw, r)!
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
mut install_actions := plbook.find(filter: 'openai.configure')!
|
||||
if install_actions.len > 0 {
|
||||
for install_action in install_actions {
|
||||
println('install_action: ${install_action}')
|
||||
heroscript := install_action.heroscript()
|
||||
mut obj2 := heroscript_loads(heroscript)!
|
||||
set(obj2)!
|
||||
|
||||
@@ -59,7 +59,7 @@ pub fn (mut client OpenAI) connection() !&httpconnection.HTTPConnection {
|
||||
)!
|
||||
c2
|
||||
}
|
||||
|
||||
//Authorization: 'Bearer <OPENROUTER_API_KEY>',
|
||||
c.default_header.set(.authorization, 'Bearer ${client.api_key}')
|
||||
client.conn = c
|
||||
return c
|
||||
|
||||
@@ -9,7 +9,10 @@ import freeflowuniverse.herolib.core.playcmds
|
||||
|
||||
playcmds.run(
|
||||
heroscript:'
|
||||
!!openai.configure name: "default" key: "" url: "https://openrouter.ai/api/v1" model_default: "gpt-oss-120b"
|
||||
!!openai.configure name:"default"
|
||||
key:"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"
|
||||
url:"https://openrouter.ai/api/v1"
|
||||
model_default:"gpt-oss-120b"
|
||||
'
|
||||
heroscript_path:''
|
||||
reset: false
|
||||
|
||||
Reference in New Issue
Block a user