-
Notifications
You must be signed in to change notification settings - Fork 2
/
guoba.support.js
221 lines (219 loc) · 6.18 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
import Config from "./components/Config.js";
import lodash from "lodash";
import path from "path";
import { pluginRoot } from "./model/path.js";
export function supportGuoba() {
return {
pluginInfo: {
name: 'mj-plugin',
title: 'AI绘制插件',
author: ['@CikeyQi', '@erzaozi'],
authorLink: ['https://github.com/CikeyQi', 'https://github.com/erzaozi'],
link: 'https://github.com/CikeyQi/mj-plugin',
isV3: true,
isV2: false,
showInMenu: true,
description: '基于 Yunzai 的 AI 绘图插件,使用 Midjourney 接口',
// 显示图标,此为个性化配置
// 图标可在 https://icon-sets.iconify.design 这里进行搜索
icon: 'icon-park:sailboat',
// 图标颜色,例:#FF0000 或 rgb(255, 0, 0)
iconColor: '#fffbf0',
// 如果想要显示成图片,也可以填写图标路径(绝对路径)
iconPath: path.join(pluginRoot, 'resources/readme/girl.png'),
},
configInfo: {
schemas: [
{
component: "Divider",
label: "Discord 相关配置",
componentProps: {
orientation: "left",
plain: true,
},
},
{
field: "server_id",
label: "服务器ID",
bottomHelpMessage: "Discord服务器ID",
component: "Input",
componentProps: {
placeholder: 'Server ID',
maxlength: 19,
},
},
{
field: "channel_id",
label: "频道ID",
bottomHelpMessage: "Discord频道ID",
component: "Input",
componentProps: {
placeholder: 'Channel ID',
maxlength: 19,
},
},
{
field: "salai_token",
label: "Discord Token",
bottomHelpMessage: "Discord身份验证Token",
component: "InputPassword",
componentProps: {
placeholder: 'Salai Token',
visible: false,
},
},
{
component: "Divider",
label: "Bot 相关配置",
componentProps: {
orientation: "left",
plain: true,
},
},
{
field: "bot_type",
label: "Bot类型选择",
component: "Select",
componentProps: {
options: [
{ label: 'Midjourney Bot', value: 'Midjourney' },
{ label: 'niji・journey Bot', value: 'Nijijourney' },
],
},
},
{
component: "Divider",
label: "代理 相关配置",
componentProps: {
orientation: "left",
plain: true,
},
},
{
field: "proxy",
label: "使用代理",
component: "Switch",
},
{
field: "proxy_url",
label: "代理地址",
component: "Input",
componentProps: {
placeholder: 'Proxy URL',
},
},
{
component: "Divider",
label: "翻译 相关配置",
componentProps: {
orientation: "left",
plain: true,
},
},
{
field: "translate_use",
label: "使用翻译接口",
component: "Select",
componentProps: {
options: [
{ label: '椰奶有道', value: 0 },
{ label: '百度翻译(需配置)', value: 1 },
{ label: '有道翻译(需配置)', value: 2 },
],
},
},
{
field: "baidu_translate.appid",
label: "百度APP ID",
component: "Input",
componentProps: {
placeholder: "请输入百度翻译APPID",
maxlength: 17,
pattern: "^[0-9]*$",
visible: true,
},
},
{
field: "baidu_translate.appkey",
label: "百度Secret Key",
component: "InputPassword",
componentProps: {
placeholder: "请输入百度翻译APPKEY",
maxlength: 20,
visible: false,
},
},
{
field: "youdao_translate.appid",
label: "有道APP ID",
component: "Input",
componentProps: {
placeholder: "请输入有道翻译APPID",
maxlength: 16,
visible: true,
},
},
{
field: "youdao_translate.appkey",
label: "有道Secret Key",
component: "InputPassword",
componentProps: {
placeholder: "请输入有道翻译APPKEY",
maxlength: 32,
visible: false,
},
},
{
component: "Divider",
label: "其他 相关配置",
componentProps: {
orientation: "left",
plain: true,
},
},
{
field: "huggingface_token",
label: "Huggingface Token",
component: "Input",
componentProps: {
placeholder: 'HuggingFace Token',
},
},
{
field: "button_row",
label: "单行按钮数量",
component: "Select",
componentProps: {
options: [
{ label: '自适应', value: 0},
{ label: '一个按钮', value: 1 },
{ label: '两个按钮', value: 2 },
{ label: '三个按钮', value: 3 },
{ label: '四个按钮', value: 4 },
{ label: '五个按钮', value: 5 },
],
},
},
{
field: "debug",
label: "调试模式",
component: "Switch",
},
],
getConfigData() {
let config = Config.getConfig()
return config
},
setConfigData(data, { Result }) {
let config = {}
for (let [keyPath, value] of Object.entries(data)) {
lodash.set(config, keyPath, value)
}
config = lodash.merge({}, Config.getConfig(), config)
config.proxy_url = config.proxy_url.replace(/\/$/, '')
Config.setConfig(config)
return Result.ok({}, '保存成功~')
},
},
}
}