i18n: 全部用户可见字符串统一为英文(46个文件)
- 所有Command/Tool/Core/MCP/Plugin中的中文提示改为英文 - Javadoc注释和行内注释保留中文不变 - AI提示词(compact/commit/review等)改为英文 - 编译验证通过 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -146,7 +146,7 @@ public class AgentLoop {
|
||||
|
||||
while (iteration < MAX_ITERATIONS) {
|
||||
iteration++;
|
||||
log.debug("Agent 循环 第{}轮 ({})", iteration, streaming ? "流式" : "阻塞");
|
||||
log.debug("Agent loop iteration {} ({})", iteration, streaming ? "streaming" : "blocking");
|
||||
|
||||
Prompt prompt = new Prompt(List.copyOf(messageHistory), options);
|
||||
|
||||
@@ -177,7 +177,7 @@ public class AgentLoop {
|
||||
|
||||
// 无工具调用 → 结束
|
||||
if (!result.assistant.hasToolCalls()) {
|
||||
log.debug("无工具调用,循环结束(共{}轮)", iteration);
|
||||
log.debug("No tool calls, loop ended (total {} iterations)", iteration);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -186,8 +186,8 @@ public class AgentLoop {
|
||||
}
|
||||
|
||||
if (iteration >= MAX_ITERATIONS) {
|
||||
log.warn("Agent 循环已达最大迭代次数 {},强制终止", MAX_ITERATIONS);
|
||||
lastAssistantText += "\n\n[WARNING: 达到最大循环次数限制]";
|
||||
log.warn("Agent loop reached max iterations {}, force stopping", MAX_ITERATIONS);
|
||||
lastAssistantText += "\n\n[WARNING: Maximum loop iteration limit reached]";
|
||||
}
|
||||
|
||||
return lastAssistantText;
|
||||
@@ -256,7 +256,7 @@ public class AgentLoop {
|
||||
|
||||
} catch (Exception e) {
|
||||
// 流式调用失败 → 降级到阻塞模式
|
||||
log.warn("流式调用失败,降级到阻塞模式: {}", e.getMessage());
|
||||
log.warn("Streaming call failed, falling back to blocking mode: {}", e.getMessage());
|
||||
return blockingIteration(prompt);
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ public class AgentLoop {
|
||||
// PreToolUse Hook
|
||||
var preHookCtx = new HookManager.HookContext(toolName, parsedArgs);
|
||||
if (hookManager.execute(HookManager.HookType.PRE_TOOL_USE, preHookCtx) == HookManager.HookResult.ABORT) {
|
||||
log.info("[{}] PreToolUse Hook 中止了执行", toolName);
|
||||
log.info("[{}] PreToolUse Hook aborted execution", toolName);
|
||||
toolResponses.add(new ToolResponseMessage.ToolResponse(callId, toolName, "Aborted by hook"));
|
||||
continue;
|
||||
}
|
||||
@@ -313,12 +313,12 @@ public class AgentLoop {
|
||||
if (permitted) {
|
||||
result = adapter.call(toolArgs);
|
||||
} else {
|
||||
result = "Permission denied: 用户拒绝了此操作";
|
||||
log.info("[{}] 用户拒绝工具执行", toolName);
|
||||
result = "Permission denied: User rejected this operation";
|
||||
log.info("[{}] User denied tool execution", toolName);
|
||||
}
|
||||
} else {
|
||||
result = "Error: Unknown tool '" + toolName + "'";
|
||||
log.warn("未知工具: {}", toolName);
|
||||
log.warn("Unknown tool: {}", toolName);
|
||||
}
|
||||
|
||||
// PostToolUse Hook
|
||||
@@ -433,7 +433,7 @@ public class AgentLoop {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// thinking 提取失败不影响主流程
|
||||
log.debug("Thinking 内容提取异常(可忽略): {}", e.getMessage());
|
||||
log.debug("Thinking content extraction exception (can be ignored): {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ConversationPersistence {
|
||||
try {
|
||||
Files.createDirectories(conversationsDir);
|
||||
} catch (IOException e) {
|
||||
log.warn("无法创建对话存储目录: {}", e.getMessage());
|
||||
log.warn("Failed to create conversation storage directory: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,10 +76,10 @@ public class ConversationPersistence {
|
||||
);
|
||||
|
||||
MAPPER.writeValue(file.toFile(), conv);
|
||||
log.info("对话已保存: {}", file.getFileName());
|
||||
log.info("Conversation saved: {}", file.getFileName());
|
||||
return file;
|
||||
} catch (IOException e) {
|
||||
log.error("保存对话失败: {}", e.getMessage());
|
||||
log.error("Failed to save conversation: {}", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public class ConversationPersistence {
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
} catch (IOException e) {
|
||||
log.error("加载对话失败: {}", e.getMessage());
|
||||
log.error("Failed to load conversation: {}", e.getMessage());
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
@@ -131,11 +131,11 @@ public class ConversationPersistence {
|
||||
conv.messages().size()
|
||||
));
|
||||
} catch (IOException e) {
|
||||
log.debug("跳过无效对话文件: {}", file.getFileName());
|
||||
log.debug("Skipping invalid conversation file: {}", file.getFileName());
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
log.warn("列出对话失败: {}", e.getMessage());
|
||||
log.warn("Failed to list conversations: {}", e.getMessage());
|
||||
}
|
||||
|
||||
return summaries;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class HookManager {
|
||||
*/
|
||||
public void register(HookType type, String name, HookHandler handler) {
|
||||
hooks.add(new HookRegistration(type, name, handler, 0));
|
||||
log.debug("注册 Hook: {} [{}]", name, type);
|
||||
log.debug("Registered Hook: {} [{}]", name, type);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ public class HookManager {
|
||||
*/
|
||||
public void register(HookType type, String name, HookHandler handler, int priority) {
|
||||
hooks.add(new HookRegistration(type, name, handler, priority));
|
||||
log.debug("注册 Hook: {} [{}] priority={}", name, type, priority);
|
||||
log.debug("Registered Hook: {} [{}] priority={}", name, type, priority);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,15 +72,15 @@ public class HookManager {
|
||||
|
||||
for (HookRegistration reg : matching) {
|
||||
try {
|
||||
log.debug("执行 Hook: {} [{}]", reg.name(), type);
|
||||
log.debug("Executing Hook: {} [{}]", reg.name(), type);
|
||||
HookResult result = reg.handler().handle(context);
|
||||
|
||||
if (result == HookResult.ABORT) {
|
||||
log.info("Hook [{}] 中止了操作", reg.name());
|
||||
log.info("Hook [{}] aborted the operation", reg.name());
|
||||
return HookResult.ABORT;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("Hook [{}] 执行异常: {}", reg.name(), e.getMessage());
|
||||
log.warn("Hook [{}] execution exception: {}", reg.name(), e.getMessage());
|
||||
// Hook 异常不影响主流程
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ public class TaskManager {
|
||||
* @throws NullPointerException 若 description 或 work 为 null
|
||||
*/
|
||||
public String createTask(String description, Callable<String> work) {
|
||||
Objects.requireNonNull(description, "任务描述不能为 null");
|
||||
Objects.requireNonNull(work, "任务工作体不能为 null");
|
||||
Objects.requireNonNull(description, "Task description cannot be null");
|
||||
Objects.requireNonNull(work, "Task work body cannot be null");
|
||||
|
||||
String taskId = generateId();
|
||||
Instant now = Instant.now();
|
||||
@@ -162,7 +162,7 @@ public class TaskManager {
|
||||
*/
|
||||
public String createTask(String description, Callable<String> work,
|
||||
Map<String, String> metadata) {
|
||||
Objects.requireNonNull(metadata, "元数据不能为 null");
|
||||
Objects.requireNonNull(metadata, "Metadata cannot be null");
|
||||
String taskId = createTask(description, work);
|
||||
// 把元数据补充进去(创建时尚处于 PENDING/RUNNING 初期阶段)
|
||||
tasks.computeIfPresent(taskId, (id, old) -> new TaskInfo(
|
||||
@@ -194,7 +194,7 @@ public class TaskManager {
|
||||
* @return 生成的任务 ID
|
||||
*/
|
||||
public String createManualTask(String description, Map<String, String> metadata) {
|
||||
Objects.requireNonNull(description, "任务描述不能为 null");
|
||||
Objects.requireNonNull(description, "Task description cannot be null");
|
||||
|
||||
String taskId = generateId();
|
||||
Instant now = Instant.now();
|
||||
@@ -332,14 +332,14 @@ public class TaskManager {
|
||||
*/
|
||||
public String getSummary() {
|
||||
if (tasks.isEmpty()) {
|
||||
return "当前没有任何任务。";
|
||||
return "No tasks at the moment.";
|
||||
}
|
||||
|
||||
Map<TaskStatus, Long> counts = tasks.values().stream()
|
||||
.collect(Collectors.groupingBy(TaskInfo::status, Collectors.counting()));
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("任务汇总 (共 ").append(tasks.size()).append(" 个):\n");
|
||||
sb.append("Task summary (total ").append(tasks.size()).append("):\n");
|
||||
for (TaskStatus status : TaskStatus.values()) {
|
||||
long count = counts.getOrDefault(status, 0L);
|
||||
if (count > 0) {
|
||||
|
||||
Reference in New Issue
Block a user