fix(desktop): AI 文本对话改由后端请求 - #24
Open
ljh-696 wants to merge 2 commits into
Open
Conversation
Signed-off-by: Picard-ljh <273232403+Picard-ljh@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fetch被 OpenAI 兼容接口的 CORS preflight 阻断。pinkbin-advisor新增纯文本chat入口,并复用现有 provider 请求/解析逻辑;原advise仍保持 JSON 模式。reqwest启用system-proxy,保证后端请求仍可继承系统代理。Scope
本 PR 只影响桌面端 text-only advisor chat:
Why
部分 OpenAI 兼容接口可以正常处理服务端请求,但不会正确响应浏览器 CORS preflight。
桌面版运行在 Tauri 环境中,已有 Rust 后端和 provider 配置状态,因此 text-only AI 请求改由后端发送更稳定,也避免要求第三方兼容接口额外支持浏览器 CORS。
Notes
Cargo.lock变化来自启用reqwest的system-proxy特性。这样迁移到后端请求后,仍能沿用 Windows/macOS 系统代理行为,避免网络行为相对 WebView 退化。图片对话暂未迁移,是为了控制本 PR 范围;图片请求仍保留原实现。
Test plan
cargo fmt --all -- --checkcargo test --workspace --no-fail-fastcargo clippy --workspace --all-targets -- -D warningscorepack pnpm -C apps/desktop buildcorepack pnpm -C apps/desktop lintcargo run -p pinkbin-scaffold-lint -- scaffolds\conda.toml scaffolds\wechat-pc.toml