mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-06-11 09:24:44 +02:00
Fix bugs: MeshMessage position field, summary loading, Google system prompt, import placement, cleanup timer
- 1a: Declare _position as proper dataclass field with field(default=None, init=False) so hasattr() check isn't needed and the attribute always exists - 1b: Load persisted conversation summaries from DB into memory cache on startup via new _load_summaries() method called after backend creation - 1c: Use Gemini's system_instruction parameter on GenerativeModel instead of only prepending to first message, so system prompt persists across all turns - 1d: Move 'import os' from line 198 to top of main.py with other imports - 1e: Replace unreliable modulo-based cleanup timer with _last_cleanup timestamp comparison that won't miss hours due to async sleep jitter Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bc3e85a6fb
commit
c1f2c48494
3 changed files with 53 additions and 13 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import asyncio
|
||||
import logging
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Callable, Optional
|
||||
|
||||
import meshtastic
|
||||
|
|
@ -26,13 +26,12 @@ class MeshMessage:
|
|||
channel: int # Channel index
|
||||
is_dm: bool # True if direct message to us
|
||||
packet: dict # Raw packet for additional data
|
||||
_position: Optional[tuple[float, float]] = field(default=None, repr=False, init=False)
|
||||
|
||||
@property
|
||||
def sender_position(self) -> Optional[tuple[float, float]]:
|
||||
"""Get sender's GPS position if available (lat, lon)."""
|
||||
# Position comes from node info, not the message itself
|
||||
# This will be populated by the connector if available
|
||||
return self._position if hasattr(self, "_position") else None
|
||||
return self._position
|
||||
|
||||
|
||||
class MeshConnector:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue