feat(api): 将万川平台配置迁移至后端存储
- 移除前端localStorage依赖,改用后端SQLite作为唯一数据源 - 新增getWanchuanConfig和saveWanchuanConfig函数用于配置读写 - 添加getBoundKnowledgeBase函数统一获取绑定知识库信息 - 支持桌面应用端口变化时正确读取配置 refactor(settings): 重构万川平台配置管理逻辑 - 移除localStorage配置存储,改为后端API调用 - 实现配置自动恢复和防抖保存机制 - 添加token过期自动重登功能 - 优化知识库选择和连接状态管理 fix(knowledge): 修复知识库上传异步问题 - 将getBoundKnowledgeBase调用改为await异步处理 - 统一各页面的知识库信息获取方式 - 修正上传接口datasetId使用逻辑 feat(electron): 添加chatlog.exe存在性检查 - 新增ensureChatlogExe函数验证执行文件存在 - 防止杀毒软件误删导致的ENONENT错误 - 提供用户友好的错误提示和解决方案
This commit is contained in:
@@ -44,6 +44,22 @@ function chatlogExePath() {
|
||||
return resourcePath('chatlog.exe');
|
||||
}
|
||||
|
||||
// 启动 chatlog.exe 前确认文件确实存在。
|
||||
// 该文件常被杀毒软件(尤其 Windows Defender)误判为风险程序而静默隔离/删除,
|
||||
// 导致安装后“有时候”运行就报 spawn ... ENOENT。这里把底层的 ENOENT
|
||||
// 提前转成一句用户能看懂、能自救的中文提示。
|
||||
function ensureChatlogExe() {
|
||||
const exePath = chatlogExePath();
|
||||
if (!fs.existsSync(exePath)) {
|
||||
throw new Error(
|
||||
`未找到 chatlog.exe(应在:${exePath})。` +
|
||||
`该文件可能被杀毒软件误删或隔离。请将安装目录加入杀毒软件白名单,` +
|
||||
`从隔离区恢复 chatlog.exe,或重新安装本应用后再试。`
|
||||
);
|
||||
}
|
||||
return exePath;
|
||||
}
|
||||
|
||||
function backendExePath() {
|
||||
return resourcePath('backend', 'ChatLabBackend.exe');
|
||||
}
|
||||
@@ -688,7 +704,13 @@ function selectMainWeChatProcess(processes) {
|
||||
|
||||
function runChatlogKey(args, label) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const exePath = chatlogExePath();
|
||||
let exePath;
|
||||
try {
|
||||
exePath = ensureChatlogExe();
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
return;
|
||||
}
|
||||
const keyProcess = spawn(exePath, args, {
|
||||
cwd: projectRoot(),
|
||||
windowsHide: true,
|
||||
|
||||
Reference in New Issue
Block a user