From 1d98724c0297d3aa98b3c4248c3b8853e1d36018 Mon Sep 17 00:00:00 2001 From: despiegk Date: Thu, 21 Aug 2025 12:16:32 +0200 Subject: [PATCH] ... --- lib/clients/openai/openai_model.v | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/lib/clients/openai/openai_model.v b/lib/clients/openai/openai_model.v index 4e15821c..b76fc79b 100644 --- a/lib/clients/openai/openai_model.v +++ b/lib/clients/openai/openai_model.v @@ -15,7 +15,7 @@ pub mut: api_key string url string = 'https://openrouter.ai/api/v1' model_default string = 'gpt-oss-120b' - conn ?&httpconnection.HTTPConnection @[skip; str: skip] + // conn ?&httpconnection.HTTPConnection @[skip; str: skip] } // your checking & initialization code if needed @@ -50,20 +50,16 @@ fn obj_init(mycfg_ OpenAI) !OpenAI { } pub fn (mut client OpenAI) connection() !&httpconnection.HTTPConnection { - mut c := client.conn or { - mut c2 := httpconnection.new( - name: 'openaiconnection_${client.name}' - url: client.url - cache: false - retry: 20 - )! - c2 - } - + mut c2 := httpconnection.new( + name: 'openaiconnection_${client.name}' + url: client.url + cache: false + retry: 20 + )! // Authorization: 'Bearer ', - c.default_header.set(.authorization, 'Bearer ${client.api_key}') - client.conn = c - return c + c2.default_header.set(.authorization, 'Bearer ${client.api_key}') + client.conn = c2 + return c2 } /////////////NORMALLY NO NEED TO TOUCH