fix: Override LLM brevity for mesh questions — give detailed data responses

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
K7ZVX 2026-05-05 05:29:09 +00:00
commit 45630f2cc6
2 changed files with 359 additions and 353 deletions

View file

@ -108,7 +108,8 @@ class LLMConfig:
"passive mesh context buffer (observes channel traffic), smart chunking for LoRa " "passive mesh context buffer (observes channel traffic), smart chunking for LoRa "
"message limits, prompt injection defense, advBBS filtering.\n\n" "message limits, prompt injection defense, advBBS filtering.\n\n"
"RESPONSE RULES:\n" "RESPONSE RULES:\n"
"- Keep responses very brief — 1-2 short sentences, under 300 characters. Only give longer answers if the user explicitly asks for detail or explanation.\n" "- For casual conversation, keep responses brief (1-2 sentences).\n"
"- For mesh health questions, give detailed data-driven responses.\n"
"- Be concise but friendly. No markdown formatting.\n" "- Be concise but friendly. No markdown formatting.\n"
"- If asked about mesh activity and no recent traffic is shown, say you haven't " "- If asked about mesh activity and no recent traffic is shown, say you haven't "
"observed any yet.\n" "observed any yet.\n"

View file

@ -125,14 +125,19 @@ _CITY_TO_REGION = {
# Mesh awareness instruction for LLM # Mesh awareness instruction for LLM
_MESH_AWARENESS_PROMPT = """ _MESH_AWARENESS_PROMPT = """
When the user asks about mesh health, network status, or optimization: MESH DATA RESPONSE RULES (these OVERRIDE the brevity rules above for mesh questions):
- Use the LIVE MESH HEALTH DATA injected above to answer with real numbers - When answering about mesh health, nodes, coverage, or network status: give DETAILED responses
- Be specific: name nodes, cite utilization percentages, reference actual scores - Include actual numbers: scores, percentages, node names, packet counts, battery levels
- Give actionable recommendations based on the data - Use the data injected above don't summarize it to one sentence
- If asked about a region or node you have detail for, use that detail - Structure your response with the key data points the user asked about
- If asked about something the data doesn't cover, say so - don't fabricate - For node questions: include hardware, region, battery, channel utilization, coverage, neighbors, packets
- Keep responses concise - these go over LoRa with limited message size - For region questions: include score, infrastructure status, coverage breakdown, flagged nodes, environment
- Users can run !health for a quick mesh summary or !region [name] for regional info - For mesh questions: include overall score by pillar, regional breakdown, top issues, coverage gaps
- For coverage questions: break down by region showing node counts, avg gateways, single-gateway nodes
- For "where do we need infrastructure": name specific regions with poor coverage, how many nodes are affected
- You CAN use 3-5 messages if needed LoRa chunking handles splitting
- Be specific and data-driven, not vague summaries
- Still no markdown formatting plain text only
""" """