Skip to content

/history 命令硬编码截断消息到 200 字符,导致回复显示不完整。/history command hardcodes the truncated message to 200 characters, resulting in an incomplete response display #1208

Description

@Saillllllll

Feature Area

Core / Engine

Problem or Motivation

/history 命令回放的消息内容被硬编码截断到 200 个字符(rune),导致长回复显示不全。Agent 回复通常远超 200 字符,/history 只能看到前一小段
正常实时回复没有此限制,导致 /history 的回放质量远不如实时消息。在移动端接续桌面端工作时回溯历史消息非常不利,比如在桌面端发出了一个命令,想在移动端查看结果时,无法看到完整结果。The message content replayed by the /history command is hard-coded to be truncated to 200 characters (runes), which causes long replies to be displayed incompletely. Agent replies are often much longer than 200 characters, so /history only shows the first short segment. Normal real-time replies do not have this limitation, which makes /history playback quality much worse than live messages.

Proposed Solution

将 200 改为可配置项(如 [display] 中 history_max_len,0=不截断)或提高默认值到 2000,并设为可配置。Make 200 a configurable option, for example history_max_len under [display], where 0 means no truncation. Alternatively, increase the default value to 2000 and make it configurable.

Alternatives Considered

无。None。

Additional Context

源码位置

core/engine.go 中两处都存在此问题:

1. cmdHistory(文本模式,L7217-7220)

content := h.Content
if len([]rune(content)) > 200 {
    content = string([]rune(content)[:200]) + "..."
}

2. renderHistoryCard(卡片模式,L10758-10760)

content := h.Content
if len([]rune(content)) > 200 {
    content = string([]rune(content)[:200]) + "..."
}

Source Code Location

This issue exists in two places in core/engine.go:

1. cmdHistory(text mode,L7217-7220)

content := h.Content
if len([]rune(content)) > 200 {
    content = string([]rune(content)[:200]) + "..."
}

2. renderHistoryCard(card mode,L10758-10760)

content := h.Content
if len([]rune(content)) > 200 {
    content = string([]rune(content)[:200]) + "..."
}

Willingness to Contribute

  • I'd be willing to submit a PR for this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2P2: 一般需求 / 优化area-coreCore engine/session/routing relatedbugSomething isn't workingenhancementNew feature or requesttriaged已确认,正在评估

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions