This commit is contained in:
Thommy Bucaille 2023-12-28 23:10:45 +01:00
parent 519d4509df
commit 247c43c820
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,9 @@
<?php
return [
// Main
"base_uri" => "http://localhost:4891/v1",
"model" => "nous-hermes-llama2-13b.Q4_0",
"key" => "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",
// Weather API key

View File

@ -187,7 +187,7 @@ class ChatController extends BaseController
try {
// self::$client = OpenAI::client(config('chat.key'));
self::$client = OpenAI::factory()
->withBaseUri("http://localhost:4891/v1")
->withBaseUri(config("chat.base_uri", "api.openai.com/v1"))
->withApiKey(config('chat.key'))
->withHttpClient($client = new \GuzzleHttp\Client([])) // default: HTTP client found using PSR-18 HTTP Client Discovery
->withHttpHeader('OpenAI-Beta', 'assistants=v1')
@ -607,7 +607,7 @@ class ChatController extends BaseController
self::$NB_REQUEST++;
$result = self::$client->chat()->create([
'model' => self::MODEL_USED,
'model' => config('chat.model'),
'messages' => (array)self::$context_messages,
'tools' => self::$tools,
'user' => Helper::isCLI() ? "system" : Auth::user()->username,