fix: enable custom-protocol feature so release embeds frontend assets
This commit is contained in:
@@ -47,6 +47,24 @@ npm --prefix ui install
|
||||
npm --prefix apps/desktop run dev
|
||||
```
|
||||
|
||||
> **重要:调试版(debug)exe 不能直接双击运行。**
|
||||
> `target\debug\xianren-desktop.exe` 在调试构建下会去连 Vite 开发服务器
|
||||
> (`http://localhost:5173`),不先启动前端就会显示“拒绝连接”,并会附带一个空终端窗口。
|
||||
> 开发时请始终使用 `npm --prefix apps/desktop run dev`。
|
||||
|
||||
**直接双击运行的正式版**:
|
||||
|
||||
```powershell
|
||||
# 编译正式版(内嵌前端页面,无终端窗口;必须带 custom-protocol 特性)
|
||||
cargo build --release -p xianren-desktop --features custom-protocol
|
||||
|
||||
# 运行
|
||||
.\target\release\xianren-desktop.exe
|
||||
```
|
||||
|
||||
正式版双击后:设置页确认引擎路径 → 模型库导入 GGUF → 聊天页选择模型即可对话。
|
||||
如需安装包,可用 `npm --prefix apps/desktop run build`(tauri build 会自动启用该特性并打 NSIS 安装包)。
|
||||
|
||||
## 常用脚本
|
||||
|
||||
| 脚本 | 用途 |
|
||||
@@ -66,4 +84,3 @@ npm --prefix apps/desktop run dev
|
||||
- `xianren.db`:SQLite 数据库
|
||||
|
||||
可在应用“设置”页修改模型目录与引擎路径。
|
||||
|
||||
@@ -8,6 +8,11 @@ rust-version.workspace = true
|
||||
name = "xianren_desktop_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[features]
|
||||
# 生产构建启用该特性后,前端资源会内嵌进 exe 并通过自定义协议加载;
|
||||
# 开发模式(tauri dev)不启用,继续使用 Vite 开发服务器。
|
||||
custom-protocol = ["tauri/custom-protocol"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user