From 992c058cab999e62dd714c644ba7d7038a8bf5d4 Mon Sep 17 00:00:00 2001 From: egregore Date: Mon, 2 Feb 2026 12:19:45 +0000 Subject: [PATCH] =?UTF-8?q?Rename=20service=20references:=20brain=E2=86=92?= =?UTF-8?q?reason,=20db=E2=86=92recall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update internal service URLs and variable names to match the renamed services throughout the codebase. Co-Authored-By: Claude Opus 4.5 --- main.py | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/main.py b/main.py index ae4b26b..4b5e44a 100644 --- a/main.py +++ b/main.py @@ -2,7 +2,7 @@ """ Egregore Web Service - HTTP frontend -Serves the chat UI and proxies requests to brain and db services. +Serves the chat UI and proxies requests to reason and recall services. Runs on port 8080. """ @@ -29,8 +29,8 @@ CHAT_USERNAME = os.getenv("CHAT_USERNAME", "admin") CHAT_PASSWORD = os.getenv("CHAT_PASSWORD", "changeme") # Service URLs -BRAIN_URL = os.getenv("BRAIN_URL", "http://127.0.0.1:8081") -DB_URL = os.getenv("DB_URL", "http://127.0.0.1:8082") +REASON_URL = os.getenv("REASON_URL", "http://127.0.0.1:8081") +RECALL_URL = os.getenv("RECALL_URL", "http://127.0.0.1:8082") app = FastAPI(title="Egregore", docs_url=None, redoc_url=None) security = HTTPBasic() @@ -75,7 +75,7 @@ async def chat(msg: ChatMessage, username: str = Depends(verify_credentials)): group_id = str(uuid.uuid4()) # Save user message to db service - await http_client.post(f"{DB_URL}/messages", json={ + await http_client.post(f"{RECALL_URL}/messages", json={ "role": "user", "content": msg.message, "msg_type": "text", @@ -83,30 +83,30 @@ async def chat(msg: ChatMessage, username: str = Depends(verify_credentials)): }) # Get conversation history from db service - history_resp = await http_client.get(f"{DB_URL}/messages/history") + history_resp = await http_client.get(f"{RECALL_URL}/messages/history") history_data = history_resp.json() history = history_data.get("history", []) # Process conversation with brain service try: - brain_resp = await http_client.post(f"{BRAIN_URL}/process", json={ + reason_resp = await http_client.post(f"{REASON_URL}/process", json={ "model": msg.model, "history": history, "max_iterations": 10 }) - if brain_resp.status_code != 200: - error_detail = brain_resp.json().get("detail", "Brain service error") + if reason_resp.status_code != 200: + error_detail = reason_resp.json().get("detail", "Reason service error") raise HTTPException(status_code=500, detail=error_detail) - brain_data = brain_resp.json() - response_blocks = brain_data.get("blocks", []) + reason_data = reason_resp.json() + response_blocks = reason_data.get("blocks", []) except httpx.RequestError as e: - raise HTTPException(status_code=503, detail=f"Brain service unavailable: {e}") + raise HTTPException(status_code=503, detail=f"Reason service unavailable: {e}") # Save response blocks to db service - save_resp = await http_client.post(f"{DB_URL}/messages/blocks", json={ + save_resp = await http_client.post(f"{RECALL_URL}/messages/blocks", json={ "blocks": response_blocks, "group_id": group_id }) @@ -144,7 +144,7 @@ async def history( if msg_type: params["type"] = msg_type - resp = await http_client.get(f"{DB_URL}/messages", params=params) + resp = await http_client.get(f"{RECALL_URL}/messages", params=params) return resp.json() @@ -193,34 +193,34 @@ async def search( if msg_type: params["type"] = msg_type - resp = await http_client.get(f"{DB_URL}/messages/search", params=params) + resp = await http_client.get(f"{RECALL_URL}/messages/search", params=params) return resp.json() @app.get("/health") async def health(): """Health check with dependency status""" - brain_ok = False - db_ok = False + reason_ok = False + recall_ok = False try: - resp = await http_client.get(f"{BRAIN_URL}/health", timeout=2.0) - brain_ok = resp.status_code == 200 + resp = await http_client.get(f"{REASON_URL}/health", timeout=2.0) + reason_ok = resp.status_code == 200 except: pass try: - resp = await http_client.get(f"{DB_URL}/health", timeout=2.0) - db_ok = resp.status_code == 200 + resp = await http_client.get(f"{RECALL_URL}/health", timeout=2.0) + recall_ok = resp.status_code == 200 except: pass return { - "status": "ok" if (brain_ok and db_ok) else "degraded", + "status": "ok" if (reason_ok and recall_ok) else "degraded", "service": "web", "dependencies": { - "brain": "ok" if brain_ok else "unavailable", - "db": "ok" if db_ok else "unavailable" + "reason": "ok" if reason_ok else "unavailable", + "recall": "ok" if recall_ok else "unavailable" } }