refactor: 清理渲染进程全部 58 处 console.log/warn/error

- 所有错误日志统一走 logService(logError/logWarn/logInfo)
- 无 logService 的地方补上对应调用
- 纯调试 trace 直接删除(桌面应用看不到 console)
- ollama.ts 流式解析错误改为静默跳过(非关键)
- 执行日志面板信息量不变
This commit is contained in:
thzxx
2026-04-07 01:42:56 +08:00
parent f174e7d737
commit 60152fb443
14 changed files with 24 additions and 73 deletions
+1 -6
View File
@@ -89,9 +89,7 @@ export class OllamaAPI {
fetchOptions.signal = abortController.signal;
}
console.log('[OllamaAPI] chatStream 请求:', `${this.baseUrl}/api/chat`, 'messages:', params.messages.length, 'tools:', params.tools?.length || 0);
const response = await this._request('/api/chat', fetchOptions);
console.log('[OllamaAPI] chatStream 响应状态:', response.status);
const reader = response.body!.getReader();
const decoder = new TextDecoder();
let buffer = '';
@@ -105,7 +103,6 @@ export class OllamaAPI {
while (true) {
const { done, value } = await reader.read();
if (done) {
console.log('[OllamaAPI] 流读取结束 (reader done)');
break;
}
@@ -119,12 +116,10 @@ export class OllamaAPI {
const chunk: OllamaStreamChunk = JSON.parse(line);
if (onChunk) onChunk(chunk);
if (chunk.done) {
console.log('[OllamaAPI] 收到 done:true, eval_count:', chunk.eval_count);
reader.cancel();
return;
}
} catch (err) {
console.warn('[OllamaAPI] 流式数据解析警告:', (err as Error).message);
} catch {
}
}
}