refactor: 清理渲染进程全部 58 处 console.log/warn/error
- 所有错误日志统一走 logService(logError/logWarn/logInfo) - 无 logService 的地方补上对应调用 - 纯调试 trace 直接删除(桌面应用看不到 console) - ollama.ts 流式解析错误改为静默跳过(非关键) - 执行日志面板信息量不变
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import type { ToolDefinition, ToolResult } from '../types.js';
|
||||
import { logToolResult, logError } from './log-service.js';
|
||||
import { logToolStart, logToolResult, logError } from './log-service.js';
|
||||
|
||||
export const TOOL_DEFINITIONS: ToolDefinition[] = [
|
||||
{
|
||||
@@ -159,7 +159,7 @@ export async function executeTool(toolName: string, args: Record<string, unknown
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('[ToolRegistry] 开始执行:', toolName, args);
|
||||
logToolStart(toolName, JSON.stringify(args));
|
||||
// IPC 调用 + 25 秒硬超时(比 agent-engine 的 30 秒先触发)
|
||||
const result = await Promise.race([
|
||||
bridge.tool.execute(toolName, args),
|
||||
@@ -167,11 +167,10 @@ export async function executeTool(toolName: string, args: Record<string, unknown
|
||||
setTimeout(() => reject(new Error(`工具 ${toolName} IPC 超时(25秒)`)), 25000)
|
||||
)
|
||||
]);
|
||||
console.log('[ToolRegistry] 执行完成:', toolName, result);
|
||||
logToolResult(toolName, result.success, result.success ? undefined : result.error);
|
||||
return result;
|
||||
} catch (err) {
|
||||
logError(`工具异常: ${toolName}`, (err as Error).message);
|
||||
console.error('[ToolRegistry] 执行异常:', toolName, err);
|
||||
return { success: false, error: (err as Error).message };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user