diff --git a/src/components/tunaflow/MetaAgentSelector.tsx b/src/components/tunaflow/MetaAgentSelector.tsx index 607222f..8591297 100644 --- a/src/components/tunaflow/MetaAgentSelector.tsx +++ b/src/components/tunaflow/MetaAgentSelector.tsx @@ -1,6 +1,6 @@ -import { useEffect, useMemo, useRef, useState } from "react"; +import { useEffect, useMemo, useState } from "react"; import { invoke } from "@tauri-apps/api/core"; -import { CheckCircle2, Loader2, AlertTriangle, ChevronDown, ExternalLink } from "lucide-react"; +import { CheckCircle2, Loader2, AlertTriangle, ChevronDown, ExternalLink, RefreshCw } from "lucide-react"; import { useTranslation } from "react-i18next"; import { cn } from "@/lib/utils"; import { useChatStore } from "@/stores/chatStore"; @@ -65,7 +65,6 @@ export function MetaAgentSelector({ onProceed, onSkip, projectName }: Props) { const [modelByEngine, setModelByEngine] = useState>({}); const [skipConfirm, setSkipConfirm] = useState(false); - const debounceRef = useRef(null); // Dynamic model discovery — shared with Settings AgentsSection. // `engineModels` is populated by `list_engine_models` (Rust) and refreshed @@ -132,16 +131,12 @@ export function MetaAgentSelector({ onProceed, onSkip, projectName }: Props) { }); }, [detections, engineModels]); + // 외부 사용자 보고 (e.g. LM Studio endpoint 에 `192.168.1.1` 입력 중 `.` 칠 + // 때마다 자동 detect 가 발동) — onChange 는 local state 만 갱신하고, 실제 + // detect 는 Enter 키 또는 옆 새로고침 버튼 같은 명시 액션으로만 트리거한다. const onEndpointChange = (engine: "ollama" | "lmstudio", value: string) => { if (engine === "ollama") setOllamaEndpoint(value); else setLmstudioEndpoint(value); - - if (debounceRef.current) window.clearTimeout(debounceRef.current); - debounceRef.current = window.setTimeout(() => { - const o = engine === "ollama" ? value : ollamaEndpoint; - const l = engine === "lmstudio" ? value : lmstudioEndpoint; - runDetect(o, l); - }, 600); }; const canProceed = useMemo(() => { @@ -247,7 +242,8 @@ export function MetaAgentSelector({ onProceed, onSkip, projectName }: Props) {
{d.path}
)} - {/* HTTP endpoint editor */} + {/* HTTP endpoint editor — Enter 키 또는 새로고침 버튼으로만 + detect 트리거. onChange 는 local state 갱신만 한다. */} {d.kind === "http" && (
Endpoint @@ -255,8 +251,25 @@ export function MetaAgentSelector({ onProceed, onSkip, projectName }: Props) { type="text" value={d.engine === "ollama" ? ollamaEndpoint : lmstudioEndpoint} onChange={(e) => onEndpointChange(d.engine as "ollama" | "lmstudio", e.target.value)} + onKeyDown={(e) => { + if (e.key === "Enter") { + e.preventDefault(); + runDetect(ollamaEndpoint, lmstudioEndpoint); + } + }} className="flex-1 text-[10px] font-mono bg-background border border-border/60 rounded px-2 py-1 focus:outline-none focus:border-primary/60" + data-testid={`meta-agent-endpoint-${d.engine}`} /> +
)} diff --git a/src/locales/en/dialog.json b/src/locales/en/dialog.json index bbe2818..7c01ef3 100644 --- a/src/locales/en/dialog.json +++ b/src/locales/en/dialog.json @@ -100,7 +100,8 @@ "ollama_install_hint": "Install from https://ollama.com/download then run `ollama serve`", "lmstudio_install_hint": "Install from https://lmstudio.ai then start the Local Server", "model_loading": "Loading models...", - "model_empty": "No models — install or refresh via Settings → Runtime" + "model_empty": "No models — install or refresh via Settings → Runtime", + "endpoint_refresh": "Re-detect endpoint (Enter or click)" }, "meta_chat": { "new_notification_title": "New notification", diff --git a/src/locales/ko/dialog.json b/src/locales/ko/dialog.json index a24b84a..710ab54 100644 --- a/src/locales/ko/dialog.json +++ b/src/locales/ko/dialog.json @@ -100,7 +100,8 @@ "ollama_install_hint": "https://ollama.com/download 에서 설치 후 `ollama serve`", "lmstudio_install_hint": "https://lmstudio.ai 에서 설치 후 Local Server 시작", "model_loading": "모델 목록 로딩 중...", - "model_empty": "모델 없음 — 설치 또는 Settings → Runtime 에서 새로고침" + "model_empty": "모델 없음 — 설치 또는 Settings → Runtime 에서 새로고침", + "endpoint_refresh": "엔드포인트 다시 감지 (Enter 또는 클릭)" }, "meta_chat": { "new_notification_title": "새 알림",