improve interacting with ollama api and models

This commit is contained in:
2026-05-10 17:40:24 +03:30
parent b89ae98524
commit 4c910cb8e8
11 changed files with 265 additions and 225 deletions

View File

@@ -5,27 +5,39 @@
</div>
<div class="flex flex-wrap gap-2">
<flux:badge :color="$ollamaAvailable ? 'emerald' : 'red'" :icon="$ollamaAvailable ? 'check-circle' : 'x-circle'">
{{ $ollamaAvailable ? __('Ollama online') : __('Ollama offline') }}
</flux:badge>
<flux:badge icon="cpu-chip">{{ $providerSummary }}</flux:badge>
<flux:badge icon="circle-stack">{{ __(':count stored', ['count' => $storedCount]) }}</flux:badge>
</div>
</div>
<div class="flex justify-end">
<div class="flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-end">
<div class="w-full max-w-sm">
<flux:select wire:model="embeddingModel" :label="__('Embedding model')">
@foreach ($modelOptions as $option)
<flux:select wire:model="embeddingModel" :label="__('Ollama model')" :disabled="! $ollamaAvailable">
@forelse ($modelOptions as $option)
<flux:select.option value="{{ $option['name'] }}">
{{ $option['name'] }} ({{ $option['dimensions'] }}d)
</flux:select.option>
@endforeach
@empty
<flux:select.option value="" disabled>{{ __('No models returned') }}</flux:select.option>
@endforelse
</flux:select>
<flux:error name="embeddingModel" />
</div>
<flux:button type="button" variant="filled" icon="arrow-path" wire:click="refreshOllama" class="w-full lg:w-auto data-loading:opacity-60">
<span wire:loading.remove wire:target="refreshOllama">{{ __('Refresh') }}</span>
<span wire:loading wire:target="refreshOllama">{{ __('Checking') }}</span>
</flux:button>
</div>
@if (! $ollamaAvailable)
<flux:callout variant="danger" icon="x-circle" :heading="__('Ollama is unavailable')" :text="$ollamaStatusMessage" />
@endif
@if (! $databaseReady)
<div class="rounded-lg border border-amber-300 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-100">
{{ __('Embedding storage is waiting for the pgvector migration.') }}
</div>
<flux:callout variant="warning" icon="exclamation-circle" :heading="__('Embedding storage is unavailable')" :text="__('Embedding storage is waiting for the pgvector migration.')" />
@endif
</header>