新增: AI 助手 Markdown 渲染+打字机流式+桌面 Rust 代理修复 CORS
This commit is contained in:
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user