fix: 优化压缩错误消息和自动压缩提示的可理解性

- "Not enough messages" 添加 "Send a few more messages first" 引导
- "Conversation too long" 提示从模糊的 "Press esc twice" 改为建议 /compact 或 /clear
- 自动压缩标题从 "Compact summary" 改为 "Conversation summarized to free up context"
- 快捷键提示从 "expand" 改为 "view summary"
- 新增 7 个测试覆盖压缩相关消息

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-05-05 07:19:19 +08:00
parent 88057b10d4
commit 6ff839d625
4 changed files with 73 additions and 4 deletions

View File

@@ -227,7 +227,7 @@ export function stripReinjectedAttachments(messages: Message[]): Message[] {
}
export const ERROR_MESSAGE_NOT_ENOUGH_MESSAGES =
'Not enough messages to compact.'
'Not enough messages to compact. Send a few more messages first, then try again.'
const MAX_PTL_RETRIES = 3
const PTL_RETRY_MARKER = '[earlier conversation truncated for compaction retry]'
@@ -297,7 +297,7 @@ export function truncateHeadForPTLRetry(
}
export const ERROR_MESSAGE_PROMPT_TOO_LONG =
'Conversation too long. Press esc twice to go up a few messages and try again.'
'Conversation too long to summarize. Try /compact to manually clear conversation history, or start a new session with /clear.'
export const ERROR_MESSAGE_USER_ABORT = 'API Error: Request was aborted.'
export const ERROR_MESSAGE_INCOMPLETE_RESPONSE =
'Compaction interrupted · This may be due to network issues — please try again.'