feat: support ollama

This commit is contained in:
2026-02-04 13:19:10 -08:00
parent daedbfd865
commit a0804ed32a
13 changed files with 2480 additions and 5 deletions
+92
View File
@@ -3,6 +3,7 @@
configStore,
type HikariConfig,
type Theme,
type ProviderType,
type CustomThemeColors,
applyFontSize,
applyCustomThemeColors,
@@ -14,11 +15,14 @@
import { getCurrentWindow } from "@tauri-apps/api/window";
let config: HikariConfig = $state({
provider_type: "claude_cli",
model: null,
api_key: null,
custom_instructions: null,
mcp_servers_json: null,
auto_granted_tools: [],
ollama_base_url: "http://localhost:11434",
ollama_model: null,
theme: "dark",
greeting_enabled: true,
greeting_custom_prompt: null,
@@ -72,12 +76,27 @@
grantedTools = Array.from(tools);
});
const availableProviders: { value: ProviderType; label: string; description: string }[] = [
{ value: "claude_cli", label: "Claude CLI", description: "Use Claude Code CLI for AI assistance" },
{ value: "ollama", label: "Ollama (Local)", description: "Use locally running Ollama models" },
];
const availableModels = [
{ value: "", label: "Default (from ~/.claude)" },
{ value: "claude-sonnet-4-20250514", label: "Claude Sonnet 4" },
{ value: "claude-opus-4-20250514", label: "Claude Opus 4" },
];
const ollamaModels = [
{ value: "", label: "Default (llama3.2)" },
{ value: "llama3.2", label: "Llama 3.2" },
{ value: "llama3.2:1b", label: "Llama 3.2 1B" },
{ value: "qwen2.5-coder", label: "Qwen 2.5 Coder" },
{ value: "deepseek-coder-v2", label: "DeepSeek Coder V2" },
{ value: "mistral", label: "Mistral 7B" },
{ value: "gemma2", label: "Gemma 2" },
];
const commonTools = [
"Read",
"Write",
@@ -207,6 +226,79 @@
</div>
{/if}
<!-- Provider Selection Section -->
<section class="mb-6">
<h3 class="text-sm font-medium text-[var(--accent-primary)] uppercase tracking-wider mb-3">
AI Provider
</h3>
<div class="space-y-2">
{#each availableProviders as provider (provider.value)}
<label class="flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors {config.provider_type === provider.value
? 'border-[var(--accent-primary)] bg-[var(--accent-primary)]/10'
: 'border-[var(--border-color)] bg-[var(--bg-primary)] hover:border-[var(--accent-primary)]/50'}">
<input
type="radio"
name="provider"
value={provider.value}
checked={config.provider_type === provider.value}
onchange={() => config.provider_type = provider.value}
class="mt-1 w-4 h-4 text-[var(--accent-primary)] bg-[var(--bg-primary)] border-[var(--border-color)] focus:ring-[var(--accent-primary)]"
/>
<div class="flex-1">
<div class="text-sm font-medium text-[var(--text-primary)]">{provider.label}</div>
<div class="text-xs text-[var(--text-tertiary)]">{provider.description}</div>
</div>
</label>
{/each}
</div>
<!-- Ollama-specific settings -->
{#if config.provider_type === "ollama"}
<div class="mt-4 p-3 bg-[var(--bg-primary)] rounded-lg border border-[var(--border-color)]">
<h4 class="text-sm font-medium text-[var(--text-primary)] mb-3">Ollama Settings</h4>
<!-- Ollama Base URL -->
<div class="mb-3">
<label for="ollama-url" class="block text-xs text-[var(--text-secondary)] mb-1">
Base URL
</label>
<input
id="ollama-url"
type="text"
bind:value={config.ollama_base_url}
placeholder="http://localhost:11434"
class="w-full px-3 py-2 text-sm bg-[var(--bg-secondary)] border border-[var(--border-color)] rounded-lg text-[var(--text-primary)] focus:outline-none focus:border-[var(--accent-primary)]"
/>
</div>
<!-- Ollama Model Selection -->
<div class="mb-3">
<label for="ollama-model" class="block text-xs text-[var(--text-secondary)] mb-1">
Model
</label>
<select
id="ollama-model"
bind:value={config.ollama_model}
class="w-full px-3 py-2 text-sm bg-[var(--bg-secondary)] border border-[var(--border-color)] rounded-lg text-[var(--text-primary)] focus:outline-none focus:border-[var(--accent-primary)]"
>
{#each ollamaModels as model (model.value)}
<option value={model.value}>{model.label}</option>
{/each}
</select>
<p class="text-xs text-[var(--text-tertiary)] mt-1">
Make sure the model is downloaded via <code class="text-[var(--accent-secondary)]">ollama pull</code>
</p>
</div>
<div class="p-2 bg-yellow-500/10 border border-yellow-500/30 rounded text-xs text-yellow-400">
<strong>Note:</strong> Ollama doesn't support tools, MCP servers, or thinking blocks.
For full Claude Code features, use the Claude CLI provider.
</div>
</div>
{/if}
</section>
<!-- Agent Settings Section -->
<section class="mb-6">
<h3 class="text-sm font-medium text-[var(--accent-primary)] uppercase tracking-wider mb-3">