feat: support i18n shortcuts

This commit is contained in:
Shigma 2022-12-03 01:47:04 +08:00
parent 4a493bdc6a
commit 20648226e8
2 changed files with 14 additions and 9 deletions

View File

@ -83,14 +83,11 @@ export function apply(ctx: Context, config: Config) {
}
const cmd = ctx.command('novelai <prompts:text>')
.alias('nai')
.alias('nai', 'imagine')
.userFields(['authority'])
.shortcut('画画', { fuzzy: true })
.shortcut('畫畫', { fuzzy: true })
.shortcut('约稿', { fuzzy: true })
.shortcut('約稿', { fuzzy: true })
.shortcut('增强', { fuzzy: true, options: { enhance: true } })
.shortcut('增強', { fuzzy: true, options: { enhance: true } })
.shortcut('draw', { i18n: true, fuzzy: true })
.shortcut('draft', { i18n: true, fuzzy: true })
.shortcut('enhance', { i18n: true, fuzzy: true, options: { enhance: true } })
.option('enhance', '-e', { hidden: restricted })
.option('model', '-m <model>', { type: models, hidden: thirdParty })
.option('resolution', '-r <resolution>', { type: resolution })
@ -371,7 +368,7 @@ export function apply(ctx: Context, config: Config) {
const subcmd = ctx.intersect(() => config.type === 'sd-webui')
.command('novelai.upscale')
.shortcut('放大', { fuzzy: true })
.shortcut('upscale', { i18n: true, fuzzy: true })
.option('scale', '-s <scale:number>', { fallback: 2 })
.option('resolution', '-r <resolution>', { type: resolution })
.option('crop', '-C, --no-crop', { value: false, fallback: true })
@ -402,7 +399,7 @@ export function apply(ctx: Context, config: Config) {
const data: StableDiffusionWebUI.ExtraSingleImageRequest = {
image: image.dataUrl,
resize_mode: !!options.resolution ? 1 : 0,
resize_mode: options.resolution ? 1 : 0,
show_extras_results: true,
upscaling_resize: options.scale,
upscaling_resize_h: options.resolution?.height,

View File

@ -6,6 +6,11 @@ commands:
查找标签可以使用 Danbooru。
快来给仓库点个 star 吧https://github.com/koishijs/novelai-bot
shortcuts:
draw: 画画
draft: 约稿
enhance: 增强
options:
enhance: 图片增强模式
model: 设定生成模型
@ -58,6 +63,9 @@ commands:
novelai.upscale:
description: AI 放大图片
shortcuts:
upscale: 放大
options:
scale: 设置放大倍数
resolution: 设定放大尺寸