Skip to content

vchat history: CLI 缺少 --start-time / --end-time 参数,大群拉不到最新消息 #1

Description

@aviky-2

现象

群聊消息超过 10000 条时,vchat history --asc -n 5000 只返回最旧的 5000 条,最新消息被截断。

$ vchat history "某群" -n 5000 --asc
# 返回最旧 5000 条,最新数据在 offset 5000+ 之外

根因

  1. --asc(oldest first)+ SQL LIMIT N = 取最旧 N 条。这在逻辑上没问题,但用户拉 --asc 通常是想看「某天的对话按时间顺序排列」
  2. CLI 的 cmd_history 没有暴露 start_time / end_time 参数,而底层 get_chat_history() 已经支持:
# messages.py L127-L130
def get_chat_history(chat_name, limit=50, offset=0,
                    start_time="", end_time="",
                    oldest_first=False):

建议修复

vchat history 子命令加 --start-time--end-time 参数(格式 YYYY-MM-DDYYYY-MM-DD HH:MM),透传给 get_chat_history()

vchat history "某群" -n 5000 --asc --start-time "2026-05-18"

临时 workaround

不加 --asc,取最新 N 条后 grep:

vchat history "某群" -n 3000 | grep "^\[2026-05-18" | tail -r

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions