mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-05-21 23:24:44 +02:00
feat(dashboard): embedded FastAPI backend with REST API + WebSocket
- FastAPI runs in MeshAI asyncio loop (no separate process) - REST API: /api/status, /api/health, /api/nodes, /api/edges, /api/regions, /api/sources, /api/config, /api/alerts - WebSocket at /ws/live pushes health updates and alerts - Config CRUD: GET/PUT per section with validation and save - DashboardConfig with port/host in config.yaml
This commit is contained in:
parent
914c21e167
commit
3ec09ad158
17 changed files with 1140 additions and 103 deletions
|
|
@ -1,105 +1,105 @@
|
|||
# MeshAI Configuration
|
||||
# LLM-powered Meshtastic assistant
|
||||
#
|
||||
# Copy this to config.yaml and customize as needed
|
||||
# For Docker: mount as /data/config.yaml
|
||||
|
||||
# === BOT IDENTITY ===
|
||||
bot:
|
||||
name: ai # Bot's display name
|
||||
owner: "" # Owner's callsign (optional)
|
||||
respond_to_dms: true # Respond to direct messages
|
||||
filter_bbs_protocols: true # Ignore advBBS sync/notification messages
|
||||
|
||||
# === MESHTASTIC CONNECTION ===
|
||||
connection:
|
||||
type: tcp # serial | tcp
|
||||
serial_port: /dev/ttyUSB0 # For serial connection
|
||||
tcp_host: localhost # For TCP connection (meshtasticd)
|
||||
tcp_port: 4403
|
||||
|
||||
# === RESPONSE BEHAVIOR ===
|
||||
response:
|
||||
delay_min: 2.2 # Min delay before responding (seconds)
|
||||
delay_max: 3.0 # Max delay before responding
|
||||
max_length: 200 # Max chars per message chunk
|
||||
max_messages: 3 # Max message chunks per response
|
||||
|
||||
# === CONVERSATION HISTORY ===
|
||||
history:
|
||||
database: /data/conversations.db
|
||||
max_messages_per_user: 50 # Messages to keep per user
|
||||
conversation_timeout: 86400 # Conversation expiry (seconds, 86400=24h)
|
||||
auto_cleanup: true # Auto-delete old conversations
|
||||
cleanup_interval_hours: 24 # How often to run cleanup
|
||||
max_age_days: 30 # Delete conversations older than this
|
||||
|
||||
# === MEMORY OPTIMIZATION ===
|
||||
memory:
|
||||
enabled: true # Enable rolling summary memory
|
||||
window_size: 4 # Recent message pairs to keep in full
|
||||
summarize_threshold: 8 # Messages before re-summarizing
|
||||
|
||||
# === MESH CONTEXT ===
|
||||
context:
|
||||
enabled: true # Observe channel traffic for LLM context
|
||||
observe_channels: [] # Channel indices to observe (empty = all)
|
||||
ignore_nodes: [] # Node IDs to exclude from observation
|
||||
max_age: 2592000 # Max age in seconds (default 30 days)
|
||||
max_context_items: 20 # Max observations injected into LLM context
|
||||
|
||||
# === LLM BACKEND ===
|
||||
llm:
|
||||
backend: openai # openai | anthropic | google
|
||||
api_key: "" # API key (or use LLM_API_KEY env var)
|
||||
base_url: https://api.openai.com/v1 # API base URL
|
||||
model: gpt-4o-mini # Model name
|
||||
timeout: 30 # Request timeout (seconds)
|
||||
system_prompt: >-
|
||||
You are a helpful assistant on a Meshtastic mesh network.
|
||||
Keep responses very brief - 1-2 short sentences, under 300 characters.
|
||||
Only give longer answers if the user explicitly asks for detail or explanation.
|
||||
Be concise but friendly. No markdown formatting.
|
||||
google_grounding: false # Enable Google Search grounding (Gemini only, $35/1k queries)
|
||||
|
||||
# === WEATHER ===
|
||||
weather:
|
||||
primary: openmeteo # openmeteo | wttr | llm
|
||||
fallback: llm # openmeteo | wttr | llm | none
|
||||
default_location: "" # Default location for !weather (optional)
|
||||
|
||||
# === MESHMONITOR INTEGRATION ===
|
||||
meshmonitor:
|
||||
enabled: false # Enable MeshMonitor trigger sync
|
||||
url: "" # MeshMonitor web UI URL (e.g. http://192.168.1.100:3333)
|
||||
inject_into_prompt: true # Include trigger list in LLM prompt
|
||||
refresh_interval: 300 # Seconds between trigger refreshes
|
||||
|
||||
# === KNOWLEDGE BASE (RAG) ===
|
||||
knowledge:
|
||||
enabled: false # Enable knowledge base search
|
||||
db_path: "" # Path to knowledge SQLite database
|
||||
top_k: 5 # Number of chunks to retrieve per query
|
||||
|
||||
# === MESH DATA SOURCES ===
|
||||
# Connect to Meshview and/or MeshMonitor instances for live mesh
|
||||
# network analysis. Supports multiple sources. Configure via TUI
|
||||
# with meshai --config (Mesh Sources menu).
|
||||
#
|
||||
# mesh_sources:
|
||||
# - name: "my-meshview"
|
||||
# type: meshview
|
||||
# url: "https://meshview.example.com"
|
||||
# refresh_interval: 300
|
||||
# enabled: true
|
||||
#
|
||||
# - name: "my-meshmonitor"
|
||||
# type: meshmonitor
|
||||
# url: "http://192.168.1.100:3333"
|
||||
# api_token: "${MM_API_TOKEN}"
|
||||
# refresh_interval: 300
|
||||
# enabled: true
|
||||
mesh_sources: []
|
||||
# MeshAI Configuration
|
||||
# LLM-powered Meshtastic assistant
|
||||
#
|
||||
# Copy this to config.yaml and customize as needed
|
||||
# For Docker: mount as /data/config.yaml
|
||||
|
||||
# === BOT IDENTITY ===
|
||||
bot:
|
||||
name: ai # Bot's display name
|
||||
owner: "" # Owner's callsign (optional)
|
||||
respond_to_dms: true # Respond to direct messages
|
||||
filter_bbs_protocols: true # Ignore advBBS sync/notification messages
|
||||
|
||||
# === MESHTASTIC CONNECTION ===
|
||||
connection:
|
||||
type: tcp # serial | tcp
|
||||
serial_port: /dev/ttyUSB0 # For serial connection
|
||||
tcp_host: localhost # For TCP connection (meshtasticd)
|
||||
tcp_port: 4403
|
||||
|
||||
# === RESPONSE BEHAVIOR ===
|
||||
response:
|
||||
delay_min: 2.2 # Min delay before responding (seconds)
|
||||
delay_max: 3.0 # Max delay before responding
|
||||
max_length: 200 # Max chars per message chunk
|
||||
max_messages: 3 # Max message chunks per response
|
||||
|
||||
# === CONVERSATION HISTORY ===
|
||||
history:
|
||||
database: /data/conversations.db
|
||||
max_messages_per_user: 50 # Messages to keep per user
|
||||
conversation_timeout: 86400 # Conversation expiry (seconds, 86400=24h)
|
||||
auto_cleanup: true # Auto-delete old conversations
|
||||
cleanup_interval_hours: 24 # How often to run cleanup
|
||||
max_age_days: 30 # Delete conversations older than this
|
||||
|
||||
# === MEMORY OPTIMIZATION ===
|
||||
memory:
|
||||
enabled: true # Enable rolling summary memory
|
||||
window_size: 4 # Recent message pairs to keep in full
|
||||
summarize_threshold: 8 # Messages before re-summarizing
|
||||
|
||||
# === MESH CONTEXT ===
|
||||
context:
|
||||
enabled: true # Observe channel traffic for LLM context
|
||||
observe_channels: [] # Channel indices to observe (empty = all)
|
||||
ignore_nodes: [] # Node IDs to exclude from observation
|
||||
max_age: 2592000 # Max age in seconds (default 30 days)
|
||||
max_context_items: 20 # Max observations injected into LLM context
|
||||
|
||||
# === LLM BACKEND ===
|
||||
llm:
|
||||
backend: openai # openai | anthropic | google
|
||||
api_key: "" # API key (or use LLM_API_KEY env var)
|
||||
base_url: https://api.openai.com/v1 # API base URL
|
||||
model: gpt-4o-mini # Model name
|
||||
timeout: 30 # Request timeout (seconds)
|
||||
system_prompt: >-
|
||||
You are a helpful assistant on a Meshtastic mesh network.
|
||||
Keep responses very brief - 1-2 short sentences, under 300 characters.
|
||||
Only give longer answers if the user explicitly asks for detail or explanation.
|
||||
Be concise but friendly. No markdown formatting.
|
||||
google_grounding: false # Enable Google Search grounding (Gemini only, $35/1k queries)
|
||||
|
||||
# === WEATHER ===
|
||||
weather:
|
||||
primary: openmeteo # openmeteo | wttr | llm
|
||||
fallback: llm # openmeteo | wttr | llm | none
|
||||
default_location: "" # Default location for !weather (optional)
|
||||
|
||||
# === MESHMONITOR INTEGRATION ===
|
||||
meshmonitor:
|
||||
enabled: false # Enable MeshMonitor trigger sync
|
||||
url: "" # MeshMonitor web UI URL (e.g. http://192.168.1.100:3333)
|
||||
inject_into_prompt: true # Include trigger list in LLM prompt
|
||||
refresh_interval: 300 # Seconds between trigger refreshes
|
||||
|
||||
# === KNOWLEDGE BASE (RAG) ===
|
||||
knowledge:
|
||||
enabled: false # Enable knowledge base search
|
||||
db_path: "" # Path to knowledge SQLite database
|
||||
top_k: 5 # Number of chunks to retrieve per query
|
||||
|
||||
# === MESH DATA SOURCES ===
|
||||
# Connect to Meshview and/or MeshMonitor instances for live mesh
|
||||
# network analysis. Supports multiple sources. Configure via TUI
|
||||
# with meshai --config (Mesh Sources menu).
|
||||
#
|
||||
# mesh_sources:
|
||||
# - name: "my-meshview"
|
||||
# type: meshview
|
||||
# url: "https://meshview.example.com"
|
||||
# refresh_interval: 300
|
||||
# enabled: true
|
||||
#
|
||||
# - name: "my-meshmonitor"
|
||||
# type: meshmonitor
|
||||
# url: "http://192.168.1.100:3333"
|
||||
# api_token: "${MM_API_TOKEN}"
|
||||
# refresh_interval: 300
|
||||
# enabled: true
|
||||
mesh_sources: []
|
||||
|
||||
# === MESH INTELLIGENCE ===
|
||||
# Geographic clustering and health scoring for mesh analysis.
|
||||
|
|
@ -123,3 +123,9 @@ mesh_intelligence:
|
|||
battery_warning_percent: 20
|
||||
infra_overrides: []
|
||||
region_labels: {}
|
||||
|
||||
# === WEB DASHBOARD ===
|
||||
dashboard:
|
||||
enabled: true
|
||||
port: 8080
|
||||
host: "0.0.0.0"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue