mirror of
https://github.com/koishijs/novelai-bot
synced 2025-01-09 04:37:54 +08:00
feat: allowAnlas now works for non-nai platforms
This commit is contained in:
parent
4ab0381112
commit
8d9d4d3957
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "koishi-plugin-novelai",
|
||||
"description": "Generate images by diffusion models",
|
||||
"version": "1.15.3",
|
||||
"version": "1.15.4",
|
||||
"main": "lib/index.js",
|
||||
"typings": "lib/index.d.ts",
|
||||
"files": [
|
||||
|
@ -121,23 +121,25 @@ export const PromptConfig: Schema<PromptConfig> = Schema.object({
|
||||
maxWords: Schema.natural().description('允许的最大单词数量。').default(0),
|
||||
}).description('输入设置')
|
||||
|
||||
export interface Config extends PromptConfig {
|
||||
type: 'token' | 'login' | 'naifu' | 'sd-webui'
|
||||
token?: string
|
||||
email?: string
|
||||
password?: string
|
||||
interface ParamConfig {
|
||||
model?: Model
|
||||
upscaler?: string
|
||||
resolution?: Orient | Size
|
||||
maxResolution?: number
|
||||
sampler?: string
|
||||
scale?: number
|
||||
textSteps?: number
|
||||
imageSteps?: number
|
||||
maxSteps?: number
|
||||
maxResolution?: number
|
||||
anatomy?: boolean
|
||||
}
|
||||
|
||||
export interface Config extends PromptConfig, ParamConfig {
|
||||
type: 'token' | 'login' | 'naifu' | 'sd-webui'
|
||||
token?: string
|
||||
email?: string
|
||||
password?: string
|
||||
output?: 'minimal' | 'default' | 'verbose'
|
||||
allowAnlas?: boolean | number
|
||||
upscaler?: string
|
||||
endpoint?: string
|
||||
headers?: Dict<string>
|
||||
maxIterations?: number
|
||||
@ -180,7 +182,7 @@ export const Config = Schema.intersect([
|
||||
Schema.const(true).description('允许'),
|
||||
Schema.const(false).description('禁止'),
|
||||
Schema.natural().description('权限等级').default(1),
|
||||
]).default(true).description('是否允许使用点数。禁用后部分功能 (图片增强和手动设置某些参数) 将无法使用。'),
|
||||
]).default(true).description('是否启用高级功能 (例如图片增强和手动设置某些参数)。'),
|
||||
}),
|
||||
]),
|
||||
Schema.object({
|
||||
@ -222,8 +224,8 @@ export const Config = Schema.intersect([
|
||||
Schema.const('landscape' as const).description('风景 (512x768)'),
|
||||
Schema.const('square' as const).description('方形 (640x640)'),
|
||||
Schema.object({
|
||||
width: Schema.natural().description('宽度。').default(640),
|
||||
height: Schema.natural().description('高度。').default(640),
|
||||
width: Schema.natural().description('图片宽度。').default(640),
|
||||
height: Schema.natural().description('图片高度。').default(640),
|
||||
}).description('自定义'),
|
||||
] as const).description('默认生成的图片尺寸。').default('portrait'),
|
||||
maxResolution: Schema.natural().description('允许生成的宽度和高度最大值。').default(0),
|
||||
|
@ -55,7 +55,6 @@ export function apply(ctx: Context, config: Config) {
|
||||
const thirdParty = () => !['login', 'token'].includes(config.type)
|
||||
|
||||
const restricted = (session: Session<'authority'>) => {
|
||||
if (thirdParty()) return false
|
||||
if (typeof config.allowAnlas === 'boolean') {
|
||||
return !config.allowAnlas
|
||||
} else {
|
||||
@ -94,7 +93,7 @@ export function apply(ctx: Context, config: Config) {
|
||||
.option('enhance', '-e', { hidden: restricted })
|
||||
.option('model', '-m <model>', { type: models, hidden: thirdParty })
|
||||
.option('resolution', '-r <resolution>', { type: resolution })
|
||||
.option('override', '-O')
|
||||
.option('override', '-O', { hidden: restricted })
|
||||
.option('sampler', '-s <sampler>')
|
||||
.option('seed', '-x <seed:number>')
|
||||
.option('steps', '-t <step>', { type: step, hidden: restricted })
|
||||
@ -130,6 +129,9 @@ export function apply(ctx: Context, config: Config) {
|
||||
} else {
|
||||
delete options.enhance
|
||||
delete options.steps
|
||||
delete options.noise
|
||||
delete options.strength
|
||||
delete options.override
|
||||
}
|
||||
|
||||
if (config.translator && ctx.translator && !options.noTranslator) {
|
||||
|
Loading…
Reference in New Issue
Block a user