debug(rag): /rag/debug 顯示完整 Ollama 錯誤訊息
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-10 10:13:52 +08:00
parent 07570c3b85
commit b51f1b011c

View File

@@ -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}