From b51f1b011c16cdc8d87fdf036a1a9744f3434c69 Mon Sep 17 00:00:00 2001 From: OG T Date: Fri, 10 Apr 2026 10:13:52 +0800 Subject: [PATCH] =?UTF-8?q?debug(rag):=20/rag/debug=20=E9=A1=AF=E7=A4=BA?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=20Ollama=20=E9=8C=AF=E8=AA=A4=E8=A8=8A?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- apps/api/src/api/v1/rag.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/api/src/api/v1/rag.py b/apps/api/src/api/v1/rag.py index a7d2968a..8fb20982 100644 --- a/apps/api/src/api/v1/rag.py +++ b/apps/api/src/api/v1/rag.py @@ -72,16 +72,16 @@ async def rag_debug() -> dict: "files": [f.name for f in d.glob("*.md")][:3] if d.exists() else [], } - ollama_ok = False + ollama_ok: bool | str = False try: - async with httpx.AsyncClient(timeout=5.0) as c: + async with httpx.AsyncClient(timeout=10.0) as c: r = await c.post( "http://192.168.0.188:11434/api/embeddings", json={"model": "nomic-embed-text", "prompt": "test"}, ) - ollama_ok = r.status_code == 200 + ollama_ok = r.status_code == 200 if r.status_code == 200 else f"http_{r.status_code}" except Exception as e: - ollama_ok = str(e) + ollama_ok = f"error: {type(e).__name__}: {e}" return {"cwd": os.getcwd(), "paths": paths_check, "ollama_188_embed": ollama_ok}