feat: support options strength and noise, fix #24

This commit is contained in:
Shigma 2022-10-11 15:58:19 +08:00
parent a474322fbb
commit 5e9db20e33
No known key found for this signature in database
GPG Key ID: 21C89B0B92907E14
3 changed files with 11 additions and 7 deletions

View File

@ -1,7 +1,7 @@
{
"name": "koishi-plugin-novelai",
"description": "Generate images by NovelAI",
"version": "1.6.1",
"version": "1.6.2",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [

View File

@ -120,6 +120,8 @@ export function apply(ctx: Context, config: Config) {
.option('seed', '-x <seed:number>')
.option('steps', '-t <step:number>', { hidden })
.option('scale', '-c <scale:number>')
.option('noise', '-n <noise:number>', { hidden })
.option('strength', '-N <strength:number>', { hidden })
.option('anatomy', '-a, --strict-anatomy', { value: true, hidden: () => config.anatomy })
.option('anatomy', '-A, --loose-anatomy', { value: false, hidden: () => !config.anatomy })
.action(async ({ session, options }, input) => {
@ -212,16 +214,16 @@ export function apply(ctx: Context, config: Config) {
Object.assign(parameters, {
height: size.height * 1.5,
width: size.width * 1.5,
noise: 0,
strength: 0.2,
noise: options.noise ?? 0,
strength: options.strength ?? 0.2,
})
} else {
const orient = resizeInput(size)
Object.assign(parameters, {
height: orient.height,
width: orient.width,
noise: 0.2,
strength: 0.7,
noise: options.noise ?? 0.2,
strength: options.strength ?? 0.7,
})
}
} else {
@ -230,8 +232,8 @@ export function apply(ctx: Context, config: Config) {
width: orient.width,
scale: options.scale ?? 12,
steps: options.steps ?? 28,
noise: 0.2,
strength: 0.7,
noise: options.noise ?? 0.2,
strength: options.strength ?? 0.7,
})
}

View File

@ -16,6 +16,8 @@ commands:
seed: 设置随机种子
steps: 设置迭代步数
scale: 设置对输入的服从度
strength: 图片修改幅度
noise: 图片噪声强度
messages:
expect-prompt: 请输入标签。