wechaty-web-panel 1.4.13 → 1.4.14
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 +3 -0
- package/dist/cjs/src/package-json.d.ts +1 -1
- package/dist/cjs/src/package-json.js +4 -4
- package/dist/cjs/src/proxy/aibotk.js +1 -1
- package/dist/cjs/src/proxy/openAi.js +27 -3
- package/dist/esm/src/package-json.d.ts +1 -1
- package/dist/esm/src/package-json.js +4 -4
- package/dist/esm/src/proxy/aibotk.js +1 -1
- package/dist/esm/src/proxy/openAi.js +24 -3
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -42,7 +42,6 @@ export namespace packageJson {
|
|
|
42
42
|
"npm-run-all": string;
|
|
43
43
|
prettier: string;
|
|
44
44
|
wechaty: string;
|
|
45
|
-
"wechaty-puppet-padlocal": string;
|
|
46
45
|
};
|
|
47
46
|
const readme: string;
|
|
48
47
|
namespace engines {
|
|
@@ -53,6 +52,7 @@ export namespace packageJson {
|
|
|
53
52
|
axios: string;
|
|
54
53
|
chatgpt: string;
|
|
55
54
|
dayjs: string;
|
|
55
|
+
"https-proxy-agent": string;
|
|
56
56
|
"isomorphic-fetch": string;
|
|
57
57
|
ix: string;
|
|
58
58
|
jsonwebtoken: string;
|
|
@@ -6,7 +6,7 @@ exports.packageJson = void 0;
|
|
|
6
6
|
*/
|
|
7
7
|
exports.packageJson = {
|
|
8
8
|
"name": "wechaty-web-panel",
|
|
9
|
-
"version": "1.4.
|
|
9
|
+
"version": "1.4.14",
|
|
10
10
|
"description": "智能微秘书插件",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
@@ -59,8 +59,7 @@ exports.packageJson = {
|
|
|
59
59
|
"eslint-plugin-prettier": "^3.1.4",
|
|
60
60
|
"npm-run-all": "^4.1.5",
|
|
61
61
|
"prettier": "^2.0.5",
|
|
62
|
-
"wechaty": "^1.20.2"
|
|
63
|
-
"wechaty-puppet-padlocal": "^1.20.1"
|
|
62
|
+
"wechaty": "^1.20.2"
|
|
64
63
|
},
|
|
65
64
|
"readme": "README.md",
|
|
66
65
|
"engines": {
|
|
@@ -69,8 +68,9 @@ exports.packageJson = {
|
|
|
69
68
|
},
|
|
70
69
|
"dependencies": {
|
|
71
70
|
"axios": "^0.27.2",
|
|
72
|
-
"chatgpt": "^5.0.
|
|
71
|
+
"chatgpt": "^5.0.5",
|
|
73
72
|
"dayjs": "^1.11.7",
|
|
73
|
+
"https-proxy-agent": "^5.0.1",
|
|
74
74
|
"isomorphic-fetch": "^3.0.0",
|
|
75
75
|
"ix": "^4.5.2",
|
|
76
76
|
"jsonwebtoken": "^8.5.1",
|
|
@@ -155,7 +155,7 @@ async function getConfig() {
|
|
|
155
155
|
let content = await (0, superagent_js_1.aiBotReq)(option);
|
|
156
156
|
const config = JSON.parse(content.data.config);
|
|
157
157
|
const cloudRoom = await getWordCloudRoom();
|
|
158
|
-
let cres = await (0, configDb_js_1.updateConfig)({ puppetType: 'wechaty-puppet-wechat', botScope: 'all', parseMini: false, countDownTaskSchedule: [], parseMiniRooms: [], preventLength: 1000, ...config, cloudRoom });
|
|
158
|
+
let cres = await (0, configDb_js_1.updateConfig)({ puppetType: 'wechaty-puppet-wechat', botScope: 'all', parseMini: false, proxyUrl: '', countDownTaskSchedule: [], parseMiniRooms: [], preventLength: 1000, ...config, cloudRoom });
|
|
159
159
|
return cres;
|
|
160
160
|
}
|
|
161
161
|
catch (e) {
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.geGPT3Reply = exports.initGpt = exports.initChatGPT = void 0;
|
|
4
7
|
const configDb_js_1 = require("../db/configDb.js");
|
|
5
8
|
const chatgpt_1 = require("chatgpt");
|
|
9
|
+
const https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
|
|
10
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
6
11
|
let chatGPT = null;
|
|
7
12
|
let chatOption = {};
|
|
8
13
|
async function initChatGPT() {
|
|
@@ -12,9 +17,28 @@ async function initChatGPT() {
|
|
|
12
17
|
return [{ type: 1, content: '请到平台配置Openai apikey参数方可使用' }];
|
|
13
18
|
}
|
|
14
19
|
console.log('config.gpttoken', config.gpttoken);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
if (config.proxyUrl) {
|
|
21
|
+
console.log(`启用代理请求:${config.proxyUrl}`);
|
|
22
|
+
chatGPT = new chatgpt_1.ChatGPTAPI({
|
|
23
|
+
apiKey: config.gpttoken,
|
|
24
|
+
fetch: (url, options = {}) => {
|
|
25
|
+
const defaultOptions = {
|
|
26
|
+
agent: (0, https_proxy_agent_1.default)(config.proxyUrl),
|
|
27
|
+
};
|
|
28
|
+
const mergedOptions = {
|
|
29
|
+
...defaultOptions,
|
|
30
|
+
...options,
|
|
31
|
+
};
|
|
32
|
+
return (0, node_fetch_1.default)(url, mergedOptions);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
console.log('未启用代理请求,可能会失败');
|
|
38
|
+
chatGPT = new chatgpt_1.ChatGPTAPI({
|
|
39
|
+
apiKey: config.gpttoken,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
18
42
|
}
|
|
19
43
|
exports.initChatGPT = initChatGPT;
|
|
20
44
|
/**
|
|
@@ -42,7 +42,6 @@ export namespace packageJson {
|
|
|
42
42
|
"npm-run-all": string;
|
|
43
43
|
prettier: string;
|
|
44
44
|
wechaty: string;
|
|
45
|
-
"wechaty-puppet-padlocal": string;
|
|
46
45
|
};
|
|
47
46
|
const readme: string;
|
|
48
47
|
namespace engines {
|
|
@@ -53,6 +52,7 @@ export namespace packageJson {
|
|
|
53
52
|
axios: string;
|
|
54
53
|
chatgpt: string;
|
|
55
54
|
dayjs: string;
|
|
55
|
+
"https-proxy-agent": string;
|
|
56
56
|
"isomorphic-fetch": string;
|
|
57
57
|
ix: string;
|
|
58
58
|
jsonwebtoken: string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const packageJson = {
|
|
5
5
|
"name": "wechaty-web-panel",
|
|
6
|
-
"version": "1.4.
|
|
6
|
+
"version": "1.4.14",
|
|
7
7
|
"description": "智能微秘书插件",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
@@ -56,8 +56,7 @@ export const packageJson = {
|
|
|
56
56
|
"eslint-plugin-prettier": "^3.1.4",
|
|
57
57
|
"npm-run-all": "^4.1.5",
|
|
58
58
|
"prettier": "^2.0.5",
|
|
59
|
-
"wechaty": "^1.20.2"
|
|
60
|
-
"wechaty-puppet-padlocal": "^1.20.1"
|
|
59
|
+
"wechaty": "^1.20.2"
|
|
61
60
|
},
|
|
62
61
|
"readme": "README.md",
|
|
63
62
|
"engines": {
|
|
@@ -66,8 +65,9 @@ export const packageJson = {
|
|
|
66
65
|
},
|
|
67
66
|
"dependencies": {
|
|
68
67
|
"axios": "^0.27.2",
|
|
69
|
-
"chatgpt": "^5.0.
|
|
68
|
+
"chatgpt": "^5.0.5",
|
|
70
69
|
"dayjs": "^1.11.7",
|
|
70
|
+
"https-proxy-agent": "^5.0.1",
|
|
71
71
|
"isomorphic-fetch": "^3.0.0",
|
|
72
72
|
"ix": "^4.5.2",
|
|
73
73
|
"jsonwebtoken": "^8.5.1",
|
|
@@ -146,7 +146,7 @@ async function getConfig() {
|
|
|
146
146
|
let content = await aiBotReq(option);
|
|
147
147
|
const config = JSON.parse(content.data.config);
|
|
148
148
|
const cloudRoom = await getWordCloudRoom();
|
|
149
|
-
let cres = await updateConfig({ puppetType: 'wechaty-puppet-wechat', botScope: 'all', parseMini: false, countDownTaskSchedule: [], parseMiniRooms: [], preventLength: 1000, ...config, cloudRoom });
|
|
149
|
+
let cres = await updateConfig({ puppetType: 'wechaty-puppet-wechat', botScope: 'all', parseMini: false, proxyUrl: '', countDownTaskSchedule: [], parseMiniRooms: [], preventLength: 1000, ...config, cloudRoom });
|
|
150
150
|
return cres;
|
|
151
151
|
}
|
|
152
152
|
catch (e) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { allConfig } from "../db/configDb.js";
|
|
2
2
|
import { ChatGPTAPI } from 'chatgpt';
|
|
3
|
+
import proxy from "https-proxy-agent";
|
|
4
|
+
import nodeFetch from "node-fetch";
|
|
3
5
|
let chatGPT = null;
|
|
4
6
|
let chatOption = {};
|
|
5
7
|
export async function initChatGPT() {
|
|
@@ -9,9 +11,28 @@ export async function initChatGPT() {
|
|
|
9
11
|
return [{ type: 1, content: '请到平台配置Openai apikey参数方可使用' }];
|
|
10
12
|
}
|
|
11
13
|
console.log('config.gpttoken', config.gpttoken);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
if (config.proxyUrl) {
|
|
15
|
+
console.log(`启用代理请求:${config.proxyUrl}`);
|
|
16
|
+
chatGPT = new ChatGPTAPI({
|
|
17
|
+
apiKey: config.gpttoken,
|
|
18
|
+
fetch: (url, options = {}) => {
|
|
19
|
+
const defaultOptions = {
|
|
20
|
+
agent: proxy(config.proxyUrl),
|
|
21
|
+
};
|
|
22
|
+
const mergedOptions = {
|
|
23
|
+
...defaultOptions,
|
|
24
|
+
...options,
|
|
25
|
+
};
|
|
26
|
+
return nodeFetch(url, mergedOptions);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
console.log('未启用代理请求,可能会失败');
|
|
32
|
+
chatGPT = new ChatGPTAPI({
|
|
33
|
+
apiKey: config.gpttoken,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
15
36
|
}
|
|
16
37
|
/**
|
|
17
38
|
* 重置apikey
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wechaty-web-panel",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.14",
|
|
4
4
|
"description": "智能微秘书插件",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -53,8 +53,7 @@
|
|
|
53
53
|
"eslint-plugin-prettier": "^3.1.4",
|
|
54
54
|
"npm-run-all": "^4.1.5",
|
|
55
55
|
"prettier": "^2.0.5",
|
|
56
|
-
"wechaty": "^1.20.2"
|
|
57
|
-
"wechaty-puppet-padlocal": "^1.20.1"
|
|
56
|
+
"wechaty": "^1.20.2"
|
|
58
57
|
},
|
|
59
58
|
"readme": "README.md",
|
|
60
59
|
"engines": {
|
|
@@ -63,8 +62,9 @@
|
|
|
63
62
|
},
|
|
64
63
|
"dependencies": {
|
|
65
64
|
"axios": "^0.27.2",
|
|
66
|
-
"chatgpt": "^5.0.
|
|
65
|
+
"chatgpt": "^5.0.5",
|
|
67
66
|
"dayjs": "^1.11.7",
|
|
67
|
+
"https-proxy-agent": "^5.0.1",
|
|
68
68
|
"isomorphic-fetch": "^3.0.0",
|
|
69
69
|
"ix": "^4.5.2",
|
|
70
70
|
"jsonwebtoken": "^8.5.1",
|