From 5b8e4c634e195a75cc004930417e1edf2e544f12 Mon Sep 17 00:00:00 2001 From: hackerESQ Date: Fri, 6 Dec 2024 16:09:03 -0600 Subject: [PATCH 1/2] fix: remove validation which could prevent selfhosting w ollama --- resources/views/livewire/ai-chat-window.blade.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/resources/views/livewire/ai-chat-window.blade.php b/resources/views/livewire/ai-chat-window.blade.php index ca4427c..c6ba960 100644 --- a/resources/views/livewire/ai-chat-window.blade.php +++ b/resources/views/livewire/ai-chat-window.blade.php @@ -202,10 +202,6 @@ new class extends Component { $organization = config('openai.organization'); $baseUri = config('openai.base_uri'); - if (! is_string($apiKey) || ($organization !== null && ! is_string($organization))) { - throw new \InvalidArgumentException('The OpenAI API Key is missing. Please publish the [openai.php] configuration file and set the [api_key].'); - } - return OpenAI::factory() ->withApiKey($apiKey) ->withOrganization($organization) From 6f72a03ecf920cdad4a2c202582007e0e851f7c2 Mon Sep 17 00:00:00 2001 From: hackerESQ Date: Fri, 6 Dec 2024 16:10:27 -0600 Subject: [PATCH 2/2] fix: specifically use factory import --- resources/views/livewire/ai-chat-window.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/livewire/ai-chat-window.blade.php b/resources/views/livewire/ai-chat-window.blade.php index c6ba960..5fea263 100644 --- a/resources/views/livewire/ai-chat-window.blade.php +++ b/resources/views/livewire/ai-chat-window.blade.php @@ -5,7 +5,7 @@ use App\Models\AiChat; use App\Models\Holding; use Illuminate\Database\Eloquent\Model; use Livewire\Volt\Component; -use OpenAI; +use OpenAI\Factory; use OpenAI\Responses\StreamResponse; new class extends Component {