ui: 改进消息显示,添加空行分隔和更友好的初始提示
- 初始消息改为 Ready 提示(header已包含工具/命令信息) - 用户消息前添加空行分隔,提升对话可读性 - 保持工具调用和系统消息紧凑展示 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -234,12 +234,21 @@ public class ClaudeCodeComponent extends Component<ClaudeCodeComponent.TuiState>
|
|||||||
private Renderable messagesArea(TuiState s, int maxLines) {
|
private Renderable messagesArea(TuiState s, int maxLines) {
|
||||||
List<Renderable> allItems = new ArrayList<>();
|
List<Renderable> allItems = new ArrayList<>();
|
||||||
|
|
||||||
// 初始系统消息
|
// 初始提示消息
|
||||||
allItems.add(msgLine(Color.BRIGHT_BLUE,
|
allItems.add(Text.of(
|
||||||
"Tools: " + toolCount + " | Commands: " + cmdCount + " | Work Dir: " + System.getProperty("user.dir")));
|
Text.of("● ").color(Color.BRIGHT_BLUE),
|
||||||
|
Text.of("Ready. Describe a task or type ").color(Color.WHITE),
|
||||||
|
Text.of("/help").color(Color.BRIGHT_CYAN).bold(),
|
||||||
|
Text.of(" for available commands.").color(Color.WHITE)
|
||||||
|
));
|
||||||
|
|
||||||
// 渲染所有消息
|
// 渲染所有消息(带空行分隔)
|
||||||
for (UIMessage msg : s.messages) {
|
for (int i = 0; i < s.messages.size(); i++) {
|
||||||
|
UIMessage msg = s.messages.get(i);
|
||||||
|
// 在用户消息前添加空行分隔(除了第一条)
|
||||||
|
if (msg instanceof UserMsg && i > 0) {
|
||||||
|
allItems.add(Text.of(" "));
|
||||||
|
}
|
||||||
allItems.addAll(renderMessage(msg));
|
allItems.addAll(renderMessage(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user