From 49d21dba96adec5e39e1437dd596d939c4116e11 Mon Sep 17 00:00:00 2001 From: Shigma Date: Tue, 25 Oct 2022 01:03:48 +0800 Subject: [PATCH] fix: should be consistent with website --- package.json | 2 +- src/config.ts | 16 +++++----------- src/index.ts | 12 +++++++----- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index af2bc94..80b4291 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-novelai", "description": "Generate images by NovelAI", - "version": "1.11.8", + "version": "1.11.9", "main": "lib/index.js", "typings": "lib/index.d.ts", "files": [ diff --git a/src/config.ts b/src/config.ts index a33d2b5..cac90ca 100644 --- a/src/config.ts +++ b/src/config.ts @@ -13,16 +13,10 @@ export const orientMap = { square: { height: 640, width: 640 }, } as const -const lowQuality = [ - 'nsfw, text, cropped, jpeg artifacts, signature, watermark, username, blurry', - 'lowres, polar lores, worst quality, low quality, normal quality', -].join(', ') - -const badAnatomy = [ - 'bad anatomy, error, long neck, cross-eyed, mutation, deformed', - 'bad hands, bad feet, malformed limbs, fused fingers, mutated hands', - 'missing fingers, fewer digits, to many fingers, extra fingers, extra digit, extra limbs, extra arms, extra legs', - 'poorly drawn hands, poorly drawn face, poorly drawn limbs', +const ucPreset = [ + 'nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers', + 'extra digit, fewer digits, cropped, worst quality, low quality', + 'normal quality, jpeg artifacts, signature, watermark, username, blurry', ].join(', ') type Model = keyof typeof modelMap @@ -175,7 +169,7 @@ export const Config = Schema.intersect([ Schema.const('verbose').description('发送全部信息'), ]).description('输出方式。').default('default'), basePrompt: Schema.string().role('textarea').description('默认附加的标签。').default('masterpiece, best quality'), - negativePrompt: Schema.string().role('textarea').description('默认附加的反向标签。').default([lowQuality, badAnatomy].join(', ')), + negativePrompt: Schema.string().role('textarea').description('默认附加的反向标签。').default(ucPreset), forbidden: Schema.string().role('textarea').description('违禁词列表。含有违禁词的请求将被拒绝。').default(''), maxRetryCount: Schema.natural().description('连接失败时最大的重试次数。').default(3), requestTimeout: Schema.number().role('time').description('当请求超过这个时间时会中止并提示超时。').default(Time.minute), diff --git a/src/index.ts b/src/index.ts index 750df4e..593b63b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -140,7 +140,11 @@ export function apply(ctx: Context, config: Config) { prompt, n_samples: 1, uc, - ucPreset: 0, + // 0: low quality + bad anatomy + // 1: low quality + // 2: none + ucPreset: 2, + qualityToggle: false, } if (imgUrl) { @@ -184,10 +188,8 @@ export function apply(ctx: Context, config: Config) { Object.assign(parameters, { height: options.resolution.height, width: options.resolution.width, - scale: options.scale ?? 12, + scale: options.scale ?? 11, steps: options.steps ?? 28, - noise: options.noise ?? 0.2, - strength: options.strength ?? 0.7, }) } @@ -329,7 +331,7 @@ export function apply(ctx: Context, config: Config) { ctx.accept(['model', 'orient', 'sampler'], (config) => { cmd._options.model.fallback = config.model - cmd._options.resolution.fallback = config.orient + cmd._options.resolution.fallback = orientMap[config.orient] cmd._options.sampler.fallback = config.sampler cmd._options.sampler.type = Object.keys(config.type === 'sd-webui' ? sampler.sd : sampler.nai) }, { immediate: true })