新增: AI 助手 Markdown 渲染+打字机流式+桌面 Rust 代理修复 CORS

This commit is contained in:
lxy
2026-08-24 02:13:15 +08:00
parent 7f08f654d9
commit db3b2c24b7
8 changed files with 463 additions and 167 deletions
+12
View File
@@ -0,0 +1,12 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "u-ppt 主窗口默认能力:IPC 命令调用 + AI 流式事件订阅",
"windows": ["main"],
"permissions": [
"core:default",
"core:event:default",
"core:event:allow-listen",
"core:event:allow-unlisten"
]
}
+4 -1
View File
@@ -205,8 +205,11 @@ pub async fn ai_proxy_stream(
.map_err(|e| format!("请求失败: {}", e))?;
if !resp.status().is_success() {
let status = resp.status().as_u16();
let text = resp.text().await.unwrap_or_default();
return Ok(text);
// 错误体带状态码前缀,前端按「接口返回 N」格式提示
let _ = app.emit("ai-error", &text);
return Err(format!("__HTTP_{}__{}", status, text));
}
// 流式读取 SSE