v0.16.13: 修复流式渲染失效 Bug + 版本号更新

This commit is contained in:
2026-07-30 21:10:00 +08:00
parent 204446eb58
commit 28655b80d9
7 changed files with 26 additions and 18 deletions
+3 -3
View File
@@ -14,7 +14,7 @@
</p>
<p align="center">
<img src="https://img.shields.io/badge/version-v0.16.12-E8734A?style=flat-square" alt="version">
<img src="https://img.shields.io/badge/version-v0.16.13-E8734A?style=flat-square" alt="version">
<img src="https://img.shields.io/badge/electron-33+-47848F?style=flat-square&logo=electron" alt="electron">
<img src="https://img.shields.io/badge/typescript-5.7+-3178C6?style=flat-square&logo=typescript" alt="typescript">
<img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="license">
@@ -245,7 +245,7 @@ npm start
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm run dist
```
产出:`release/Metona Ollama Setup v0.16.12.exe`
产出:`release/Metona Ollama Setup v0.16.13.exe`
## 🛠️ 常用命令
@@ -485,7 +485,7 @@ npm start
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm run dist
```
Output: `release/Metona Ollama Setup v0.16.12.exe`
Output: `release/Metona Ollama Setup v0.16.13.exe`
## 🛠️ Common Commands
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "metona-ollama-desktop",
"version": "0.16.12",
"version": "0.16.13",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "metona-ollama-desktop",
"version": "0.16.12",
"version": "0.16.13",
"license": "MIT",
"dependencies": {
"ffmpeg-static": "^5.2.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "metona-ollama-desktop",
"version": "0.16.12",
"version": "0.16.13",
"description": "Metona Ollama - TypeScript + Electron 桌面 AI 聊天客户端",
"main": "dist/main/main.js",
"author": "thzxx",
+1 -1
View File
@@ -101,7 +101,7 @@ export function createMenu(): void {
dialog.showMessageBox(mainWindow!, {
type: 'info',
title: '关于 Metona Ollama',
message: 'Metona Ollama Desktop v0.16.12',
message: 'Metona Ollama Desktop v0.16.13',
detail: 'TypeScript + Electron Ollama AI 聊天客户端\n\nhttps://gitee.com/thzxx/metona-ollama',
icon: getIconPath()
});
+14 -8
View File
@@ -115,22 +115,28 @@ export class OllamaAPI {
for (const line of lines) {
if (!line.trim()) continue;
let chunk: OllamaStreamChunk;
try {
const chunk: OllamaStreamChunk = JSON.parse(line);
if (onChunk) onChunk(chunk);
if (chunk.done) {
return;
}
chunk = JSON.parse(line);
} catch {
continue; // 跳过无法解析的行(可能是不完整的 JSON)
}
// onChunk 回调错误不再被静默吞掉,而是向上传播给调用方
if (onChunk) onChunk(chunk);
if (chunk.done) {
return;
}
}
}
if (buffer.trim()) {
let chunk: OllamaStreamChunk;
try {
const chunk: OllamaStreamChunk = JSON.parse(buffer);
if (onChunk) onChunk(chunk);
} catch { /* ignore */ }
chunk = JSON.parse(buffer);
} catch {
return; // 末尾 buffer 无法解析,忽略
}
if (onChunk) onChunk(chunk);
}
}
+4 -2
View File
@@ -478,9 +478,11 @@ export function updateLastAssistantMessage(
addCodeBlockCopyButtons(contentDiv);
} else {
// 流式期间:实时 Markdown 渲染 + rAF 节流
// R58-fix: 移除对未声明变量 _streamRenderThink/_streamRenderModel 的赋值
// 原代码在严格模式下会抛出 ReferenceError,被 chatStream 的空 catch 静默吞掉,
// 导致 requestAnimationFrame(_doStreamRender) 永远不会被调用,流式渲染完全失效。
// think 和 model 已在上方(model tag)和下方(think block)直接处理,无需传递给 _doStreamRender。
_streamRenderContent = safeContent;
_streamRenderThink = think;
_streamRenderModel = model;
if (!_streamRenderPending) {
_streamRenderPending = true;
requestAnimationFrame(_doStreamRender);
+1 -1
View File
@@ -28,7 +28,7 @@
<div class="header-left">
<img class="logo" src="./assets/icons/llama.png" alt="logo" />
<span class="app-title">Metona Ollama</span>
<span class="app-version">v0.16.12</span>
<span class="app-version">v0.16.13</span>
<button class="icon-btn help-btn" id="btnHelp" title="使用帮助">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/>