Fix OpenAI array content, add error logging, Ollama reachability warning
- Normalize OpenAI array-format content to string to fix connection reset - Add error.log with rotating handler for proxy and stream errors - Add global unhandled exception handler returning JSON 500 - Write OLLAMA_URL/DEFAULT_MODEL env vars to DB on startup (reset on restart) - Add extra_hosts to docker-compose.yml for host.docker.internal on Linux - Show warning in admin UI when Ollama URL is unreachable - Return reachable: true/false from /api/ollama-models endpoint
This commit is contained in:
+17
-9
@@ -80,6 +80,7 @@ function SettingsSection({ password }) {
|
||||
const [settings, setSettings] = useState(null);
|
||||
const [availableModels, setAvailableModels] = useState([]);
|
||||
const [modelsLoading, setModelsLoading] = useState(false);
|
||||
const [ollamaReachable, setOllamaReachable] = useState(true);
|
||||
const [proxyEndpoint, setProxyEndpoint] = useState(null);
|
||||
const [saved, setSaved] = useState(false);
|
||||
const [error, setError] = useState(null);
|
||||
@@ -91,12 +92,14 @@ function SettingsSection({ password }) {
|
||||
headers: authHeaders(password),
|
||||
params: url ? { url } : {},
|
||||
});
|
||||
const models = res.data.models;
|
||||
const { models, reachable } = res.data;
|
||||
setOllamaReachable(reachable);
|
||||
setAvailableModels(models);
|
||||
if (models.length > 0 && !models.includes(currentModel)) {
|
||||
setSettings(s => ({ ...s, default_model: models[0] }));
|
||||
}
|
||||
} catch {
|
||||
setOllamaReachable(false);
|
||||
setAvailableModels([]);
|
||||
} finally {
|
||||
setModelsLoading(false);
|
||||
@@ -144,14 +147,19 @@ function SettingsSection({ password }) {
|
||||
</div>
|
||||
<div className="settings-row">
|
||||
<label>Ollama-Endpunkt</label>
|
||||
<input
|
||||
type="url"
|
||||
value={settings.ollama_url}
|
||||
onChange={(e) => setSettings({ ...settings, ollama_url: e.target.value })}
|
||||
onBlur={(e) => fetchModels(e.target.value, settings.default_model)}
|
||||
placeholder="http://localhost:11434"
|
||||
required
|
||||
/>
|
||||
<div className="settings-input-wrap">
|
||||
<input
|
||||
type="url"
|
||||
value={settings.ollama_url}
|
||||
onChange={(e) => setSettings({ ...settings, ollama_url: e.target.value })}
|
||||
onBlur={(e) => fetchModels(e.target.value, settings.default_model)}
|
||||
placeholder="http://localhost:11434"
|
||||
required
|
||||
/>
|
||||
{!ollamaReachable && !modelsLoading && (
|
||||
<div className="warning">⚠ Ollama nicht erreichbar unter {settings.ollama_url}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="settings-row">
|
||||
<label>Standard-Modell</label>
|
||||
|
||||
@@ -194,6 +194,31 @@ tr:hover {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.settings-input-wrap {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.settings-input-wrap input {
|
||||
width: 100%;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: #b8520a;
|
||||
background: #fff3e0;
|
||||
border: 1px solid #e67e22;
|
||||
border-radius: 4px;
|
||||
padding: 6px 10px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.settings-form button {
|
||||
align-self: flex-start;
|
||||
padding: 8px 20px;
|
||||
|
||||
Reference in New Issue
Block a user