From e9f3e3a7dae79158f5d390a6713eb9569e9ee58e Mon Sep 17 00:00:00 2001 From: Steven Enamakel's Droid Date: Mon, 1 Jun 2026 20:36:29 -0700 Subject: [PATCH] fix(inference): normalize 0.0.0.0 to 127.0.0.1 in Ollama URL + add endpoint edit button (#3161) --- .../components/settings/panels/AIPanel.tsx | 27 ++- .../panels/__tests__/AIPanel.test.tsx | 101 +++++++++++ app/src/lib/i18n/ar.ts | 2 + app/src/lib/i18n/bn.ts | 2 + app/src/lib/i18n/de.ts | 2 + app/src/lib/i18n/en.ts | 2 + app/src/lib/i18n/es.ts | 2 + app/src/lib/i18n/fr.ts | 2 + app/src/lib/i18n/hi.ts | 2 + app/src/lib/i18n/id.ts | 2 + app/src/lib/i18n/it.ts | 2 + app/src/lib/i18n/ko.ts | 2 + app/src/lib/i18n/pl.ts | 2 + app/src/lib/i18n/pt.ts | 2 + app/src/lib/i18n/ru.ts | 2 + app/src/lib/i18n/zh-CN.ts | 2 + .../api/__tests__/aiSettingsApi.test.ts | 49 ++++++ app/src/services/api/aiSettingsApi.ts | 4 +- app/src/utils/ollamaUrlValidation.test.ts | 6 + app/src/utils/ollamaUrlValidation.ts | 11 +- src/openhuman/about_app/catalog_data.rs | 2 +- src/openhuman/config/ops.rs | 18 +- src/openhuman/config/ops_tests.rs | 40 ++++- src/openhuman/config/schemas.rs | 33 +++- src/openhuman/config/schemas_tests.rs | 38 +++- src/openhuman/inference/local/mod.rs | 4 +- src/openhuman/inference/local/ollama.rs | 162 +++++++++++++++++- .../inference/local/service/assets.rs | 24 +-- .../inference/local/service/bootstrap.rs | 2 +- .../inference/local/service/ollama_admin.rs | 30 +++- .../inference/local/service/vision_embed.rs | 4 +- src/openhuman/inference/schemas.rs | 25 ++- src/openhuman/inference/schemas_tests.rs | 14 ++ tests/json_rpc_e2e.rs | 60 +++++++ tests/memory_sync_sources_raw_coverage_e2e.rs | 3 + 35 files changed, 634 insertions(+), 51 deletions(-) diff --git a/app/src/components/settings/panels/AIPanel.tsx b/app/src/components/settings/panels/AIPanel.tsx index 43a244e88..8afe1bf3a 100644 --- a/app/src/components/settings/panels/AIPanel.tsx +++ b/app/src/components/settings/panels/AIPanel.tsx @@ -9,7 +9,7 @@ * per row, so the resolved provider+model is always rendered inline. */ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; -import { LuCheck, LuCircleAlert, LuKeyRound } from 'react-icons/lu'; +import { LuCheck, LuCircleAlert, LuKeyRound, LuPencil } from 'react-icons/lu'; import { listConnections as listComposioConnections } from '../../../lib/composio/composioApi'; import type { ComposioConnection } from '../../../lib/composio/types'; @@ -582,6 +582,7 @@ const ProviderKeyDialog = ({ slug, label, isLocalRuntime, + initialValue, oauthAction, onCancel, onSubmit, @@ -590,6 +591,8 @@ const ProviderKeyDialog = ({ label: string; /** When true, render an "Endpoint URL" field instead of API key. */ isLocalRuntime: boolean; + /** Pre-populate the field when editing an existing provider's endpoint. */ + initialValue?: string; oauthAction?: { label: string; description?: string; onClick: () => Promise | void } | null; onCancel: () => void; /** Returns the entered value. For local runtimes this is the endpoint URL; @@ -597,7 +600,9 @@ const ProviderKeyDialog = ({ onSubmit: (value: string) => Promise | void; }) => { const { t } = useT(); - const [value, setValue] = useState(isLocalRuntime ? defaultEndpointFor(slug) : ''); + const [value, setValue] = useState( + initialValue ?? (isLocalRuntime ? defaultEndpointFor(slug) : '') + ); const [phase, setPhase] = useState<'idle' | 'saving' | 'oauth'>('idle'); const [error, setError] = useState(null); const busy = phase !== 'idle'; @@ -2884,6 +2889,19 @@ const AIPanel = ({ embedded = false }: AIPanelProps = {}) => { key={localKind} className={`inline-flex items-center gap-2 rounded-full px-2.5 py-1 text-xs font-medium ring-1 transition-colors ${tone}`}> {label} + {enabled && ( + + )}