This commit is contained in:
2025-08-06 12:50:30 +02:00
parent d4df226381
commit 3bca5f661e
4 changed files with 4 additions and 7 deletions

View File

@@ -13,8 +13,8 @@ playcmds.run(
mut client := openai.get()! mut client := openai.get()!
mut r := client.chat_completion( mut r := client.chat_completion(
model: 'gpt-3.5-turbo' model: 'gpt-oss-20b'
message: 'Hello, world!' message: 'Hello, world!'
temperature: 0.5 temperature: 0.3
max_completion_tokens: 1024 max_completion_tokens: 1024
)! )!

View File

@@ -86,10 +86,7 @@ pub fn (mut f OpenAI) chat_completion(args_ CompletionArgs) !ChatCompletion {
data := json.encode(m) data := json.encode(m)
// println('data: ${data}') // println('data: ${data}')
mut conn := f.connection()! mut conn := f.connection()!
println(f)
r := conn.post_json_str(prefix: 'chat/completions', data: data)! r := conn.post_json_str(prefix: 'chat/completions', data: data)!
println('res: ${r}')
if true{panic("TO DEBUG, SOMETHING IS NOT RIGHT IN LINE WITH AUTHENTICATION")}
res := json.decode(ChatCompletionRaw, r)! res := json.decode(ChatCompletionRaw, r)!

View File

@@ -82,7 +82,7 @@ pub fn play(mut plbook PlayBook) ! {
mut install_actions := plbook.find(filter: 'openai.configure')! mut install_actions := plbook.find(filter: 'openai.configure')!
if install_actions.len > 0 { if install_actions.len > 0 {
for install_action in install_actions { for install_action in install_actions {
println('install_action: ${install_action}') // println('install_action: ${install_action}')
heroscript := install_action.heroscript() heroscript := install_action.heroscript()
mut obj2 := heroscript_loads(heroscript)! mut obj2 := heroscript_loads(heroscript)!
set(obj2)! set(obj2)!

View File

@@ -39,7 +39,7 @@ fn obj_init(mycfg_ OpenAI) !OpenAI {
if k != '' { if k != '' {
mycfg.api_key = k mycfg.api_key = k
} }
if k == '' { if mycfg.url.contains("openrouter"){
k2 := os.getenv('OPENROUTER_API_KEY') k2 := os.getenv('OPENROUTER_API_KEY')
if k2 != '' { if k2 != '' {
mycfg.api_key = k2 mycfg.api_key = k2