Skip to content

Commit 6a48319

Browse files
author
lrhh123
committed
fix: 修复 use_dify 缺失以及 GPU process isn't usable. Goodbye. 错误
1 parent d1e76f6 commit 6a48319

File tree

10 files changed

+47
-49
lines changed

10 files changed

+47
-49
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ npm-debug.log.*
2828
*.sass.d.ts
2929
*.scss.d.ts
3030
assets/backend/*
31-
src/renderer/services/analytics/*
31+
src/renderer/services/analytics/*
32+
33+
34+
open_ai.http

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
- [x] 支持微信平台的基础聊天功能
118118
- [x] 支持千牛平台的基础聊天功能
119119
- [x] 支持京麦平台的基础聊天功能
120+
- [ ] 支持多平台文章自动发送功能
120121
- [ ] 优化各个平台的独立配置功能
121122
- [ ] 支持 Excel 导入回复内容
122123
- [ ] 支持导出回复内容到 Excel

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
"jest": "^29.7.0",
206206
"jest-environment-jsdom": "^29.7.0",
207207
"mini-css-extract-plugin": "^2.7.6",
208-
"node-addon-api": "file:C:/Users/33204/Documents/project/alsritter.icu/lazy-rap-web/tmp/node-addon-api",
208+
"node-addon-api": "^8.0.0",
209209
"prettier": "^3.0.3",
210210
"prettier-eslint": "^16.3.0",
211211
"react-refresh": "^0.14.0",

pnpm-lock.yaml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/backend/entities/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export function initConfig(sequelize: Sequelize) {
7878
use_dify: {
7979
type: DataTypes.BOOLEAN,
8080
defaultValue: false,
81+
allowNull: true,
8182
},
8283
gpt_model: {
8384
type: DataTypes.STRING,

src/main/main.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ import Server from './backend/backend';
2121
let mainWindow: BrowserWindow | null = null;
2222
let backendServiceManager: BackendServiceManager | null = null;
2323

24-
/**
25-
* Add event listeners...
26-
*/
24+
// 修复 GPU process isn't usable. Goodbye. 错误
25+
// https://learn.microsoft.com/en-us/answers/questions/1193062/how-to-fix-electron-program-gpu-process-isnt-usabl
26+
app.commandLine.appendSwitch('no-sandbox');
27+
app.commandLine.appendSwitch('lang', 'zh-CN');
2728

2829
app.on('window-all-closed', async () => {
2930
// Respect the OSX convention of having the application in memory even
@@ -49,8 +50,6 @@ process.on('uncaughtException', async (error, origin) => {
4950
originalUncaughtException?.(error, origin);
5051
});
5152

52-
app.commandLine.appendSwitch('lang', 'zh-CN');
53-
5453
const gotTheLock = app.requestSingleInstanceLock();
5554

5655
const isDebug =
@@ -115,6 +114,7 @@ const createWindow = async () => {
115114
}
116115

117116
setupIpcHandlers(mainWindow, backendServiceManager);
117+
118118
const server = new Server(backendServiceManager.getPort(), mainWindow);
119119
// 启动服务器
120120
server

src/main/menu.ts

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -193,22 +193,6 @@ export default class MenuBuilder {
193193

194194
buildDefaultTemplate() {
195195
const templateDefault = [
196-
{
197-
label: '&File',
198-
submenu: [
199-
{
200-
label: '&Open',
201-
accelerator: 'Ctrl+O',
202-
},
203-
{
204-
label: '&Close',
205-
accelerator: 'Ctrl+W',
206-
click: () => {
207-
this.mainWindow.close();
208-
},
209-
},
210-
],
211-
},
212196
{
213197
label: '&View',
214198
submenu:
@@ -252,36 +236,30 @@ export default class MenuBuilder {
252236
],
253237
},
254238
{
255-
label: 'Help',
239+
label: '帮助',
256240
submenu: [
257241
{
258-
label: 'Learn More',
259-
click() {
260-
shell.openExternal('https://electronjs.org');
261-
},
262-
},
263-
{
264-
label: 'Documentation',
242+
label: '使用文档',
265243
click() {
266244
shell.openExternal(
267-
'https://github.com/electron/electron/tree/main/docs#readme',
245+
'https://github.com/lrhh123/ChatGPT-On-CS/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E',
268246
);
269247
},
270248
},
271249
{
272-
label: 'Community Discussions',
273-
click() {
274-
shell.openExternal('https://www.electronjs.org/community');
275-
},
276-
},
277-
{
278-
label: 'Search Issues',
250+
label: '反馈问题',
279251
click() {
280-
shell.openExternal('https://github.com/electron/electron/issues');
252+
shell.openExternal(
253+
'https://github.com/lrhh123/ChatGPT-On-CS/issues',
254+
);
281255
},
282256
},
283257
],
284258
},
259+
{
260+
label: '调试',
261+
submenu: [],
262+
},
285263
];
286264

287265
return templateDefault;

src/main/system/logger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ function logToFile(message: string) {
5050
fs.appendFileSync(logFilePath, logMessage);
5151
}
5252

53-
const isDebug =
54-
process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true';
53+
// const isDebug =
54+
// process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true';
5555

5656
const originalConsoleLog = console.log;
5757
const originalConsoleError = console.error;

src/renderer/services/analytics/index_template.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import '@hw-hmscore/analytics-web';
44

55
const agConnectConfig = {
66
// TODO: 请替换为您的应用 ID
7+
// 修改该文件名称为 index.ts
78
// 这里使用的是华为的服务用于打点
89
};
910

1011
// 初始化分析实例
12+
// @ts-ignore
1113
agconnect.instance().configInstance(agConnectConfig);
1214
const analytics = agconnect.analytics();
1315

tests/open_ai.http

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ POST https://api.dify.ai/v1/chat-messages
3737
content-type: application/json
3838
Authorization: Bearer app-5uPNxwQ6Q8bU6FzO3WZ72tqV
3939

40+
{
41+
"inputs": {},
42+
"response_mode": "blocking",
43+
"user": "apiuser",
44+
"query": "Who won the world series in 2020?"
45+
}
46+
47+
###
48+
49+
POST http://chat.wangpisi.com/v1/chat-messages
50+
content-type: application/json
51+
Authorization: Bearer app-voGEBvo8IYKmymYkVtBgxBFF
52+
4053
{
4154
"inputs": {},
4255
"response_mode": "blocking",

0 commit comments

Comments
 (0)