mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-06-11 01:14:45 +02:00
feat: Dynamic identity system prompt from bot config
- Build system prompt dynamically using bot.name and bot.owner from config - Reorder prompt: identity -> static prompt -> MeshMonitor (conditional) -> mesh context - MeshMonitor description only injected when meshmonitor.enabled is true - Update default system_prompt to static parts only (commands, architecture, rules) - Fix meshmonitor.py to handle trigger arrays (not just strings) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
494f4510ac
commit
5f66b69c9c
5 changed files with 296 additions and 298 deletions
|
|
@ -73,6 +73,10 @@ class MeshAI:
|
|||
while self._running:
|
||||
await asyncio.sleep(1)
|
||||
|
||||
# Periodic MeshMonitor refresh
|
||||
if self.meshmonitor_sync:
|
||||
self.meshmonitor_sync.maybe_refresh()
|
||||
|
||||
# Periodic cleanup
|
||||
if time.time() - self._last_cleanup >= 3600:
|
||||
await self.history.cleanup_expired()
|
||||
|
|
@ -80,10 +84,6 @@ class MeshAI:
|
|||
self.context.prune()
|
||||
self._last_cleanup = time.time()
|
||||
|
||||
# Refresh MeshMonitor triggers if file changed
|
||||
if self.meshmonitor_sync:
|
||||
self.meshmonitor_sync.maybe_refresh()
|
||||
|
||||
async def stop(self) -> None:
|
||||
"""Stop the bot."""
|
||||
logger.info("Stopping MeshAI...")
|
||||
|
|
@ -163,14 +163,17 @@ class MeshAI:
|
|||
self.context = None
|
||||
|
||||
# MeshMonitor trigger sync
|
||||
self.meshmonitor_sync = None
|
||||
mm_cfg = self.config.meshmonitor
|
||||
if mm_cfg.enabled and mm_cfg.triggers_file:
|
||||
if mm_cfg.enabled and mm_cfg.url:
|
||||
from .meshmonitor import MeshMonitorSync
|
||||
self.meshmonitor_sync = MeshMonitorSync(
|
||||
triggers_file=mm_cfg.triggers_file,
|
||||
url=mm_cfg.url,
|
||||
refresh_interval=mm_cfg.refresh_interval,
|
||||
)
|
||||
self.meshmonitor_sync.load()
|
||||
count = self.meshmonitor_sync.load()
|
||||
logger.info(f"MeshMonitor sync enabled, loaded {count} triggers")
|
||||
else:
|
||||
self.meshmonitor_sync = None
|
||||
|
||||
# Message router
|
||||
self.router = MessageRouter(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue