fix: 修复 use_dify 缺失以及 GPU process isn't usable. Goodbye. 错误

This commit is contained in:
lrhh123
2024-04-29 15:09:30 +08:00
parent d1e76f6c91
commit 6a48319b9d
10 changed files with 47 additions and 49 deletions
+4 -1
View File
@@ -28,4 +28,7 @@ npm-debug.log.*
*.sass.d.ts
*.scss.d.ts
assets/backend/*
src/renderer/services/analytics/*
src/renderer/services/analytics/*
open_ai.http
+1
View File
@@ -117,6 +117,7 @@
- [x] 支持微信平台的基础聊天功能
- [x] 支持千牛平台的基础聊天功能
- [x] 支持京麦平台的基础聊天功能
- [ ] 支持多平台文章自动发送功能
- [ ] 优化各个平台的独立配置功能
- [ ] 支持 Excel 导入回复内容
- [ ] 支持导出回复内容到 Excel
+1 -1
View File
@@ -205,7 +205,7 @@
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"mini-css-extract-plugin": "^2.7.6",
"node-addon-api": "file:C:/Users/33204/Documents/project/alsritter.icu/lazy-rap-web/tmp/node-addon-api",
"node-addon-api": "^8.0.0",
"prettier": "^3.0.3",
"prettier-eslint": "^16.3.0",
"react-refresh": "^0.14.0",
+7 -7
View File
@@ -341,8 +341,8 @@ devDependencies:
specifier: ^2.7.6
version: 2.9.0(webpack@5.91.0)
node-addon-api:
specifier: file:C:/Users/33204/Documents/project/alsritter.icu/lazy-rap-web/tmp/node-addon-api
version: file:tmp/node-addon-api
specifier: ^8.0.0
version: 8.0.0
prettier:
specifier: ^3.0.3
version: 3.2.5
@@ -11181,6 +11181,11 @@ packages:
/node-addon-api@7.0.0:
resolution: {integrity: sha512-vgbBJTS4m5/KkE16t5Ly0WW9hz46swAstv0hYYwMtbG7AznRhNyfLRe8HZAiWIpcHzoO7HxhLuBQj9rJ/Ho0ZA==}
/node-addon-api@8.0.0:
resolution: {integrity: sha512-ipO7rsHEBqa9STO5C5T10fj732ml+5kLN1cAG8/jdHd56ldQeGj3Q7+scUS+VHK/qy1zLEwC4wMK5+yM0btPvw==}
engines: {node: ^18 || ^20 || >= 21}
dev: true
/node-api-version@0.1.4:
resolution: {integrity: sha512-KGXihXdUChwJAOHO53bv9/vXcLmdUsZ6jIptbvYvkpKfth+r7jw44JkVxQFA3kX5nQjzjmGu1uAu/xNNLNlI5g==}
dependencies:
@@ -15085,8 +15090,3 @@ packages:
/zwitch@2.0.4:
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
dev: false
file:tmp/node-addon-api:
resolution: {directory: tmp/node-addon-api, type: directory}
name: node-addon-api
dev: true
+1
View File
@@ -78,6 +78,7 @@ export function initConfig(sequelize: Sequelize) {
use_dify: {
type: DataTypes.BOOLEAN,
defaultValue: false,
allowNull: true,
},
gpt_model: {
type: DataTypes.STRING,
+5 -5
View File
@@ -21,9 +21,10 @@ import Server from './backend/backend';
let mainWindow: BrowserWindow | null = null;
let backendServiceManager: BackendServiceManager | null = null;
/**
* Add event listeners...
*/
// 修复 GPU process isn't usable. Goodbye. 错误
// https://learn.microsoft.com/en-us/answers/questions/1193062/how-to-fix-electron-program-gpu-process-isnt-usabl
app.commandLine.appendSwitch('no-sandbox');
app.commandLine.appendSwitch('lang', 'zh-CN');
app.on('window-all-closed', async () => {
// Respect the OSX convention of having the application in memory even
@@ -49,8 +50,6 @@ process.on('uncaughtException', async (error, origin) => {
originalUncaughtException?.(error, origin);
});
app.commandLine.appendSwitch('lang', 'zh-CN');
const gotTheLock = app.requestSingleInstanceLock();
const isDebug =
@@ -115,6 +114,7 @@ const createWindow = async () => {
}
setupIpcHandlers(mainWindow, backendServiceManager);
const server = new Server(backendServiceManager.getPort(), mainWindow);
// 启动服务器
server
+11 -33
View File
@@ -193,22 +193,6 @@ export default class MenuBuilder {
buildDefaultTemplate() {
const templateDefault = [
{
label: '&File',
submenu: [
{
label: '&Open',
accelerator: 'Ctrl+O',
},
{
label: '&Close',
accelerator: 'Ctrl+W',
click: () => {
this.mainWindow.close();
},
},
],
},
{
label: '&View',
submenu:
@@ -252,36 +236,30 @@ export default class MenuBuilder {
],
},
{
label: 'Help',
label: '帮助',
submenu: [
{
label: 'Learn More',
click() {
shell.openExternal('https://electronjs.org');
},
},
{
label: 'Documentation',
label: '使用文档',
click() {
shell.openExternal(
'https://github.com/electron/electron/tree/main/docs#readme',
'https://github.com/lrhh123/ChatGPT-On-CS/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E',
);
},
},
{
label: 'Community Discussions',
label: '反馈问题',
click() {
shell.openExternal('https://www.electronjs.org/community');
},
},
{
label: 'Search Issues',
click() {
shell.openExternal('https://github.com/electron/electron/issues');
shell.openExternal(
'https://github.com/lrhh123/ChatGPT-On-CS/issues',
);
},
},
],
},
{
label: '调试',
submenu: [],
},
];
return templateDefault;
+2 -2
View File
@@ -50,8 +50,8 @@ function logToFile(message: string) {
fs.appendFileSync(logFilePath, logMessage);
}
const isDebug =
process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true';
// const isDebug =
// process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true';
const originalConsoleLog = console.log;
const originalConsoleError = console.error;
@@ -4,10 +4,12 @@ import '@hw-hmscore/analytics-web';
const agConnectConfig = {
// TODO: 请替换为您的应用 ID
// 修改该文件名称为 index.ts
// 这里使用的是华为的服务用于打点
};
// 初始化分析实例
// @ts-ignore
agconnect.instance().configInstance(agConnectConfig);
const analytics = agconnect.analytics();
+13
View File
@@ -37,6 +37,19 @@ POST https://api.dify.ai/v1/chat-messages
content-type: application/json
Authorization: Bearer app-5uPNxwQ6Q8bU6FzO3WZ72tqV
{
"inputs": {},
"response_mode": "blocking",
"user": "apiuser",
"query": "Who won the world series in 2020?"
}
###
POST http://chat.wangpisi.com/v1/chat-messages
content-type: application/json
Authorization: Bearer app-voGEBvo8IYKmymYkVtBgxBFF
{
"inputs": {},
"response_mode": "blocking",