feat: add baseTags option (#6)

Co-authored-by: Shigma <shigma10826@gmail.com>
This commit is contained in:
Shengming Yuan 2022-10-07 22:17:02 -04:00 committed by GitHub
parent 115364a193
commit 22ee6a8de4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -162,6 +162,13 @@ console.log(JSON.parse(localStorage.session).auth_token)
默认情况下是否过滤不良构图。
### baseTags
- 类型: `string`
- 默认值: `` (空字符串)
默认的附加标签。可以自定义一些常用的标签,例如 `best quality`, `masterpiece` 等。
### forbidden
- 类型:`string`

View File

@ -34,6 +34,7 @@ export interface Config {
orient?: Orient
sampler?: Sampler
anatomy?: boolean
baseTags?: string
forbidden?: string
endpoint?: string
requestTimeout?: number
@ -47,6 +48,7 @@ export const Config: Schema<Config> = Schema.object({
orient: Schema.union(orients).description('默认的图片方向。').default('portrait'),
sampler: Schema.union(samplers).description('默认的采样器。').default('k_euler_ancestral'),
anatomy: Schema.boolean().default(true).description('是否过滤不合理构图。'),
baseTags: Schema.string().description('默认的附加标签。').default(''),
endpoint: Schema.string().description('API 服务器地址。').default('https://api.novelai.net'),
forbidden: Schema.string().role('textarea').description('违禁词列表。含有违禁词的请求将被拒绝。').default(''),
requestTimeout: Schema.number().role('time').description('当请求超过这个时间时会中止并提示超时。').default(Time.minute * 0.5),
@ -101,6 +103,7 @@ export function apply(ctx: Context, config: Config) {
if (options.anatomy ?? config.anatomy) undesired.push(badAnatomy)
const seed = options.seed || Math.round(new Date().getTime() / 1000)
session.send(session.text('.waiting'))
input += config.baseTags ? ', ' + config.baseTags : ''
try {
const art = await ctx.http.axios(config.endpoint + '/ai/generate-image', {