Windows cmd/PowerShell默认codepage下emoji显示为?号。 全局替换: 👋->移除, 💭->[Thinking], ⚙->*, ✓->[OK], ✗->[FAIL], ◆->>, ⚠->[!], ✅->[OK], •->|/-, →->>>, ✏️->[Edit]等。 ❯保留(windows-vtp终端下正常显示)。 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
30 lines
702 B
Java
30 lines
702 B
Java
package com.claudecode.command.impl;
|
|
|
|
import com.claudecode.command.CommandContext;
|
|
import com.claudecode.command.SlashCommand;
|
|
import com.claudecode.console.AnsiStyle;
|
|
|
|
/**
|
|
* /clear 命令 —— 清除对话历史。
|
|
*/
|
|
public class ClearCommand implements SlashCommand {
|
|
|
|
@Override
|
|
public String name() {
|
|
return "clear";
|
|
}
|
|
|
|
@Override
|
|
public String description() {
|
|
return "Clear conversation history";
|
|
}
|
|
|
|
@Override
|
|
public String execute(String args, CommandContext context) {
|
|
if (context.agentLoop() != null) {
|
|
context.agentLoop().reset();
|
|
}
|
|
return AnsiStyle.green(" [OK] Conversation history cleared.");
|
|
}
|
|
}
|