fix: 补全 vendor 快照(model_tools/utils/toolsets/gateway/cron/hermes_time)+ python-dotenv 依赖
- vendor_hermes.sh: 补全遗漏的单文件模块和目录 - pyproject.toml: 添加 python-dotenv 隐性依赖 - 全量 import 测试通过(216 .py, 180K 行) - firecrawl/fal_client 为可选工具,缺失时优雅跳过
This commit is contained in:
@@ -6804,17 +6804,17 @@ class AIAgent:
|
||||
# 这样前端的 chatId 始终有效,history API 能找到压缩后的消息。
|
||||
old_title = self._session_db.get_session_title(self.session_id)
|
||||
|
||||
# 清除该 session 的所有旧消息(压缩摘要已在内存 messages[] 中)
|
||||
# 归档旧消息(保留完整历史,但 LLM 不再看到它们)
|
||||
try:
|
||||
self._session_db._conn.execute(
|
||||
"DELETE FROM messages WHERE session_id = ?",
|
||||
(self.session_id,),
|
||||
archived_count = self._session_db.archive_messages(self.session_id)
|
||||
logger.info(
|
||||
"[compress] Archived %d messages for session %s",
|
||||
archived_count, self.session_id,
|
||||
)
|
||||
self._session_db._conn.commit()
|
||||
except Exception:
|
||||
pass # non-fatal: worst case 有重复旧消息
|
||||
except Exception as e:
|
||||
logger.warning("Message archival failed (non-fatal): %s", e)
|
||||
|
||||
# 重置 flush cursor — 压缩后的消息从头写入
|
||||
# 重置 flush cursor — 压缩后的消息从头写入(archived 消息不会被重复读取)
|
||||
self._last_flushed_db_idx = 0
|
||||
|
||||
# 更新日志文件路径(仅 JSON 日志,不影响 DB)
|
||||
|
||||
Reference in New Issue
Block a user