Revert "fix: 将所有emoji/Unicode特殊字符替换为ASCII安全字符"

This reverts commit 3cd67ffe451be2cc7a66b5c554966f1d5aa58c7c.
pull/1/head
liuzh 1 month ago
parent eeceaaaea9
commit cc0d3f8b00
  1. 2
      src/main/java/com/claudecode/command/impl/ClearCommand.java
  2. 4
      src/main/java/com/claudecode/command/impl/CompactCommand.java
  3. 2
      src/main/java/com/claudecode/command/impl/ModelCommand.java
  4. 6
      src/main/java/com/claudecode/console/BannerPrinter.java
  5. 2
      src/main/java/com/claudecode/console/MarkdownRenderer.java
  6. 4
      src/main/java/com/claudecode/console/ThinkingRenderer.java
  7. 6
      src/main/java/com/claudecode/console/ToolStatusRenderer.java
  8. 2
      src/main/java/com/claudecode/repl/ClaudeCodeCompleter.java
  9. 10
      src/main/java/com/claudecode/repl/ReplSession.java
  10. 2
      src/main/java/com/claudecode/tool/impl/BashTool.java
  11. 4
      src/main/java/com/claudecode/tool/impl/FileEditTool.java
  12. 2
      src/main/java/com/claudecode/tool/impl/FileReadTool.java
  13. 6
      src/main/java/com/claudecode/tool/impl/FileWriteTool.java
  14. 2
      src/main/java/com/claudecode/tool/impl/GlobTool.java
  15. 2
      src/main/java/com/claudecode/tool/impl/GrepTool.java

@ -24,6 +24,6 @@ public class ClearCommand implements SlashCommand {
if (context.agentLoop() != null) {
context.agentLoop().reset();
}
return AnsiStyle.green(" [OK] Conversation history cleared.");
return AnsiStyle.green(" Conversation history cleared.");
}
}

@ -27,8 +27,8 @@ public class CompactCommand implements SlashCommand {
if (context.agentLoop() != null) {
int before = context.agentLoop().getMessageHistory().size();
context.agentLoop().reset();
return AnsiStyle.green(" [OK] Context compacted: " + before + " messages -> 1 (system prompt only)");
return AnsiStyle.green(" Context compacted: " + before + " messages 1 (system prompt only)");
}
return AnsiStyle.yellow(" [!] No active conversation to compact.");
return AnsiStyle.yellow(" No active conversation to compact.");
}
}

@ -38,7 +38,7 @@ public class ModelCommand implements SlashCommand {
if (args != null && !args.isBlank()) {
sb.append("\n");
sb.append(AnsiStyle.yellow(" [!] Model switching not yet implemented. Set AI_MODEL env variable."));
sb.append(AnsiStyle.yellow(" Model switching not yet implemented. Set AI_MODEL env variable."));
}
return sb.toString();

@ -34,7 +34,7 @@ public class BannerPrinter {
out.println(banner);
out.println(AnsiStyle.bold(" Claude Code (Java)") + AnsiStyle.dim(" v" + VERSION));
out.println(AnsiStyle.dim(" Powered by Spring AI | Type /help for commands"));
out.println(AnsiStyle.dim(" Powered by Spring AI Type /help for commands"));
out.println();
}
@ -43,9 +43,9 @@ public class BannerPrinter {
*/
public static void printCompact(PrintStream out) {
out.println();
out.println(AnsiStyle.BRIGHT_CYAN + AnsiStyle.BOLD + " > Claude Code (Java)" + AnsiStyle.RESET
out.println(AnsiStyle.BRIGHT_CYAN + AnsiStyle.BOLD + " Claude Code (Java)" + AnsiStyle.RESET
+ AnsiStyle.dim(" v" + VERSION));
out.println(AnsiStyle.dim(" Type /help for commands | Ctrl+D to exit"));
out.println(AnsiStyle.dim(" Type /help for commands Ctrl+D to exit"));
out.println();
}
}

@ -53,7 +53,7 @@ public class MarkdownRenderer {
}
// 列表项
else if (line.stripLeading().startsWith("- ") || line.stripLeading().startsWith("* ")) {
out.println(" " + AnsiStyle.CYAN + "-" + AnsiStyle.RESET + " " + renderInline(line.stripLeading().substring(2)));
out.println(" " + AnsiStyle.CYAN + "" + AnsiStyle.RESET + " " + renderInline(line.stripLeading().substring(2)));
}
// 分隔线
else if (line.strip().matches("^-{3,}$") || line.strip().matches("^\\*{3,}$")) {

@ -22,7 +22,7 @@ public class ThinkingRenderer {
}
out.println();
out.println(AnsiStyle.DIM + AnsiStyle.ITALIC + " [Thinking...]" + AnsiStyle.RESET);
out.println(AnsiStyle.DIM + AnsiStyle.ITALIC + " 💭 Thinking..." + AnsiStyle.RESET);
// 显示 thinking 内容(缩进并用暗色)
for (String line : thinkingContent.lines().toList()) {
@ -33,7 +33,7 @@ public class ThinkingRenderer {
/** 渲染 thinking 开始标记 */
public void renderStart() {
out.print(AnsiStyle.DIM + AnsiStyle.ITALIC + " [Thinking...]" + AnsiStyle.RESET);
out.print(AnsiStyle.DIM + AnsiStyle.ITALIC + " 💭 Thinking..." + AnsiStyle.RESET);
}
/** 渲染 thinking 结束标记 */

@ -18,7 +18,7 @@ public class ToolStatusRenderer {
/** 渲染工具调用开始 */
public void renderStart(String toolName, String args) {
out.println(AnsiStyle.dim(" ─────────────────────────────────────────"));
out.print(AnsiStyle.YELLOW + " * " + AnsiStyle.BOLD + toolName + AnsiStyle.RESET);
out.print(AnsiStyle.YELLOW + " " + AnsiStyle.BOLD + toolName + AnsiStyle.RESET);
out.println(AnsiStyle.dim(" running..."));
// 如果有简短参数,显示
if (args != null && !args.isBlank()) {
@ -37,7 +37,7 @@ public class ToolStatusRenderer {
display = display.substring(0, 497) + "...";
}
out.println(AnsiStyle.GREEN + " [OK] " + AnsiStyle.BOLD + toolName + AnsiStyle.RESET
out.println(AnsiStyle.GREEN + " " + AnsiStyle.BOLD + toolName + AnsiStyle.RESET
+ AnsiStyle.dim(" done"));
if (display != null && !display.isBlank()) {
// 缩进输出每一行
@ -50,7 +50,7 @@ public class ToolStatusRenderer {
/** 渲染工具错误 */
public void renderError(String toolName, String error) {
out.println(AnsiStyle.RED + " [FAIL] " + AnsiStyle.BOLD + toolName + AnsiStyle.RESET
out.println(AnsiStyle.RED + " " + AnsiStyle.BOLD + toolName + AnsiStyle.RESET
+ AnsiStyle.red(" error"));
if (error != null) {
out.println(AnsiStyle.red(" " + error));

@ -61,7 +61,7 @@ public class ClaudeCodeCompleter implements Completer {
if (alias.startsWith(prefix)) {
candidates.add(new Candidate(
"/" + alias,
alias + " -> " + name,
alias + " " + name,
"Aliases",
cmd.description(),
null, null, true

@ -154,7 +154,7 @@ public class ReplSession {
handleInput(input, cmdContext);
}
out.println(AnsiStyle.dim("\n Goodbye!\n"));
out.println(AnsiStyle.dim("\n Goodbye! 👋\n"));
}
}
@ -174,8 +174,8 @@ public class ReplSession {
out.println(AnsiStyle.dim(" Terminal: " + termInfo));
if (isDumb) {
out.println(AnsiStyle.yellow(" [!] Dumb terminal: Tab completion and line editing may be limited"));
out.println(AnsiStyle.yellow(" Run in Windows Terminal / PowerShell / cmd.exe for best experience"));
out.println(AnsiStyle.yellow(" ⚠ Dumb 终端模式:Tab补全和行编辑可能受限"));
out.println(AnsiStyle.yellow(" 建议在 Windows Terminal / PowerShell / cmd.exe 中运行"));
} else {
out.println(AnsiStyle.dim(" Tip: Tab to complete commands, ↑↓ to browse history, Ctrl+D to exit"));
}
@ -211,7 +211,7 @@ public class ReplSession {
handleInput(input, cmdContext);
}
out.println(AnsiStyle.dim("\n Goodbye!\n"));
out.println(AnsiStyle.dim("\n Goodbye! 👋\n"));
}
// ==================== 公共输入处理 ====================
@ -237,7 +237,7 @@ public class ReplSession {
out.println();
} catch (Exception e) {
spinner.stop();
out.println(AnsiStyle.red("\n [ERROR] " + e.getMessage()));
out.println(AnsiStyle.red("\n ✗ Error: " + e.getMessage()));
log.error("Agent 循环异常", e);
out.println();
}

@ -108,6 +108,6 @@ public class BashTool implements Tool {
if (cmd.length() > 60) {
cmd = cmd.substring(0, 57) + "...";
}
return "> " + cmd;
return " " + cmd;
}
}

@ -87,7 +87,7 @@ public class FileEditTool implements Tool {
long oldLines = oldString.lines().count();
long newLines = newString.lines().count();
return "[OK] Edited " + path + " (replaced " + oldLines + " lines with " + newLines + " lines)";
return " Edited " + path + " (replaced " + oldLines + " lines with " + newLines + " lines)";
} catch (IOException e) {
return "Error editing file: " + e.getMessage();
@ -96,6 +96,6 @@ public class FileEditTool implements Tool {
@Override
public String activityDescription(Map<String, Object> input) {
return "[Edit] " + input.getOrDefault("file_path", "file");
return " Editing " + input.getOrDefault("file_path", "file");
}
}

@ -118,6 +118,6 @@ public class FileReadTool implements Tool {
@Override
public String activityDescription(Map<String, Object> input) {
return "[Read] " + input.getOrDefault("file_path", "file");
return "📄 Reading " + input.getOrDefault("file_path", "file");
}
}

@ -67,9 +67,9 @@ public class FileWriteTool implements Tool {
long lines = content.lines().count();
if (existed) {
return "[OK] Updated " + path + " (" + lines + " lines)";
return " Updated " + path + " (" + lines + " lines)";
} else {
return "[OK] Created " + path + " (" + lines + " lines)";
return " Created " + path + " (" + lines + " lines)";
}
} catch (IOException e) {
@ -79,6 +79,6 @@ public class FileWriteTool implements Tool {
@Override
public String activityDescription(Map<String, Object> input) {
return "[Write] " + input.getOrDefault("file_path", "file");
return " Writing " + input.getOrDefault("file_path", "file");
}
}

@ -122,6 +122,6 @@ public class GlobTool implements Tool {
@Override
public String activityDescription(Map<String, Object> input) {
return "[Search] " + input.getOrDefault("pattern", "files");
return "🔍 Searching " + input.getOrDefault("pattern", "files");
}
}

@ -164,6 +164,6 @@ public class GrepTool implements Tool {
@Override
public String activityDescription(Map<String, Object> input) {
return "[Grep] '" + input.getOrDefault("pattern", "...") + "'";
return "🔍 Searching for '" + input.getOrDefault("pattern", "...") + "'";
}
}

Loading…
Cancel
Save