...
This commit is contained in:
@@ -13,8 +13,8 @@ playcmds.run(
|
||||
mut client := openai.get()!
|
||||
|
||||
mut r := client.chat_completion(
|
||||
model: 'gpt-3.5-turbo'
|
||||
model: 'gpt-oss-20b'
|
||||
message: 'Hello, world!'
|
||||
temperature: 0.5
|
||||
temperature: 0.3
|
||||
max_completion_tokens: 1024
|
||||
)!
|
||||
|
||||
@@ -86,10 +86,7 @@ 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}')
|
||||
if true{panic("TO DEBUG, SOMETHING IS NOT RIGHT IN LINE WITH AUTHENTICATION")}
|
||||
|
||||
|
||||
res := json.decode(ChatCompletionRaw, r)!
|
||||
|
||||
@@ -82,7 +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}')
|
||||
// println('install_action: ${install_action}')
|
||||
heroscript := install_action.heroscript()
|
||||
mut obj2 := heroscript_loads(heroscript)!
|
||||
set(obj2)!
|
||||
|
||||
@@ -39,7 +39,7 @@ fn obj_init(mycfg_ OpenAI) !OpenAI {
|
||||
if k != '' {
|
||||
mycfg.api_key = k
|
||||
}
|
||||
if k == '' {
|
||||
if mycfg.url.contains("openrouter"){
|
||||
k2 := os.getenv('OPENROUTER_API_KEY')
|
||||
if k2 != '' {
|
||||
mycfg.api_key = k2
|
||||
|
||||
Reference in New Issue
Block a user