483eb0b2fb
- mcp/mcp_pc.py: MCP-Server der PC-Tools an den Executor proxied (pc_shell, pc_screenshot, pc_type, pc_key, pc_open, pc_status) - client/hermes-pc/executor.py: FastAPI auf Port 7777 (Daemon-Reg entfernt) - client/hermes-pc/start.bat, install.bat, requirements.txt - client/hermes-voice/agent_client.py, main.py: agent_client integration Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
"""Spricht mit dem Hermes Agent Daemon auf der AI Box."""
|
|
import httpx
|
|
|
|
TIMEOUT = 120
|
|
|
|
|
|
def ask_agent(text: str, screenshot_b64: str | None, settings: dict) -> tuple[str, list]:
|
|
"""Schickt Nachricht an den Daemon, gibt (response, tool_calls) zurück."""
|
|
daemon_url = settings.get("agent_daemon_url", "http://192.168.178.151:8765")
|
|
try:
|
|
with httpx.Client(timeout=TIMEOUT) as c:
|
|
resp = c.post(f"{daemon_url}/chat", json={
|
|
"message": text,
|
|
"screenshot": screenshot_b64,
|
|
})
|
|
resp.raise_for_status()
|
|
data = resp.json()
|
|
return data.get("response", ""), data.get("tool_calls", [])
|
|
except httpx.TimeoutException:
|
|
return "Antwort hat zu lange gedauert.", []
|
|
except Exception as e:
|
|
return f"Agent nicht erreichbar: {e}", []
|
|
|
|
|
|
def get_agent_status(settings: dict) -> dict:
|
|
daemon_url = settings.get("agent_daemon_url", "http://192.168.178.151:8765")
|
|
try:
|
|
with httpx.Client(timeout=5) as c:
|
|
return c.get(f"{daemon_url}/status").json()
|
|
except Exception:
|
|
return {"alive": False}
|