Skip to content

Commit

Permalink
fix: should be consistent with website
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Oct 24, 2022
1 parent 824d42b commit 49d21db
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
16 changes: 5 additions & 11 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down
12 changes: 7 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
})
}

Expand Down Expand Up @@ -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 })
Expand Down

0 comments on commit 49d21db

Please sign in to comment.