feat: support loose sd-compatible negative prompt syntax

This commit is contained in:
Shigma 2022-10-13 17:10:52 +08:00
parent 3f55e5c7ec
commit 1684f52ee5
No known key found for this signature in database
GPG Key ID: 21C89B0B92907E14
2 changed files with 3 additions and 3 deletions

View File

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

View File

@ -187,9 +187,9 @@ export function apply(ctx: Context, config: Config) {
// extract negative prompts
const undesired = [lowQuality]
if (options.anatomy ?? config.anatomy) undesired.push(badAnatomy)
const capture = input.match(/^negative prompt: ([\s\S]+)/m)
const capture = input.match(/(?:^|,\s*)negative prompts?:([\s\S]+)/m)
if (capture) {
input = input.slice(0, capture.index)
input = input.slice(0, capture.index).trim()
undesired.push(capture[1])
}