diff --git a/src/components/midjourney/FinalPrompt.vue b/src/components/midjourney/FinalPrompt.vue
index 1beae60..9e50cd8 100644
--- a/src/components/midjourney/FinalPrompt.vue
+++ b/src/components/midjourney/FinalPrompt.vue
@@ -1,7 +1,7 @@
{{ $t('midjourney.field.finalPrompt') }}
-
+
@@ -27,7 +27,7 @@ export default defineComponent({
diff --git a/src/components/midjourney/preset/AdvancedSelector.vue b/src/components/midjourney/preset/AdvancedSelector.vue
index 1846d21..d52bb3a 100644
--- a/src/components/midjourney/preset/AdvancedSelector.vue
+++ b/src/components/midjourney/preset/AdvancedSelector.vue
@@ -8,7 +8,6 @@
@@ -56,7 +46,7 @@ export default defineComponent({
.title {
font-size: 14px;
- margin-bottom: 0;
+ margin: 0;
width: 30%;
}
.value {
diff --git a/src/components/midjourney/preset/ChaosSelector.vue b/src/components/midjourney/preset/ChaosSelector.vue
index 6740889..33ecdee 100644
--- a/src/components/midjourney/preset/ChaosSelector.vue
+++ b/src/components/midjourney/preset/ChaosSelector.vue
@@ -19,33 +19,24 @@ export default defineComponent({
ElSlider,
InfoIcon
},
- props: {
- modelValue: {
- type: String,
- default: undefined
- }
- },
- emits: ['update:modelValue'],
- data() {
- return {
- value: this.modelValue
- };
- },
- watch: {
- modelValue(val) {
- if (val !== this.value) {
- this.value = val;
+ computed: {
+ value: {
+ get() {
+ return this.$store.state.midjourney.preset?.chaos;
+ },
+ set(val) {
+ console.debug('set quality', val);
+ this.$store.commit('midjourney/setPreset', {
+ ...this.$store.state.midjourney.preset,
+ chaos: val
+ });
}
- },
- value(val) {
- this.$emit('update:modelValue', val);
}
},
mounted() {
if (!this.value) {
this.value = DEFAULT_CHAOS;
}
- this.$emit('update:modelValue', this.value);
}
});
@@ -58,7 +49,7 @@ export default defineComponent({
.title {
font-size: 14px;
- margin-bottom: 0;
+ margin: 0;
width: 30%;
}
.value {
diff --git a/src/components/midjourney/preset/ImageWeightSelector.vue b/src/components/midjourney/preset/ImageWeightSelector.vue
index 8bffca5..83b003e 100644
--- a/src/components/midjourney/preset/ImageWeightSelector.vue
+++ b/src/components/midjourney/preset/ImageWeightSelector.vue
@@ -19,33 +19,24 @@ export default defineComponent({
ElSlider,
InfoIcon
},
- props: {
- modelValue: {
- type: String,
- default: undefined
- }
- },
- emits: ['update:modelValue'],
- data() {
- return {
- value: this.modelValue
- };
- },
- watch: {
- modelValue(val) {
- if (val !== this.value) {
- this.value = val;
+ computed: {
+ value: {
+ get() {
+ return this.$store.state.midjourney.preset?.iw;
+ },
+ set(val) {
+ console.debug('set iw', val);
+ this.$store.commit('midjourney/setPreset', {
+ ...this.$store.state.midjourney.preset,
+ iw: val
+ });
}
- },
- value(val) {
- this.$emit('update:modelValue', val);
}
},
mounted() {
if (!this.value) {
this.value = DEFAULT_IW;
}
- this.$emit('update:modelValue', this.value);
}
});
@@ -58,7 +49,7 @@ export default defineComponent({
.title {
font-size: 14px;
- margin-bottom: 0;
+ margin: 0;
width: 30%;
}
.value {
diff --git a/src/components/midjourney/preset/ModelSelector.vue b/src/components/midjourney/preset/ModelSelector.vue
index 832e264..eb52090 100644
--- a/src/components/midjourney/preset/ModelSelector.vue
+++ b/src/components/midjourney/preset/ModelSelector.vue
@@ -6,10 +6,7 @@
v-for="(option, optionKey) in options"
:key="optionKey"
:class="{ active: active === optionKey, item: true }"
- @click="
- active = optionKey;
- value = option.value;
- "
+ @click="value = option.value"
>
@@ -23,22 +20,14 @@
diff --git a/src/components/midjourney/preset/NijiSelector.vue b/src/components/midjourney/preset/NijiSelector.vue
deleted file mode 100644
index 420e1c3..0000000
--- a/src/components/midjourney/preset/NijiSelector.vue
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
{{ $t('midjourney.name.niji') }}
-
-
-
-
-
-
-
-
diff --git a/src/components/midjourney/preset/QualitySelector.vue b/src/components/midjourney/preset/QualitySelector.vue
index 3777ae0..946e99a 100644
--- a/src/components/midjourney/preset/QualitySelector.vue
+++ b/src/components/midjourney/preset/QualitySelector.vue
@@ -21,17 +21,8 @@ export default defineComponent({
ElRadioButton,
ElRadioGroup
},
- props: {
- modelValue: {
- type: String,
- default: undefined
- }
- },
- emits: ['update:modelValue'],
data() {
return {
- value: this.modelValue,
- active: 0,
options: [
{
label: '低',
@@ -48,21 +39,24 @@ export default defineComponent({
]
};
},
- watch: {
- modelValue(val) {
- if (val !== this.value) {
- this.value = val;
+ computed: {
+ value: {
+ get() {
+ return this.$store.state.midjourney.preset?.quality;
+ },
+ set(val) {
+ console.debug('set quality', val);
+ this.$store.commit('midjourney/setPreset', {
+ ...this.$store.state.midjourney.preset,
+ quality: val
+ });
}
- },
- value(val) {
- this.$emit('update:modelValue', val);
}
},
mounted() {
if (!this.value) {
this.value = DEFAULT_QUALITY;
}
- this.$emit('update:modelValue', this.value);
}
});
@@ -75,7 +69,7 @@ export default defineComponent({
.title {
font-size: 14px;
- margin-bottom: 0;
+ margin: 0;
width: 30%;
}
.value {
diff --git a/src/components/midjourney/preset/RatioSelector.vue b/src/components/midjourney/preset/RatioSelector.vue
index 48556d0..a7e5ca0 100644
--- a/src/components/midjourney/preset/RatioSelector.vue
+++ b/src/components/midjourney/preset/RatioSelector.vue
@@ -6,10 +6,7 @@
v-for="(option, optionKey) in options"
:key="optionKey"
:class="{ active: active === optionKey, item: true }"
- @click="
- active = optionKey;
- value = option.value;
- "
+ @click="value = option.value"
>
@@ -29,16 +26,8 @@ const DEFAULT_RATIO = '1:1';
export default defineComponent({
name: 'RatioSelector',
- props: {
- modelValue: {
- type: String,
- default: undefined
- }
- },
- emits: ['update:modelValue'],
data() {
return {
- value: this.modelValue,
options: [
{
value: '1:1',
@@ -75,26 +64,25 @@ export default defineComponent({
},
computed: {
active() {
- return this.options.findIndex((option) => option.value === this.value);
- }
- },
- watch: {
- modelValue(val) {
- if (val !== this.value) {
- this.value = val;
- }
+ return this.options.findIndex((option) => option.value === this.value) || 0;
},
- value(val) {
- this.$emit('update:modelValue', val);
+ value: {
+ get() {
+ return this.$store.state.midjourney.preset?.ratio;
+ },
+ set(val) {
+ console.debug('set ratio', val);
+ this.$store.commit('midjourney/setPreset', {
+ ...this.$store.state.midjourney.preset,
+ ratio: val
+ });
+ }
}
},
mounted() {
- if (!this.modelValue) {
+ if (!this.value) {
this.value = DEFAULT_RATIO;
- } else {
- this.value = this.modelValue;
}
- this.$emit('update:modelValue', this.value);
}
});
diff --git a/src/components/midjourney/preset/RawSelector.vue b/src/components/midjourney/preset/RawSelector.vue
deleted file mode 100644
index e0d5ad3..0000000
--- a/src/components/midjourney/preset/RawSelector.vue
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
{{ $t('midjourney.name.raw') }}
-
-
-
-
-
-
-
-
diff --git a/src/components/midjourney/preset/StyleSelector.vue b/src/components/midjourney/preset/StyleSelector.vue
new file mode 100644
index 0000000..53c629d
--- /dev/null
+++ b/src/components/midjourney/preset/StyleSelector.vue
@@ -0,0 +1,103 @@
+
+
+
{{ $t('midjourney.name.style') }}
+
+
+ {{ item.label }}
+ {{ item.value }}
+
+
+
+
+
+
+
+
diff --git a/src/components/midjourney/preset/StylizeSelector.vue b/src/components/midjourney/preset/StylizeSelector.vue
index 8ef6d64..5d17749 100644
--- a/src/components/midjourney/preset/StylizeSelector.vue
+++ b/src/components/midjourney/preset/StylizeSelector.vue
@@ -19,33 +19,24 @@ export default defineComponent({
ElSlider,
InfoIcon
},
- props: {
- modelValue: {
- type: String,
- default: undefined
- }
- },
- emits: ['update:modelValue'],
- data() {
- return {
- value: this.modelValue
- };
- },
- watch: {
- modelValue(val) {
- if (val !== this.value) {
- this.value = val;
+ computed: {
+ value: {
+ get() {
+ return this.$store.state.midjourney.preset?.stylize;
+ },
+ set(val) {
+ console.debug('set stylize', val);
+ this.$store.commit('midjourney/setPreset', {
+ ...this.$store.state.midjourney.preset,
+ stylize: val
+ });
}
- },
- value(val) {
- this.$emit('update:modelValue', val);
}
},
mounted() {
if (!this.value) {
this.value = DEFAULT_STYLIZE;
}
- this.$emit('update:modelValue', this.value);
}
});
@@ -58,7 +49,7 @@ export default defineComponent({
.title {
font-size: 14px;
- margin-bottom: 0;
+ margin: 0;
width: 30%;
}
.value {
diff --git a/src/components/midjourney/preset/TranslationSelector.vue b/src/components/midjourney/preset/TranslationSelector.vue
index 6f64e06..d356eb5 100644
--- a/src/components/midjourney/preset/TranslationSelector.vue
+++ b/src/components/midjourney/preset/TranslationSelector.vue
@@ -19,33 +19,24 @@ export default defineComponent({
ElSwitch,
InfoIcon
},
- props: {
- modelValue: {
- type: Boolean,
- default: DEFAULT_TRANSLATION
- }
- },
- emits: ['update:modelValue'],
- data() {
- return {
- value: this.modelValue
- };
- },
- watch: {
- modelValue(val) {
- if (val !== this.value) {
- this.value = val;
+ computed: {
+ value: {
+ get() {
+ return this.$store.state.midjourney.preset?.translation;
+ },
+ set(val) {
+ console.debug('set translation', val);
+ this.$store.commit('midjourney/setPreset', {
+ ...this.$store.state.midjourney.preset,
+ translation: val
+ });
}
- },
- value(val) {
- this.$emit('update:modelValue', val);
}
},
mounted() {
if (this.value === undefined) {
this.value = DEFAULT_TRANSLATION;
}
- this.$emit('update:modelValue', this.value);
}
});
@@ -58,7 +49,7 @@ export default defineComponent({
.title {
font-size: 14px;
- margin-bottom: 0;
+ margin: 0;
width: 30%;
}
.value {
diff --git a/src/components/midjourney/preset/VersionSelector.vue b/src/components/midjourney/preset/VersionSelector.vue
index 3699f56..2aa546f 100644
--- a/src/components/midjourney/preset/VersionSelector.vue
+++ b/src/components/midjourney/preset/VersionSelector.vue
@@ -1,7 +1,7 @@
{{ $t('midjourney.name.version') }}
-
+
@@ -10,6 +10,7 @@
@@ -92,7 +94,7 @@ export default defineComponent({
.title {
font-size: 14px;
- margin-bottom: 0;
+ margin: 0;
width: 30%;
}
.value {
diff --git a/src/components/midjourney/preset/WeirdSelector.vue b/src/components/midjourney/preset/WeirdSelector.vue
index 3be7215..e3c92cf 100644
--- a/src/components/midjourney/preset/WeirdSelector.vue
+++ b/src/components/midjourney/preset/WeirdSelector.vue
@@ -19,33 +19,24 @@ export default defineComponent({
ElSlider,
InfoIcon
},
- props: {
- modelValue: {
- type: String,
- default: undefined
- }
- },
- emits: ['update:modelValue'],
- data() {
- return {
- value: this.modelValue
- };
- },
- watch: {
- modelValue(val) {
- if (val !== this.value) {
- this.value = val;
+ computed: {
+ value: {
+ get() {
+ return this.$store.state.midjourney.preset?.weird;
+ },
+ set(val) {
+ console.debug('set weird', val);
+ this.$store.commit('midjourney/setPreset', {
+ ...this.$store.state.midjourney.preset,
+ weird: val
+ });
}
- },
- value(val) {
- this.$emit('update:modelValue', val);
}
},
mounted() {
if (!this.value) {
this.value = DEFAULT_WEIRD;
}
- this.$emit('update:modelValue', this.value);
}
});
@@ -58,7 +49,7 @@ export default defineComponent({
.title {
font-size: 14px;
- margin-bottom: 0;
+ margin: 0;
width: 30%;
}
.value {
diff --git a/src/i18n/zh/midjourney/description.ts b/src/i18n/zh/midjourney/description.ts
index 8416c86..00fe23e 100644
--- a/src/i18n/zh/midjourney/description.ts
+++ b/src/i18n/zh/midjourney/description.ts
@@ -1,6 +1,6 @@
export default {
aspect: '改变生成图像的宽高比例,默认值取决于模型和模式',
- chaos: '用于调整生成图像的变异程度,数字越大,生成的图像越独特和意想不到,范围为 0-100,默认为 1',
+ chaos: '--chaos, 用于调整生成图像的变异程度,数字越大,生成的图像越独特和意想不到,范围为 0-100,默认为 1',
fast: '忽略当前的设置,以快速模式运行单个生成任务,没有默认值',
iw: '设置图像提示在生成过程中相对于文本提示的重要性,范围为 0-2,默认为 1',
no: '指示生成系统尝试排除某些元素,例如 "--no plants" 将尝试生成不包含植物的图像,没有默认值',
@@ -9,16 +9,16 @@ export default {
'给提示添加一个随机的基础风格代码,可以使用 "--style random-16", "--style random-64" 或 "--style random-128" 来获取不同长度的随机风格效果,没有默认值',
relax: '覆盖当前设置,让系统在放松模式下运行单个任务,没有默认值',
repeat: '从一个提示创建多个任务,范围为 1-40,默认为 1',
- seed: '生成图像的起始视觉噪点,范围为 0-4294967295,默认为随机生成',
+ seed: '--seed, 生成图像的起始视觉噪点,范围为 0-4294967295,默认为随机生成',
stop: '在生成过程的任意阶段停止任务,范围为 10-100,默认为 100(即完全生成)',
style:
- '切换 Midjourney 或 Niji 模型的不同版本或风格,例如 "raw", "4a", "4b", "4c", "cute", "expressive", "original", "scenic",默认值取决于模型和模式',
- stylize: '调整 Midjourney 默认美学风格在生成任务中的应用强度,范围为 0-1000,默认为 100',
+ '--style, 切换 Midjourney 或 Niji 模型的不同版本或风格,例如 "raw", "cute", "expressive", "original", "scenic",默认值取决于模型和模式',
+ stylize: '--stylize, 调整 Midjourney 默认美学风格在生成任务中的应用强度,范围为 0-1000,默认为 100',
tile: '生成可以作为重复平铺使用的图像,以创建无缝的图案,没有默认值',
turbo: '覆盖当前设置,以涡轮模式快速运行单个任务,没有默认值',
- weird: '探索带有实验性质的不常见美学风格,范围为 0-3000,默认为 0',
+ weird: '--weird, 探索带有实验性质的不常见美学风格,范围为 0-3000,默认为 0',
translation: '在生成过程中启用自动翻译,输入为非中文内容时会自动翻译为英文输入给 Midjourney',
- imageWeight: '调整图像提示相对于文本提示的权重,范围为 0-2,默认为 1',
+ imageWeight: '--iw, 调整图像提示相对于文本提示的权重,范围为 0-2,默认为 1',
niji: '启用此开关后,生成的图像将使用 Niji 模型,生成动漫风格的图片',
uploadReferences: '上传图片作为生成的参考,支持最多 5 张图片。如果上传的图片数量超过 1 张,将会自动融合',
raw: '启用此开关后,生成的图像将使用 Midjourney 模型,生成原始风格的图片',
@@ -47,5 +47,6 @@ export default {
upsample_4x: '放大 4 倍',
redo_upsample_2x: '重新放大 2 倍',
redo_upsample_4x: '重新放大 4 倍',
- download: '下载'
+ download: '下载',
+ prompt: '输入指令如果添加额外参数,其会覆盖默认预设参数,如添加 --stylize 200,最终指令会强制使用 --stylize 200'
};
diff --git a/src/i18n/zh/midjourney/message.ts b/src/i18n/zh/midjourney/message.ts
index d4b7467..e82b010 100644
--- a/src/i18n/zh/midjourney/message.ts
+++ b/src/i18n/zh/midjourney/message.ts
@@ -1,5 +1,5 @@
export default {
- promptPlaceholder: '请输入一句话来描述你想要生成的图片,例如:一只好看的猫',
+ promptPlaceholder: '请输入一句话来描述你想要生成的图片,例如:一只好看的猫。额外的参数会覆盖默认预设参数',
uploadReferencesExceed: '最多只能上传 5 张图片',
uploadReferencesError: '上传图片失败,请稍后重试',
startTaskSuccess: '发起绘图任务成功',
diff --git a/src/i18n/zh/midjourney/name.ts b/src/i18n/zh/midjourney/name.ts
index 1d55225..8593abf 100644
--- a/src/i18n/zh/midjourney/name.ts
+++ b/src/i18n/zh/midjourney/name.ts
@@ -4,6 +4,7 @@ export default {
ratio: '宽高比',
chaos: '混乱度',
fast: '快速模式',
+ nijiStyle: '动漫风格',
version: '版本',
imageWeight: '图像权重',
no: '否定提示',
@@ -13,7 +14,7 @@ export default {
repeat: '重复生成',
seed: '种子数',
stop: '提前停止',
- style: '风格切换',
+ style: '风格',
stylize: '风格化度',
tile: '平铺模式',
turbo: '涡轮模式',
diff --git a/src/i18n/zh/midjourney/placeholder.ts b/src/i18n/zh/midjourney/placeholder.ts
index 9613b81..054ef7c 100644
--- a/src/i18n/zh/midjourney/placeholder.ts
+++ b/src/i18n/zh/midjourney/placeholder.ts
@@ -1,4 +1,5 @@
export default {
prompt: '请输入一句话来描述你想要生成的图片,例如:一只好看的猫',
- ignore: '不想让图像中出现的内容,例如生成一幅街景,但不要有汽车,你可以填写:汽车'
+ ignore: '不想让图像中出现的内容,例如生成一幅街景,但不要有汽车,你可以填写:汽车',
+ select: '选择'
};
diff --git a/src/operators/midjourney/models.ts b/src/operators/midjourney/models.ts
index fc7ab13..701e77d 100644
--- a/src/operators/midjourney/models.ts
+++ b/src/operators/midjourney/models.ts
@@ -14,8 +14,8 @@ export interface IMidjourneyPreset {
advanced?: boolean;
quality?: string;
weird?: number;
- raw?: boolean;
iw?: number;
+ style?: string;
translation?: boolean;
}
diff --git a/src/pages/midjourney/Index.vue b/src/pages/midjourney/Index.vue
index 270c373..859df5f 100644
--- a/src/pages/midjourney/Index.vue
+++ b/src/pages/midjourney/Index.vue
@@ -119,35 +119,35 @@ export default defineComponent({
if (this.elements.length > 0) {
content += ',' + this.elements.join(',');
}
- if (this.preset.model) {
+ if (this.preset.model && !content.includes(`--${this.preset.model}`)) {
content += ` --${this.preset.model}`;
}
- if (this.preset.version) {
+ if (this.preset.version && !content.includes(`--version `) && !content.includes(`--v `)) {
content += ` --version ${this.preset.version}`;
}
- if (this.preset.chaos) {
+ if (this.preset.chaos && !content.includes(`--chaos `)) {
content += ` --chaos ${this.preset.chaos}`;
}
- if (this.preset.quality) {
+ if (this.preset.quality && !content.includes(`--quality `) && !content.includes(`--q `)) {
content += ` --quality ${this.preset.quality}`;
}
- if (this.preset.ratio) {
- content += ` --ar ${this.preset.ratio}`;
+ if (this.preset.ratio && !content.includes(`--aspect `) && !content.includes(`--ar `)) {
+ content += ` --aspect ${this.preset.ratio}`;
}
- if (this.preset.stylize) {
+ if (this.preset.stylize && !content.includes(`--stylize `) && !content.includes(`--s `)) {
content += ` --stylize ${this.preset.stylize}`;
}
- if (this.preset.weird) {
+ if (this.preset.weird && !content.includes(`--weird `) && !content.includes(`--w `)) {
content += ` --weird ${this.preset.weird}`;
}
- if (this.ignore) {
+ if (this.ignore && !content.includes(`--no `)) {
content += ` --no ${this.ignore}`;
}
- if (this.preset.iw) {
+ if (this.preset.iw && !content.includes(`--iw `)) {
content += ` --iw ${this.preset.iw}`;
}
- if (this.preset.raw) {
- content += ` --style raw`;
+ if (this.preset.style && !content.includes(`--style`)) {
+ content += ` --style ${this.preset.style}`;
}
return this.prompt || this.references?.length > 0 ? content : '';
}