krz/brand-bench

A dynamic brand documentation generator with Ollama integration. branding documentation generator ollama

Commit 109cfef2ae

109cfef2ae202d32677032ecff1f4fcc12d30e49

parent: f5c756707f

Unsigned

cmc <hello@cleberg.net> · 2026-04-19 03:57 UTC

clarify ollama settings in docker environments

Layout: unified · split

src/components/SettingsPanel.tsx +5 −3
@@ -86,7 +86,7 @@ export function SettingsPanel({ settings, onChange, onClose }: Props) {
8686 onChange={e => setUrl(e.target.value)}
8787 onBlur={commitUrl}
8888 onKeyDown={e => e.key === 'Enter' && commitUrl()}
89 placeholder="http://localhost:11434"
89 placeholder="empty = same-origin proxy (recommended)"
9090 spellCheck={false}
9191 />
9292 <button
@@ -147,8 +147,10 @@ export function SettingsPanel({ settings, onChange, onClose }: Props) {
147147 Install from <strong>ollama.com</strong>, then pull any model to get started.
148148 </p>
149149 <p>
150 If connection fails, ensure Ollama is running and CORS is open:<br />
151 <code>OLLAMA_ORIGINS=* ollama serve</code>
150 Leave <strong>Server URL</strong> empty to route through the app's
151 own server (works automatically with the Docker setup). For local
152 dev, set it to <code>http://localhost:11434</code> and ensure CORS
153 is open: <code>OLLAMA_ORIGINS=* ollama serve</code>
152154 </p>
153155 </div>
154156 </div>
src/engine/aiGenerator.ts +8 −3
@@ -84,7 +84,10 @@ export async function generateWithAI(
8484 settings: OllamaSettings,
8585 signal?: AbortSignal,
8686): Promise<BrandOutputs> {
87 const url = `${settings.baseUrl.replace(/\/$/, '')}/api/chat`;
87 // Empty baseUrl means "same origin" — nginx proxies /api/ to Ollama internally.
88 // A full URL (e.g. http://localhost:11434) is used as-is for local dev.
89 const base = settings.baseUrl ? settings.baseUrl.replace(/\/$/, '') : '';
90 const url = `${base}/api/chat`;
8891
8992 let res: Response;
9093 try {
@@ -104,7 +107,8 @@ export async function generateWithAI(
104107 });
105108 } catch (err) {
106109 if ((err as Error).name === 'AbortError') throw err;
107 throw new Error(`Cannot reach Ollama at ${settings.baseUrl}. Is it running?`);
110 const target = settings.baseUrl || '(same origin /api/)';
111 throw new Error(`Cannot reach Ollama at ${target}. Is it running?`);
108112 }
109113
110114 if (!res.ok) {
@@ -130,7 +134,8 @@ export async function generateWithAI(
130134
131135// Test connectivity and return available model names
132136export async function testOllamaConnection(baseUrl: string): Promise<string[]> {
133 const url = `${baseUrl.replace(/\/$/, '')}/api/tags`;
137 const base = baseUrl ? baseUrl.replace(/\/$/, '') : '';
138 const url = `${base}/api/tags`;
134139 const res = await fetch(url, { signal: AbortSignal.timeout(5000) });
135140 if (!res.ok) throw new Error(`Ollama responded with ${res.status}`);
136141 const data = await res.json() as { models?: Array<{ name: string }> };
src/hooks/useSettings.ts +1 −1
@@ -8,7 +8,7 @@ export interface OllamaSettings {
88
99const DEFAULTS: OllamaSettings = {
1010 enabled: false,
11 baseUrl: 'http://localhost:11434',
11 baseUrl: '', // empty = same-origin proxy (/api/ via nginx); set to http://localhost:11434 for local dev
1212 model: 'llama3.2',
1313};
1414