Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add option to disable translate individually #123

Merged
merged 5 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export function apply(ctx: Context, config: Config) {
.option('noise', '-n <noise:number>', { hidden: restricted })
.option('strength', '-N <strength:number>', { hidden: restricted })
.option('undesired', '-u <undesired>')
.option('noTranslator', '-T', { hidden: () => !ctx.translator || !config.translator })
.action(async ({ session, options }, input) => {
if (!input?.trim()) return session.execute('help novelai')

Expand All @@ -125,7 +126,7 @@ export function apply(ctx: Context, config: Config) {
delete options.steps
}

if (config.translator && ctx.translator) {
if (config.translator && ctx.translator && !options.noTranslator) {
try {
input = await ctx.translator.translate({ input, target: 'en' })
} catch (err) {
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ commands:
strength: 图片修改幅度
noise: 图片噪声强度
undesired: 排除标签
noTranslator: 禁用自动翻译

messages:
expect-prompt: 请输入标签。
Expand Down