-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathguoba.support.js
509 lines (482 loc) · 13.1 KB
/
guoba.support.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
import path from "path";
import setting from "./model/setting.js";
import lodash from "lodash";
import { readAndParseJSON } from './utils/getdate.js'
const _path = process.cwd() + "/plugins/logier-plugin";
const EmojiIndexs = await readAndParseJSON('../data/EmojiIndex.json');
let EmojiIndex = Object.keys(EmojiIndexs).map(k => ({label: k, value: k}));
EmojiIndex.push({label: '自定义', value: '自定义'});
const EmojiIndexex = [{label: '表情包仓库', value: '表情包仓库'} , ...EmojiIndex];
const personalitys = await readAndParseJSON('../data/personality.json');
let personality = Object.keys(personalitys).map(k => ({label: k, value: k}));
export function supportGuoba() {
let allGroup = [];
Bot.gl.forEach((v, k) => { allGroup.push({label: `${v.group_name}(${k})`, value: k}); });
allGroup.push({label: 'default', value: 'default'});
let setimage = [{label: `定时发图`, value: `定时发图`},{label: `今日运势`, value: `今日运势`},{label: `算一卦`, value: `算一卦`},{label: `今日签到`, value: `今日签到`},{label: `城市天气`, value: `城市天气`},{label: `default`, value: `default`}]
let push = [{label: `定时发图`, value: `定时发图`},{label: `摸鱼日历`, value: `摸鱼日历`},{label: `今日新闻`, value: `今日新闻`},{label: `今日番剧`, value: `今日番剧`},{label: `订阅小说`, value: `订阅小说`}]
return {
pluginInfo: {
name: "鸢尾花插件",
title: "鸢尾花插件(logier-plugin)",
author: "@logier",
authorLink: "https://gitee.com/logier",
link: "https://gitee.com/logier/logier-plugins",
isV3: true,
isV2: false,
description: "表情包仓库、定时系列和运势系列",
icon: "mdi:stove",
iconColor: "#d19f56",
iconPath: path.join(_path, "resources/img/-zue37Q5-e39pZlT3cSiw-il.jpeg"),
},
// 配置项信息
configInfo: {
// 配置项 schemas
schemas: [
{
component: 'Divider',
label: '表情包黑名单'
},
{
field: "EmojiHub.BlackList",
label: "黑名单配置",
bottomHelpMessage: '屏蔽你不想要的表情包类别',
component: "GSubForm",
componentProps: {
multiple: true,
schemas: [
{
field: "group",
label: "群号",
bottomHelpMessage: '未配置的群使用default设置',
component: 'Select',
componentProps: {
options: allGroup,
},
},
{
field: 'Emojiindexs',
label: '黑名单',
bottomHelpMessage: '指令触发和仓库内随机都会屏蔽',
component: 'Select',
componentProps: {
allowAdd: true,
allowDel: true,
mode: 'multiple',
options: EmojiIndex,
},
},
],
},
},
{
component: 'Divider',
label: '表情包小偷设置'
},
{
field: "EmojiThief.ETGroupRate",
label: "群配置",
bottomHelpMessage: '表情包小偷分群配置发图概率',
component: "GSubForm",
componentProps: {
multiple: true,
schemas: [
{
field: 'groupList',
label: '随机表情包群号',
bottomHelpMessage: '不配置所有群都会发,配置了就只会在配置的群发送',
component: 'GSelectGroup',
},
{
field: 'rate',
label: '随机发图概率',
bottomHelpMessage: '随机发图概率,推荐0.05',
component: "Slider",
componentProps: {
min: 0,
max: 1,
step: 0.01,
},
},
{
field: 'EmojiRate',
label: '表情包仓库概率',
bottomHelpMessage: '使用表情包仓库发图的概率',
component: "Slider",
componentProps: {
min: 0,
max: 1,
step: 0.1,
},
},
],
},
},
{
field: 'EmojiThief.DefalutReplyRate',
label: '默认概率',
bottomHelpMessage: '不配置群时使用此概率',
component: "Slider",
componentProps: {
min: 0,
max: 1,
step: 0.01,
},
},
{
field: 'EmojiThief.DefalutEmojiRate',
label: '仓库概率',
bottomHelpMessage: '使用表情包仓库发图的默认概率,如果偷的图比较少推荐拉高点,减少发图重复',
component: "Slider",
componentProps: {
min: 0,
max: 1,
step: 0.1,
},
},
{
field: 'EmojiThief.ETEmojihubCategory',
label: '图类',
bottomHelpMessage: '使用表情包仓库时的表情包种类',
component: 'Select',
componentProps: {
allowAdd: true,
allowDel: true,
options: EmojiIndexex,
},
},
{
component: 'Divider',
label: 'GPT相关设置'
},
{
field: 'GPTconfig.GPTKey',
label: 'key',
bottomHelpMessage: '请前往https://github.com/chatanywhere/GPT_API_free获得',
component: 'InputPassword',
componentProps: {
placeholder: 'GPTkey',
},
},
{
field: 'GPTconfig.DefaultPersonalitySwitch',
label: '预设开关',
bottomHelpMessage: '开启则使用预设人格',
component: 'Switch',
},
{
field: 'GPTconfig.DefaultPersonality',
label: '预设人格',
bottomHelpMessage: '挑一个你喜欢的',
component: 'Select',
componentProps: {
options: personality,
},
},
{
field: "GPTconfig.CustomPersonality",
label: "自定义人格",
bottomHelpMessage: "关闭预设人格后将使用自定义人格,",
component: "GSubForm",
componentProps: {
multiple: true,
schemas: [
{
field: 'role',
label: 'role',
component: 'Select',
bottomHelpMessage: '不懂是什么意思就全用system',
componentProps: {
options: [
{label: 'system' ,value : 'system'},
{label: 'assistant',value : 'assistant'},
{label: 'user',value : 'user'},
],
}},
{
field: "content",
label: "content",
bottomHelpMessage: '对话内容',
component: "Input",
mode: 'tags',
required: true,
},
],
},
},
{
component: 'Divider',
label: '推送相关设置'
},
{
field: "Push.Push",
label: "推送",
bottomHelpMessage: '设定推送功能',
component: "GSubForm",
componentProps: {
multiple: true,
schemas: [
{
field: "FunctionName",
label: "功能",
component: 'Select',
componentProps: {
options: push,
},
},
{
field: 'isAutoPush',
label: '推送开关',
component: 'Switch'
},
{
field: 'PushTime',
label: '推送时间',
bottomHelpMessage: '推送时间,使用cron表达式',
component: 'Input',
},
{
field: 'PushGroupList',
label: '推送群号',
bottomHelpMessage: '推送群号',
component: 'GSelectGroup',
},
],
},
},
{
component: 'Divider',
label: '天气相关设置'
},
{
field: 'Weather.WeatherKey',
label: 'key',
bottomHelpMessage: '和风天气key,请前往https://console.qweather.com/#/console获得',
component: 'InputPassword',
},
{
field: 'Weather.WeatherPushSwitch',
label: '推送开关',
bottomHelpMessage: '是否推送天气',
component: 'Switch'
},
{
field: 'Weather.WeatherPushTime',
label: '推送时间',
bottomHelpMessage: '推送天气时间,使用cron表达式',
component: 'Input',
},
{
field: "Weather.WeatherPushgroup",
label: "群配置",
bottomHelpMessage: '分群配置天气推送城市',
component: "GSubForm",
componentProps: {
multiple: true,
schemas: [
{
field: 'group',
label: '推送群号',
component: 'GSelectGroup',
},
{
field: 'city',
label: '推送城市',
component: 'Input',
},
],
},
},
{
component: 'Divider',
label: '图源相关设置'
},
{
field: "Urls.Urls",
label: "图源",
component: "GSubForm",
bottomHelpMessage: '设置不同功能使用的图源',
componentProps: {
multiple: true,
schemas: [
{
field: "FunctionName",
label: "功能",
component: 'Select',
bottomHelpMessage: '如果没有配置就使用default图源',
componentProps: {
options: setimage,
},
},
{
field: "imageUrls",
label: "图片链接",
bottomHelpMessage: '自定义图源地址,支持本地文件夹和网络',
component: 'GTags',
componentProps: {
allowAdd: true,
allowDel: true,
},
},
],
},
},
{
component: 'Divider',
label: '自定义指令图片api相关设置'
},
{
field: "CustomApi.CustomApi",
label: "自定义api",
component: "GSubForm",
bottomHelpMessage: '自定义指令发送不同的图片api',
componentProps: {
multiple: true,
schemas: [
{
field: "FunctionName",
label: "指令",
bottomHelpMessage: '自定义指令,支持正则',
component: 'Input',
},
{
field: "imageUrls",
label: "api地址",
bottomHelpMessage: '自定义图源地址,支持网络何本地文件夹',
component: 'GTags',
componentProps: {
allowAdd: true,
allowDel: true,
},
},
],
},
},
{
component: 'Divider',
label: '潜伏模板设置'
},
{
field: 'Customize.CustomizeRate',
label: '回复概率',
bottomHelpMessage: '收到群聊消息后,随机gpt回复的概率',
component: "Slider",
componentProps: {
min: 0,
max: 1,
step: 0.01,
},
},
{
field: 'Customize.CustomizeEmojiCategory',
label: '图类',
bottomHelpMessage: '随机回复后发送的表情包类别',
component: 'Select',
componentProps: {
allowAdd: true,
allowDel: true,
options: EmojiIndexex,
},
},
{
component: 'Divider',
label: '表情包仓库设置'
},
{
field: 'Config.CustomerRate',
label: '自定义表情几率',
bottomHelpMessage: '发送表情包时使用自定义表情包的概率,当表情包仓库类别为“表情包仓库”时有效',
component: "Slider",
componentProps: {
min: 0,
max: 1,
step: 0.01,
},
},
{
field: 'Config.CustomeEmoji',
label: '自定义表情地址',
bottomHelpMessage: '自定义表情包地址,支持本地文件夹和网络',
component: 'GTags',
componentProps: {
allowAdd: true,
allowDel: true,
},
},
{
component: 'Divider',
label: '戳一戳表情包设置'
},
{
field: 'Config.PokeEmojiRate',
label: '戳戳GPT',
helpMessage: '如果gpt请求失败,会转为回复表情包',
bottomHelpMessage: '戳一戳时,使用gpt回复的概率',
component: "Slider",
componentProps: {
min: 0,
max: 1,
step: 0.1,
},
},
{
field: 'Config.PokeEmojiCategory',
label: '戳一戳表情包',
helpMessage: '“表情包仓库”就是全随机',
bottomHelpMessage: '戳一戳表情包回复时使用的表情包种类',
component: 'Select',
componentProps: {
allowAdd: true,
allowDel: true,
options: EmojiIndexex,
},
},
{
component: 'Divider',
label: '保存图片设置'
},
{
field: 'Config.EmojiPath',
label: '表情保存地址',
bottomHelpMessage: '表情包保存地址',
component: 'Input',
},
{
field: 'Config.SetuPath',
label: '涩图保存地址',
bottomHelpMessage: '涩图保存地址',
component: 'Input',
},
{
component: 'Divider',
label: 'GPT请求设置'
},
{
field: 'GPTconfig.GPTModel',
label: '模型',
bottomHelpMessage: 'gpt模型,chatanywhere免费key最高只支持gpt-3.5-turbo',
component: 'Input',
},
{
field: 'GPTconfig.GPTUrl',
label: '地址',
bottomHelpMessage: '使用openai官方key请修改为https://gpt.lucent.blog/v1/chat/completions',
component: 'Input',
},
],
getConfigData () {
return setting.merge()
},
// 设置配置的方法(前端点确定后调用的方法)
setConfigData (data, { Result }) {
let config = {}
for (let [keyPath, value] of Object.entries(data)) {
lodash.set(config, keyPath, value)
}
config = lodash.merge({}, setting.merge, config)
setting.analysis(config)
return Result.ok({}, '保存成功~')
}
}
}
}