-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathguoba.support.js
More file actions
executable file
·294 lines (289 loc) · 8.24 KB
/
guoba.support.js
File metadata and controls
executable file
·294 lines (289 loc) · 8.24 KB
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
import Cfg from './model/Cfg.js'
export function supportGuoba() {
return {
pluginInfo: {
name: 'Chat-plugin',
title: 'Chat-plugin',
author: '@天如',
authorLink: 'https://gitee.com/HDTianRu',
link: 'https://gitee.com/HDTianRu/Chat-plugin',
isV3: true,
isV2: false,
description: '简洁的AI聊天插件',
icon: 'mdi:cat',
iconColor: '#6bb9dd',
},
configInfo: {
schemas: [{
label: 'API 配置',
component: 'SOFT_GROUP_BEGIN'
},
{
field: 'apiUrl',
label: 'API 地址',
bottomHelpMessage: '填写 OpenAI 兼容 API 的基础地址',
component: "Input",
componentProps: {
placeholder: "https://api.deepseek.com/v1"
}
}, {
field: 'apiKey',
label: 'API Key',
bottomHelpMessage: '填写 API 的密钥,支持逗号分隔多个key',
component: "InputPassword",
componentProps: {
placeholder: "sk-******"
}
}, {
field: 'model',
label: 'AI 模型',
bottomHelpMessage: '使用的 AI 模型名称',
component: "Input",
componentProps: {
placeholder: "deepseek-chat"
}
}, {
field: 'attempt_max',
label: '重试次数',
bottomHelpMessage: '调用API出错时,最多重试的次数',
component: "InputNumber",
componentProps: {
min: 0,
max: 1145,
step: 1,
placeholder: "2"
}
},
{
label: '基本配置',
component: 'SOFT_GROUP_BEGIN'
},
...basicCfg(),
{
field: 'special',
label: 'BOT:群聊特定配置',
bottomHelpMessage: '为特定BOT/群聊设置独立的配置参数,格式为 BOT账号:群号 ,如只指定一项,另一项则用 * 代替,比如: 3291691454:* ,优先级: BOT:群 > *:群 > BOT:* > 通用配置',
component: 'GSubForm',
componentProps: {
multiple: true,
schemas: [{
field: 'key',
label: 'BOT:群号',
component: "Input",
required: true
},
...basicCfg()
],
}
},
/*{
label: '伪人配置',
component: 'SOFT_GROUP_BEGIN'
},*/
{
label: '黑白名单设置',
component: 'SOFT_GROUP_BEGIN'
},
{
field: "botWhitelistQQ",
label: "机器人QQ白名单",
bottomHelpMessage: "只有这些QQ号的机器人才会使用AI响应消息, 留空则不启用白名单",
component: "GTags",
componentProps: {
allowAdd: true,
allowDel: true,
valueFormatter: ((value) => Number.parseInt(value)).toString()
}
},
{
field: "botBlacklistQQ",
label: "机器人QQ黑名单",
bottomHelpMessage: "这些QQ号的机器人不会使用AI响应消息, 白名单优先",
component: "GTags",
componentProps: {
allowAdd: true,
allowDel: true,
valueFormatter: ((value) => Number.parseInt(value)).toString()
}
},
{
field: "pseudoWhitelistQQ",
label: "伪人QQ白名单",
bottomHelpMessage: "只对这些QQ号启用伪人模式, 留空则不启用白名单",
component: "GTags",
componentProps: {
allowAdd: true,
allowDel: true,
valueFormatter: ((value) => Number.parseInt(value)).toString()
}
},
{
field: "pseudoBlacklistQQ",
label: "伪人QQ黑名单",
bottomHelpMessage: "对这些QQ号禁用伪人模式, 白名单优先",
component: "GTags",
componentProps: {
allowAdd: true,
allowDel: true,
valueFormatter: ((value) => Number.parseInt(value)).toString()
}
},
{
field: "pseudoWhitelistGroup",
label: "伪人群组白名单",
bottomHelpMessage: "只在这些群组启用伪人模式, 留空则不启用白名单",
component: "GSelectGroup"
},
{
field: "pseudoBlacklistGroup",
label: "伪人群组黑名单",
bottomHelpMessage: "在这些群组禁用伪人模式, 白名单优先",
component: "GSelectGroup"
},
],
getConfigData() {
return Cfg.getAll()
},
setConfigData(data, {
Result
}) {
for (let [keyPath, value] of Object.entries(data)) {
Cfg._set(keyPath, value)
}
Cfg.save()
return Result.ok({}, '保存成功喵~')
},
},
}
}
function basicCfg() {
return [{
field: 'aiName',
label: 'AI名称 (支持正则)',
bottomHelpMessage: '提到此名称会触发 AI 回复',
component: "Input",
componentProps: {
placeholder: "猫娘"
}
}, {
field: 'temperature',
label: '温度设置 (主动)',
bottomHelpMessage: '控制主动回复的随机性 (0.1 ~ 2.0)',
component: "InputNumber",
componentProps: {
min: 0.1,
max: 2,
step: 0.1,
placeholder: "0.7"
}
}, {
field: 'maxTokens',
label: '最大Token数 (主动)',
bottomHelpMessage: '控制主动回复的最大长度',
component: "InputNumber",
componentProps: {
min: 64,
max: 65536,
placeholder: "4096"
}
}, {
field: 'prompt',
label: 'Prompt 设置',
bottomHelpMessage: '系统 Prompt 设置,定义 AI 的行为和角色',
component: "InputTextArea",
componentProps: {
placeholder: "你是一个猫娘..."
}
}, {
field: 'enableName',
label: '启用名字触发',
bottomHelpMessage: '检测消息包含ai名字则回复',
component: "Switch"
}, {
field: 'enableAt',
label: '启用艾特回复',
bottomHelpMessage: '是否在被艾特时回复',
component: "Switch"
}, {
field: 'enablePrivate',
label: '启用私聊',
bottomHelpMessage: '是否允许在私聊中使用',
component: "Switch"
}, {
field: 'thinking',
label: '提示正在思考中',
bottomHelpMessage: '主动模式先回一句正在思考中',
component: "Switch"
}, {
field: 'delay',
label: '伪人随机延迟',
bottomHelpMessage: '格式: 下限-上限 (单位ms),如 500-1000',
component: "Input"
}, {
field: 'historyCount',
label: '聊天记录条数',
bottomHelpMessage: '对话时附加的最近聊天记录条数 (0 ~ 50)',
component: "InputNumber",
componentProps: {
min: 0,
max: 50,
placeholder: "10"
}
}, {
field: 'cacheExpireMinutes',
label: '缓存过期时间(分钟)',
bottomHelpMessage: '对话缓存过期时间 (1 ~ 1440)',
component: "InputNumber",
componentProps: {
min: 1,
max: 1440,
placeholder: "30"
}
}, {
field: 'maxContextLength',
label: '最大上下文长度',
bottomHelpMessage: '缓存中最多保留的对话消息数量 (1 ~ 50)',
component: "InputNumber",
componentProps: {
min: 1,
max: 50,
placeholder: "10"
}
}, {
field: 'enablePseudoHuman',
label: '启用伪人模式',
bottomHelpMessage: '是否在群聊中随机回复消息',
component: "Switch"
}, {
field: 'pseudoHumanProbability',
label: '伪人模式概率 (%)',
bottomHelpMessage: '伪人模式触发的概率 (0-100)',
component: "InputNumber",
componentProps: {
min: 0,
max: 100,
placeholder: "5"
}
}, {
field: 'pseudoTemperature',
label: '温度设置 (伪人)',
bottomHelpMessage: '控制伪人模式回复的随机性 (0.1 ~ 2.0)',
component: "InputNumber",
componentProps: {
min: 0.1,
max: 2,
step: 0.1,
placeholder: "0.85"
}
}, {
field: 'pseudoMaxTokens',
label: '最大Token数 (伪人)',
bottomHelpMessage: '控制伪人模式回复的最大长度',
component: "InputNumber",
componentProps: {
min: 10,
max: 1024,
placeholder: "128"
}
}]
}