@lobehub/chat 1.21.0 → 1.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/Dockerfile +5 -2
- package/Dockerfile.database +5 -2
- package/package.json +1 -1
- package/scripts/serverLauncher/startServer.js +10 -81
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,23 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.21.1](https://github.com/lobehub/lobe-chat/compare/v1.21.0...v1.21.1)
|
6
|
+
|
7
|
+
<sup>Released on **2024-09-30**</sup>
|
8
|
+
|
9
|
+
<br/>
|
10
|
+
|
11
|
+
<details>
|
12
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
13
|
+
|
14
|
+
</details>
|
15
|
+
|
16
|
+
<div align="right">
|
17
|
+
|
18
|
+
[](#readme-top)
|
19
|
+
|
20
|
+
</div>
|
21
|
+
|
5
22
|
## [Version 1.21.0](https://github.com/lobehub/lobe-chat/compare/v1.20.8...v1.21.0)
|
6
23
|
|
7
24
|
<sup>Released on **2024-09-30**</sup>
|
package/Dockerfile
CHANGED
@@ -114,8 +114,9 @@ COPY --from=app / /
|
|
114
114
|
|
115
115
|
ENV NODE_ENV="production" \
|
116
116
|
NODE_OPTIONS="--use-openssl-ca" \
|
117
|
-
NODE_EXTRA_CA_CERTS="
|
118
|
-
NODE_TLS_REJECT_UNAUTHORIZED=""
|
117
|
+
NODE_EXTRA_CA_CERTS="" \
|
118
|
+
NODE_TLS_REJECT_UNAUTHORIZED="" \
|
119
|
+
SSL_CERT_DIR="/etc/ssl/certs/ca-certificates.crt"
|
119
120
|
|
120
121
|
# set hostname to localhost
|
121
122
|
ENV HOSTNAME="0.0.0.0" \
|
@@ -185,6 +186,8 @@ ENV \
|
|
185
186
|
TOGETHERAI_API_KEY="" TOGETHERAI_MODEL_LIST="" \
|
186
187
|
# Upstage
|
187
188
|
UPSTAGE_API_KEY="" \
|
189
|
+
# Wenxin
|
190
|
+
WENXIN_ACCESS_KEY="" WENXIN_SECRET_KEY="" \
|
188
191
|
# 01.AI
|
189
192
|
ZEROONE_API_KEY="" ZEROONE_MODEL_LIST="" \
|
190
193
|
# Zhipu
|
package/Dockerfile.database
CHANGED
@@ -127,8 +127,9 @@ COPY --from=app / /
|
|
127
127
|
|
128
128
|
ENV NODE_ENV="production" \
|
129
129
|
NODE_OPTIONS="--use-openssl-ca" \
|
130
|
-
NODE_EXTRA_CA_CERTS="
|
131
|
-
NODE_TLS_REJECT_UNAUTHORIZED=""
|
130
|
+
NODE_EXTRA_CA_CERTS="" \
|
131
|
+
NODE_TLS_REJECT_UNAUTHORIZED="" \
|
132
|
+
SSL_CERT_DIR="/etc/ssl/certs/ca-certificates.crt"
|
132
133
|
|
133
134
|
# set hostname to localhost
|
134
135
|
ENV HOSTNAME="0.0.0.0" \
|
@@ -217,6 +218,8 @@ ENV \
|
|
217
218
|
TOGETHERAI_API_KEY="" TOGETHERAI_MODEL_LIST="" \
|
218
219
|
# Upstage
|
219
220
|
UPSTAGE_API_KEY="" \
|
221
|
+
# Wenxin
|
222
|
+
WENXIN_ACCESS_KEY="" WENXIN_SECRET_KEY="" \
|
220
223
|
# 01.AI
|
221
224
|
ZEROONE_API_KEY="" ZEROONE_MODEL_LIST="" \
|
222
225
|
# Zhipu
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.21.
|
3
|
+
"version": "1.21.1",
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
5
5
|
"keywords": [
|
6
6
|
"framework",
|
@@ -1,6 +1,5 @@
|
|
1
1
|
const dns = require('dns').promises;
|
2
2
|
const fs = require('fs').promises;
|
3
|
-
const tls = require('tls');
|
4
3
|
const { spawn } = require('child_process');
|
5
4
|
|
6
5
|
// Set file paths
|
@@ -23,68 +22,6 @@ const isValidIP = (ip, version = 4) => {
|
|
23
22
|
}
|
24
23
|
};
|
25
24
|
|
26
|
-
// Function to check TLS validity of a URL
|
27
|
-
const isValidTLS = (url = '') => {
|
28
|
-
if (!url) {
|
29
|
-
console.log('⚠️ TLS Check: No URL provided. Skipping TLS check. Ensure correct setting ENV.');
|
30
|
-
console.log('-------------------------------------');
|
31
|
-
return Promise.resolve();
|
32
|
-
}
|
33
|
-
|
34
|
-
const { protocol, host, port } = parseUrl(url);
|
35
|
-
if (protocol !== 'https') {
|
36
|
-
console.log(`⚠️ TLS Check: Non-HTTPS protocol (${protocol}). Skipping TLS check for ${url}.`);
|
37
|
-
console.log('-------------------------------------');
|
38
|
-
return Promise.resolve();
|
39
|
-
}
|
40
|
-
|
41
|
-
const options = { host, port, servername: host };
|
42
|
-
return new Promise((resolve, reject) => {
|
43
|
-
const socket = tls.connect(options, () => {
|
44
|
-
console.log(`✅ TLS Check: Valid certificate for ${host}:${port}.`);
|
45
|
-
console.log('-------------------------------------');
|
46
|
-
|
47
|
-
socket.end();
|
48
|
-
|
49
|
-
resolve();
|
50
|
-
});
|
51
|
-
|
52
|
-
socket.on('error', (err) => {
|
53
|
-
const errMsg = `❌ TLS Check: Error for ${host}:${port}. Details:`;
|
54
|
-
switch (err.code) {
|
55
|
-
case 'CERT_HAS_EXPIRED':
|
56
|
-
case 'DEPTH_ZERO_SELF_SIGNED_CERT':
|
57
|
-
case 'ERR_TLS_CERT_ALTNAME_INVALID':
|
58
|
-
console.error(`${errMsg} Certificate is not valid. Consider setting NODE_TLS_REJECT_UNAUTHORIZED="0" or mapping /etc/ssl/certs/ca-certificates.crt.`);
|
59
|
-
break;
|
60
|
-
case 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY':
|
61
|
-
console.error(`${errMsg} Unable to verify issuer. Ensure correct mapping of /etc/ssl/certs/ca-certificates.crt.`);
|
62
|
-
break;
|
63
|
-
default:
|
64
|
-
console.error(`${errMsg} Network issue. Check firewall or DNS.`);
|
65
|
-
break;
|
66
|
-
}
|
67
|
-
reject(err);
|
68
|
-
});
|
69
|
-
});
|
70
|
-
};
|
71
|
-
|
72
|
-
// Function to check TLS connections for OSS and Auth Issuer
|
73
|
-
const checkTLSConnections = async () => {
|
74
|
-
await Promise.all([
|
75
|
-
isValidTLS(process.env.S3_ENDPOINT),
|
76
|
-
isValidTLS(process.env.S3_PUBLIC_DOMAIN),
|
77
|
-
isValidTLS(getEnvVarsByKeyword('_ISSUER')),
|
78
|
-
]);
|
79
|
-
};
|
80
|
-
|
81
|
-
// Function to get environment variable by keyword
|
82
|
-
const getEnvVarsByKeyword = (keyword) => {
|
83
|
-
return Object.entries(process.env)
|
84
|
-
.filter(([key, value]) => key.includes(keyword) && value)
|
85
|
-
.map(([, value]) => value)[0] || null;
|
86
|
-
};
|
87
|
-
|
88
25
|
// Function to parse protocol, host and port from a URL
|
89
26
|
const parseUrl = (url) => {
|
90
27
|
const { protocol, hostname: host, port } = new URL(url);
|
@@ -170,26 +107,18 @@ const runServer = async () => {
|
|
170
107
|
|
171
108
|
if (process.env.DATABASE_DRIVER) {
|
172
109
|
try {
|
173
|
-
|
174
|
-
await fs.access(DB_MIGRATION_SCRIPT_PATH);
|
175
|
-
|
176
|
-
await runScript(DB_MIGRATION_SCRIPT_PATH);
|
177
|
-
} catch (err) {
|
178
|
-
if (err.code === 'ENOENT') {
|
179
|
-
console.log(`⚠️ DB Migration: Not found ${DB_MIGRATION_SCRIPT_PATH}. Skipping DB migration. Ensure to migrate database manually.`);
|
180
|
-
console.log('-------------------------------------');
|
181
|
-
} else {
|
182
|
-
console.error('❌ Error during DB migration:');
|
183
|
-
console.error(err);
|
184
|
-
process.exit(1);
|
185
|
-
}
|
186
|
-
}
|
110
|
+
await fs.access(DB_MIGRATION_SCRIPT_PATH);
|
187
111
|
|
188
|
-
await
|
112
|
+
await runScript(DB_MIGRATION_SCRIPT_PATH);
|
189
113
|
} catch (err) {
|
190
|
-
|
191
|
-
|
192
|
-
|
114
|
+
if (err.code === 'ENOENT') {
|
115
|
+
console.log(`⚠️ DB Migration: Not found ${DB_MIGRATION_SCRIPT_PATH}. Skipping DB migration. Ensure to migrate database manually.`);
|
116
|
+
console.log('-------------------------------------');
|
117
|
+
} else {
|
118
|
+
console.error('❌ Error during DB migration:');
|
119
|
+
console.error(err);
|
120
|
+
process.exit(1);
|
121
|
+
}
|
193
122
|
}
|
194
123
|
}
|
195
124
|
|