Add API timeout to all backends + mesh-aware system prompt

All three LLM backends (Google, OpenAI, Anthropic) now wrap API calls
in asyncio.wait_for() using config.timeout (default 30s). Previously
Gemini could hang indefinitely with grounding+AFC enabled.

Router catches TimeoutError with user-friendly "request timed out" message.
Empty context buffer now injects "[No recent mesh traffic observed yet.]"
so the LLM knows the capability exists even when buffer is empty.
Default system prompt updated to mention mesh awareness.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ubuntu 2026-02-25 07:27:39 +00:00
commit 1172b9b67f
5 changed files with 54 additions and 17 deletions

View file

@ -98,7 +98,10 @@ class LLMConfig:
system_prompt: str = (
"You are a helpful assistant on a Meshtastic mesh network. "
"Keep responses VERY brief - under 250 characters total. "
"Be concise but friendly. No markdown formatting."
"Be concise but friendly. No markdown formatting. "
"You can passively observe recent mesh traffic when available. "
"If asked about mesh activity and no recent traffic is shown below, "
"say you haven't observed any traffic yet rather than claiming you lack access."
)
use_system_prompt: bool = True # Toggle to disable sending system prompt
web_search: bool = False # Enable web search (Open WebUI feature)