Update mj style (#161)

Co-authored-by: AceDataCloud <office@acedata.cloud>
This commit is contained in:
GermeyandAceDataCloud authored and GitHub committed 2025-01-06 00:44:02 +08:00
1 parent 2abbb37f6b
commit fe3da8bb20
72 files changed
+10919 -10692

No files matched your search

+79
View File
@@ -0,0 +1,79 @@
<template>
<div class="panel flex flex-col h-full">
<div class="flex-1 overflow-y-scroll p-4">
<model-selector class="mb-2" />
<prompt-input class="mb-2" />
<ratio-selector class="mb-4" />
<quality-selector class="mb-4" />
<version-selector class="mb-4" />
<reference-image class="mb-2" />
<elements-selector class="mb-2" />
<stylize-selector class="mb-2" />
<weird-selector class="mb-2" />
<chaos-selector class="mb-2" />
<image-weight-selector class="mb-2" />
<style-selector class="mb-2" />
</div>
<div class="h-12 px-4">
<div class="flex gap-1">
<mode-selector />
<el-button type="primary" class="btn w-full" round @click="$emit('generate')">
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
{{ $t('midjourney.button.generate') }}
</el-button>
</div>
</div>
</div>
</template>
<script>
import { defineComponent } from 'vue';
import RatioSelector from './config/RatioSelector.vue';
import VersionSelector from './config/VersionSelector.vue';
import StylizeSelector from './config/StylizeSelector.vue';
import ChaosSelector from './config/ChaosSelector.vue';
import ModelSelector from './config/ModelSelector.vue';
import QualitySelector from './config/QualitySelector.vue';
import ImageWeightSelector from './config/ImageWeightSelector.vue';
import WeirdSelector from './config/WeirdSelector.vue';
import StyleSelector from './config/StyleSelector.vue';
import ElementsSelector from './config/ElementsSelector.vue';
import ModeSelector from './config/ModeSelector2.vue';
import PromptInput from './config/PromptInput.vue';
import ReferenceImage from './config/ReferenceImage.vue';
import { ElButton } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
export default defineComponent({
name: 'ConfigPanel',
components: {
FontAwesomeIcon,
ElButton,
PromptInput,
ModeSelector,
ModelSelector,
ElementsSelector,
StyleSelector,
QualitySelector,
RatioSelector,
VersionSelector,
StylizeSelector,
ChaosSelector,
WeirdSelector,
ImageWeightSelector,
ReferenceImage
},
emits: ['generate'],
computed: {
config() {
return this.$store.state.midjourney.config;
}
}
});
</script>
<style lang="scss" scoped>
.panel {
border-right: 1px solid var(--el-border-color);
}
</style>
-41
View File
@@ -1,41 +0,0 @@
<template>
<div class="mb-4">
<h2 class="title">{{ $t('midjourney.field.finalPrompt') }}</h2>
<el-alert :title="modelValue" :closable="false" class="pt-3 value" />
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElAlert } from 'element-plus';
export default defineComponent({
name: 'FinalPrompt',
components: {
ElAlert
},
props: {
modelValue: {
type: String,
default: undefined
}
},
data() {},
mounted() {}
});
</script>
<style lang="scss" scoped>
.title {
font-size: 14px;
margin-bottom: 10px;
width: 30%;
}
.value {
color: var(--el-text-color-regular);
font-size: 14px;
background-color: var(--el-bg-color-page);
border-radius: 15px;
flex: 1;
}
</style>
-189
View File
@@ -1,189 +0,0 @@
<template>
<div class="input-box">
<el-tooltip class="box-item" effect="dark" :content="$t('midjourney.message.operation')" placement="top">
<span class="btn btn-upload" @click="$emit('toggle-panel')" @mouseenter="$emit('open-panel')">
<font-awesome-icon icon="fa-solid fa-plus" class="icon icon-operation" />
</span>
</el-tooltip>
<span
:class="{
btn: true,
'btn-send': true,
disabled: !promptValue
}"
@click="onSubmit"
>
<font-awesome-icon icon="fa-solid fa-location-arrow" class="icon icon-send" />
</span>
<!-- add this textarea -->
<textarea
ref="textarea"
v-model="promptValue"
class="input"
:placeholder="$t('midjourney.message.promptPlaceholder')"
:style="{ height: inputHeight }"
@keydown.enter.exact.prevent="onSubmit"
@focus="$emit('close-panel')"
@input="adjustTextareaHeight"
></textarea>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { ElTooltip } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
export default defineComponent({
name: 'InputBox',
components: {
ElTooltip,
FontAwesomeIcon
},
props: {
prompt: {
type: String,
required: true
}
},
emits: ['update:prompt', 'submit', 'open-panel', 'toggle-panel', 'close-panel'],
data() {
return {
inputHeight: '35px', //add inputHeight
promptValue: this.prompt
};
},
watch: {
promptValue(val: string) {
this.$emit('update:prompt', val);
},
prompt(val: string) {
if (val !== this.promptValue) {
this.promptValue = val;
}
}
},
methods: {
// add textarea method
adjustTextareaHeight() {
this.$nextTick(() => {
const textarea = this.$refs.textarea;
if (textarea) {
// @ts-ignore
textarea.style.height = '35px';
// @ts-ignore
if (this.prompt) {
textarea.style.height = textarea.scrollHeight + 'px';
}
}
});
},
onSubmit() {
if (!this.prompt) {
return;
}
this.$emit('submit');
}
}
});
</script>
<style lang="scss">
textarea.input {
font-size: 14px;
min-height: 35px;
max-height: 350px;
border: none;
background: none;
box-shadow: none;
resize: none;
line-height: 25px;
width: calc(100% - 80px);
margin-left: 30px;
font-family: var(--el-font-family);
padding-top: 6px;
}
textarea.input:focus {
outline: none;
}
.input-box {
position: relative;
.input {
textarea {
max-height: 100px;
border: none;
background: none;
box-shadow: none;
resize: none;
line-height: 35px;
}
}
.el-textarea.is-disabled .el-textarea__inner {
background-color: initial;
}
}
</style>
<style lang="scss" scoped>
.input-box {
width: 100%;
max-width: 100%;
margin: auto;
position: relative;
border-radius: 10px;
background: var(--el-color-info-light-9);
padding: 5px;
.upload {
display: inline-block;
&.disabled {
.btn-upload {
cursor: not-allowed;
.icon-attachment {
color: var(--el-text-color-disabled);
}
}
}
}
.input {
border: none;
width: calc(100% - 80px);
margin-left: 35px;
line-height: 28px;
}
.btn {
display: block;
z-index: 100;
cursor: pointer;
bottom: 15px;
position: absolute;
&.btn-upload {
left: 15px;
background: var(--el-color-info-light-5);
border-radius: 50%;
width: 20px;
height: 20px;
font-size: 12px;
text-align: center;
padding-top: 1px;
.icon-attachment {
font-size: 16px;
color: var(--el-text-color-primary);
}
}
&.btn-send {
right: 15px;
&.disabled {
.icon-send {
color: var(--el-text-color-disabled);
}
cursor: not-allowed;
}
.icon-send {
font-size: 16px;
color: var(--el-text-color-primary);
}
}
}
}
</style>
-63
View File
@@ -1,63 +0,0 @@
<template>
<div class="panel">
<model-selector class="mb-4" />
<ratio-selector class="mb-4" />
<mode-selector class="mb-4" />
<quality-selector class="mb-4" />
<version-selector class="mb-4" />
<advanced-selector class="mb-4" />
<stylize-selector v-if="preset.advanced" class="mb-4" />
<weird-selector v-if="preset.advanced" class="mb-4" />
<chaos-selector v-if="preset.advanced" class="mb-4" />
<image-weight-selector v-if="preset.advanced" class="mb-4" />
<style-selector v-if="preset.advanced" class="mb-4" />
</div>
</template>
<script>
import { defineComponent } from 'vue';
import RatioSelector from './preset/RatioSelector.vue';
import VersionSelector from './preset/VersionSelector.vue';
import StylizeSelector from './preset/StylizeSelector.vue';
import ChaosSelector from './preset/ChaosSelector.vue';
import ModelSelector from './preset/ModelSelector.vue';
import QualitySelector from './preset/QualitySelector.vue';
import ImageWeightSelector from './preset/ImageWeightSelector.vue';
import WeirdSelector from './preset/WeirdSelector.vue';
import AdvancedSelector from './preset/AdvancedSelector.vue';
import StyleSelector from './preset/StyleSelector.vue';
import ModeSelector from './preset/ModeSelector.vue';
export default defineComponent({
name: 'PresetPanel',
components: {
ModelSelector,
ModeSelector,
StyleSelector,
QualitySelector,
RatioSelector,
VersionSelector,
StylizeSelector,
ChaosSelector,
WeirdSelector,
AdvancedSelector,
ImageWeightSelector
},
computed: {
preset() {
return this.$store.state.midjourney.preset;
}
}
});
</script>
<style lang="scss" scoped>
.panel {
border-right: 1px solid var(--el-border-color);
height: 100%;
padding: 10px;
.block {
margin-bottom: 15px;
}
}
</style>
-83
View File
@@ -1,83 +0,0 @@
<template>
<div>
<h2 class="title">{{ $t('midjourney.name.prompt') }}</h2>
<el-input
v-model="value"
:rows="3"
class="prompt"
type="textarea"
:placeholder="$t('midjourney.placeholder.prompt')"
/>
<p class="description">
{{ $t('midjourney.description.prompt') }}
</p>
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElInput } from 'element-plus';
export default defineComponent({
name: 'PromptInput',
components: {
ElInput
},
props: {
modelValue: {
type: String,
default: undefined
}
},
emits: ['update:modelValue'],
data() {
return {
value: this.modelValue
};
},
watch: {
modelValue(val) {
if (val !== this.value) {
this.value = val;
}
},
value(val) {
this.$emit('update:modelValue', val);
}
},
mounted() {}
});
</script>
<style lang="scss" scoped>
.title {
font-size: 14px;
margin-bottom: 10px;
}
.field {
display: flex;
flex-direction: row;
align-items: center;
.value {
flex: 1;
}
}
.description {
font-size: 12px;
margin-top: 10px;
color: var(--el-text-color-regular);
}
</style>
<style lang="scss">
.prompt {
border: none;
textarea {
border-radius: 15px !important;
resize: none;
font-size: 14px;
padding: 10px 15px;
}
}
</style>
@@ -19,12 +19,12 @@ export default defineComponent({
computed: {
value: {
get() {
return this.$store.state.midjourney.preset?.advanced;
return this.$store.state.midjourney.config.advanced;
},
set(val) {
console.debug('set advanced', val);
this.$store.commit('midjourney/setPreset', {
...this.$store.state.midjourney.preset,
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
advanced: val
});
}
@@ -0,0 +1,69 @@
<template>
<div>
<div class="flex justify-between">
<div class="flex justify-start items-center">
<span class="text-sm font-bold">{{ $t('midjourney.name.chaos') }}</span>
<info-icon :content="$t('midjourney.description.chaos')" />
</div>
<div class="flex justify-end items-center">
<el-input-number v-model="value" size="small" controls-position="right" />
</div>
</div>
<div class="w-full">
<el-slider v-model="value" :min="0" :max="100" :step="1" />
</div>
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElSlider, ElInputNumber } from 'element-plus';
import InfoIcon from '@/components/common/InfoIcon.vue';
const DEFAULT_CHAOS = 0;
export default defineComponent({
name: 'ChaosSelector',
components: {
ElSlider,
InfoIcon,
ElInputNumber
},
computed: {
value: {
get() {
return this.$store.state.midjourney.config.chaos;
},
set(val) {
console.debug('set quality', val);
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
chaos: val
});
}
}
},
mounted() {
if (!this.value) {
this.value = DEFAULT_CHAOS;
}
}
});
</script>
<style lang="scss" scoped>
.field {
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 14px;
margin: 0;
width: 30%;
}
.value {
flex: 1;
}
}
</style>
@@ -1,36 +1,62 @@
<!-- eslint-disable vue/no-use-v-if-with-v-for -->
<template>
<div class="field">
<h2 class="title">{{ $t('midjourney.field.elements') }}</h2>
<el-tabs v-model="tab">
<el-tab-pane
v-for="(element, elementKey) in elements"
:key="elementKey"
:label="element.displayName"
:name="elementKey"
class="pane"
<div>
<div class="flex justify-between">
<div class="flex justify-start items-center">
<span class="text-sm font-bold">{{ $t('midjourney.field.elements') }}</span>
<info-icon :content="$t('midjourney.description.elements')" />
</div>
<div class="flex justify-end items-center">
<el-button round type="primary" size="small" @click="choosing = true">
{{ $t('midjourney.button.select') }}
</el-button>
</div>
</div>
<div>
<el-tag
v-for="(tag, index) in value"
:key="index"
closable
effect="dark"
round
class="mr-1 mb-1"
@close="onToggle(tag)"
>
<div
v-for="(item, itemKey) in element.items"
:key="itemKey"
:class="{
hidden: !advanced && item?.advanced,
item: true,
active: value.includes(item.value)
}"
@click="onToggle(item.value)"
{{ tag.label }}
</el-tag>
</div>
<el-dialog v-model="choosing" width="70%">
<el-tabs v-model="tab">
<el-tab-pane
v-for="(element, elementKey) in elements"
:key="elementKey"
:label="element.displayName"
:name="elementKey"
class="pane"
>
<el-image :src="item.image" fit="fill" class="preview" />
<span class="name">{{ item.label }}</span>
</div>
</el-tab-pane>
</el-tabs>
<div
v-for="(item, itemKey) in element.items"
:key="itemKey"
:class="{
hidden: item?.advanced,
item: true,
active: value.includes(item)
}"
@click="onToggle(item)"
>
<el-image :src="item.image" fit="fill" class="preview" />
<span class="name">{{ item.label }}</span>
</div>
</el-tab-pane>
</el-tabs>
</el-dialog>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { ElTabs, ElTabPane, ElImage } from 'element-plus';
import { ElTabs, ElTabPane, ElImage, ElDialog, ElButton, ElTag } from 'element-plus';
import InfoIcon from '@/components/common/InfoIcon.vue';
interface IElementItem {
image: string;
@@ -46,32 +72,26 @@ interface IElement {
interface IData {
tab: string;
value: string[];
choosing: boolean;
elements: Record<string, IElement>;
}
export default defineComponent({
name: 'StylizeSelector',
name: 'ElementsSelector',
components: {
ElTabs,
ElTag,
ElTabPane,
ElImage
},
props: {
modelValue: {
type: Object as () => string[],
required: true
},
advanced: {
type: Boolean,
default: false
}
ElImage,
ElDialog,
ElButton,
InfoIcon
},
emits: ['update:modelValue'],
data(): IData {
return {
tab: 'styles',
value: this.modelValue,
choosing: false,
elements: {
styles: {
displayName: this.$t('midjourney.styleCategory.styles'),
@@ -2083,32 +2103,25 @@ export default defineComponent({
}
};
},
watch: {
modelValue(val) {
this.value = val;
},
computed: {
value: {
handler(val) {
this.$emit('update:modelValue', val);
get() {
return this.$store.state.midjourney.config.elements || [];
},
deep: true
set(val: string[]) {
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
elements: val
});
}
}
},
mounted() {
if (!this.value) {
this.value = [];
}
this.$emit('update:modelValue', this.value);
},
methods: {
onToggle(value: string) {
if (this.value.includes(value)) {
this.value.splice(this.value.indexOf(value), 1);
this.$emit('update:modelValue', this.value);
return;
onToggle(item: any) {
if (this.value.includes(item)) {
this.value = this.value.filter((v) => v !== item);
} else {
this.value.push(value);
this.$emit('update:modelValue', this.value);
this.value.push(item);
}
}
}
@@ -2124,11 +2137,11 @@ export default defineComponent({
display: flex;
flex-direction: row;
justify-content: left;
align-items: center;
flex-wrap: wrap;
align-items: flex-start;
height: auto;
max-height: 220px;
overflow-y: scroll;
flex-wrap: wrap;
height: 230px;
overflow-y: auto;
.item {
$height: 100px;
$width: 100px;
@@ -2141,7 +2154,6 @@ export default defineComponent({
border-style: solid;
border-color: var(--el-border-color);
border-radius: 5px;
overflow: hidden;
cursor: pointer;
&.hidden {
@@ -2153,8 +2165,8 @@ export default defineComponent({
}
.preview {
width: $height;
height: $width;
width: $height - 8px;
height: $width - 8px;
}
.name {
position: absolute;
@@ -1,8 +1,17 @@
<template>
<div class="field">
<h2 class="title">{{ $t('midjourney.name.imageWeight') }}</h2>
<el-slider v-model="value" :min="0" :max="2" :step="0.1" class="value" />
<info-icon :content="$t('midjourney.description.imageWeight')" class="info" />
<div>
<div class="flex justify-between">
<div class="flex justify-start items-center">
<span class="text-sm font-bold">{{ $t('midjourney.name.imageWeight') }}</span>
<info-icon :content="$t('midjourney.description.imageWeight')" />
</div>
<div class="flex justify-end items-center">
<el-input-number v-model="value" size="small" controls-position="right" />
</div>
</div>
<div class="w-full">
<el-slider v-model="value" :min="0" :max="2" :step="0.1" />
</div>
</div>
</template>
@@ -21,12 +30,12 @@ export default defineComponent({
computed: {
value: {
get() {
return this.$store.state.midjourney.preset?.iw;
return this.$store.state.midjourney.config.iw;
},
set(val) {
console.debug('set iw', val);
this.$store.commit('midjourney/setPreset', {
...this.$store.state.midjourney.preset,
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
iw: val
});
}
@@ -42,12 +42,11 @@ export default defineComponent({
computed: {
value: {
get() {
return this.$store.state.midjourney.preset?.mode;
return this.$store.state.midjourney.config.mode;
},
set(val) {
console.debug('set mode', val);
this.$store.commit('midjourney/setPreset', {
...this.$store.state.midjourney.preset,
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
mode: val
});
}
@@ -0,0 +1,135 @@
<template>
<el-dropdown trigger="click" @command="onCommand">
<el-button round>
<font-awesome-icon
v-if="activeOption?.icon"
:icon="activeOption.icon"
:style="{
color: activeOption?.color
}"
/>
<span class="ml-2">
{{ activeOption?.label }}
</span>
<el-icon class="el-icon--right"><arrow-down /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
v-for="(option, index) in options"
:key="index"
class="flex items-center justify-between"
:command="option.value"
>
<font-awesome-icon
v-if="option.icon"
:icon="option.icon"
:style="{
color: option.color
}"
/>
<span class="ml-1 text-sm">
{{ option.label }}
</span>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
<script>
import { defineComponent } from 'vue';
import { ElDropdown, ElDropdownItem, ElButton, ElIcon } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import { ArrowDown } from '@element-plus/icons-vue';
export const DEFAULT_MODE = 'fast';
export default defineComponent({
name: 'ModeSelector',
components: {
ElButton,
ElDropdown,
ArrowDown,
ElIcon,
FontAwesomeIcon,
ElDropdownItem
},
data() {
return {
options: [
{
label: this.$t('midjourney.button.fast'),
value: 'fast',
icon: 'fa-solid fa-wind',
color: '#2dc49c'
},
{
label: this.$t('midjourney.button.relax'),
value: 'relax',
icon: 'fa-solid fa-mug-saucer',
color: '#ce65e6'
},
{
label: this.$t('midjourney.button.turbo'),
value: 'turbo',
icon: 'fa-solid fa-bolt',
color: '#ff9900'
}
]
};
},
computed: {
activeOption() {
return this.options.find((option) => option.value === this.value);
},
value: {
get() {
return this.$store.state.midjourney.config.mode;
},
set(val) {
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
mode: val
});
}
}
},
mounted() {
if (!this.value) {
this.value = DEFAULT_MODE;
}
},
methods: {
onCommand(command) {
console.log('command', command);
this.value = command;
}
}
});
</script>
<style lang="scss" scoped>
.field {
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 14px;
margin: 0;
width: 30%;
}
.value {
flex: 1;
}
}
</style>
<style lang="scss">
.mode {
.el-radio-button--small .el-radio-button__inner {
padding: 8px 11px;
}
}
</style>
@@ -1,6 +1,9 @@
<template>
<div>
<h2 class="title">{{ $t('midjourney.name.model') }}</h2>
<div class="flex justify-start items-center">
<span class="text-sm font-bold">{{ $t('midjourney.name.model') }}</span>
<info-icon :content="$t('midjourney.description.model')" />
</div>
<div class="items">
<div
v-for="(option, optionKey) in options"
@@ -20,11 +23,13 @@
<script>
import { defineComponent } from 'vue';
import { ElImage } from 'element-plus';
import InfoIcon from '@/components/common/InfoIcon.vue';
export default defineComponent({
name: 'ModelSelector',
components: {
ElImage
ElImage,
InfoIcon
},
data() {
return {
@@ -32,12 +37,12 @@ export default defineComponent({
{
value: '',
label: this.$t('midjourney.model.general'),
image: 'https://cdn.acedata.cloud/2023-10-06-174633.png'
image: 'https://cdn.acedata.cloud/ebvlwg.png'
},
{
value: 'niji 5',
label: this.$t('midjourney.model.niji'),
image: 'https://cdn.acedata.cloud/2023-10-06-174008.png'
image: 'https://cdn.acedata.cloud/j6v1m7.png'
}
]
};
@@ -48,12 +53,11 @@ export default defineComponent({
},
value: {
get() {
return this.$store.state.midjourney.preset?.model;
return this.$store.state.midjourney.config.model;
},
set(val) {
console.debug('set model', val);
this.$store.commit('midjourney/setPreset', {
...this.$store.state.midjourney.preset,
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
model: val
});
}
@@ -79,7 +83,7 @@ export default defineComponent({
justify-content: space-between;
.item {
width: 115px;
width: 130px;
height: 60px;
border: 2px solid var(--el-border-color);
display: flex;
@@ -0,0 +1,71 @@
<template>
<div class="field">
<div class="box">
<h2 class="title">{{ $t('midjourney.name.prompt') }}</h2>
<info-icon :content="$t('midjourney.description.prompt')" class="info" />
</div>
<el-input
v-model="prompt"
:rows="3"
resize="none"
type="textarea"
class="prompt"
:placeholder="$t('midjourney.placeholder.prompt')"
:maxlength="200"
show-word-limit
/>
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElInput } from 'element-plus';
import InfoIcon from '@/components/common/InfoIcon.vue';
export const DEFAULT_PROMPT = '';
export default defineComponent({
name: 'PromptInput',
components: {
ElInput,
InfoIcon
},
data() {
return {};
},
computed: {
prompt: {
get() {
return this.$store.state.midjourney?.config.prompt;
},
set(val) {
console.debug('set prompt', val);
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney?.config,
prompt: val
});
}
}
},
mounted() {
if (!this.value) {
this.value = DEFAULT_PROMPT;
}
}
});
</script>
<style lang="scss" scoped>
.field {
.box {
display: flex;
flex-direction: row;
align-items: center;
position: relative;
.title {
font-size: 14px;
margin-bottom: 10px;
}
}
}
</style>
@@ -41,12 +41,11 @@ export default defineComponent({
computed: {
value: {
get() {
return this.$store.state.midjourney.preset?.quality;
return this.$store.state.midjourney.config.quality;
},
set(val) {
console.debug('set quality', val);
this.$store.commit('midjourney/setPreset', {
...this.$store.state.midjourney.preset,
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
quality: val
});
}
@@ -65,6 +64,7 @@ export default defineComponent({
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
.title {
font-size: 14px;
@@ -67,12 +67,12 @@ export default defineComponent({
},
value: {
get() {
return this.$store.state.midjourney.preset?.ratio;
return this.$store.state.midjourney.config.ratio;
},
set(val) {
console.debug('set ratio', val);
this.$store.commit('midjourney/setPreset', {
...this.$store.state.midjourney.preset,
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
ratio: val
});
}
@@ -98,7 +98,7 @@ export default defineComponent({
justify-content: space-between;
.item {
width: 40px;
width: 48px;
height: 60px;
border: 1px solid var(--el-border-color);
display: flex;
@@ -1,9 +1,16 @@
<template>
<div class="mb-4">
<div class="relative">
<div class="flex justify-between">
<div class="flex justify-start items-center">
<span class="text-sm font-bold">{{ $t('midjourney.name.referenceImage') }}</span>
<info-icon :content="$t('midjourney.description.uploadReferences')" />
</div>
</div>
<el-upload
v-model:file-list="fileList"
name="file"
:limit="5"
class="upload-wrapper"
:multiple="true"
:action="uploadUrl"
list-type="picture"
@@ -11,15 +18,10 @@
:on-error="onError"
:headers="headers"
>
<el-button round type="primary" class="btn btn-upload">
<font-awesome-icon icon="fa-solid fa-upload" class="icon mr-2" />
<el-button round type="primary" size="small" class="btn btn-upload">
<font-awesome-icon icon="fa-solid fa-upload" class="icon mr-1" />
{{ $t('midjourney.button.uploadReferences') }}
</el-button>
<template #tip>
<div class="el-upload__tip">
{{ $t('midjourney.description.uploadReferences') }}
</div>
</template>
</el-upload>
</div>
</template>
@@ -29,6 +31,7 @@ import { defineComponent } from 'vue';
import { ElUpload, ElButton, UploadFiles, UploadFile, ElMessage } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import { getBaseUrlPlatform } from '@/utils';
import InfoIcon from '@/components/common/InfoIcon.vue';
interface IData {
fileList: UploadFiles;
@@ -40,6 +43,7 @@ export default defineComponent({
components: {
ElUpload,
ElButton,
InfoIcon,
FontAwesomeIcon
},
emits: ['change'],
@@ -58,6 +62,17 @@ export default defineComponent({
urls() {
// @ts-ignore
return this.fileList.map((file: UploadFile) => file?.response?.file_url);
},
value: {
get() {
return this.$store.state.midjourney.config.references || [];
},
set(val: string[]) {
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
references: val
});
}
}
},
watch: {
@@ -84,13 +99,20 @@ export default defineComponent({
margin-bottom: 0;
width: 30%;
}
.prompt {
color: #333;
font-size: 16px;
flex: 1;
}
.btn.btn-upload {
border-radius: 20px;
position: absolute;
top: 5px;
right: 0;
}
</style>
<style lang="scss">
.upload-wrapper {
height: auto;
display: flex;
.el-upload-list {
margin: 0;
width: 100%;
}
}
</style>
@@ -27,10 +27,10 @@ export default defineComponent({
},
computed: {
model() {
return this.$store.state.midjourney.preset?.model;
return this.$store.state.midjourney.config.model;
},
options() {
if (this.model === 'niji') {
if (this.model?.includes('niji')) {
return [
{
value: 'cute',
@@ -60,12 +60,11 @@ export default defineComponent({
},
value: {
get() {
return this.$store.state.midjourney.preset?.style;
return this.$store.state.midjourney.config.style;
},
set(val) {
console.debug('set style', val);
this.$store.commit('midjourney/setPreset', {
...this.$store.state.midjourney.preset,
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
style: val
});
}
@@ -0,0 +1,51 @@
<template>
<div>
<div class="flex justify-between">
<div class="flex justify-start items-center">
<span class="text-sm font-bold">{{ $t('midjourney.name.stylize') }}</span>
<info-icon :content="$t('midjourney.description.stylize')" />
</div>
<div class="flex justify-end items-center">
<el-input-number v-model="value" size="small" controls-position="right" />
</div>
</div>
<div class="w-full">
<el-slider v-model="value" :min="0" :max="100" :step="1" />
</div>
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElSlider, ElInputNumber } from 'element-plus';
import InfoIcon from '@/components/common/InfoIcon.vue';
import { MIDJOURNEY_DEFAULT_STYLIZE } from '@/constants';
export default defineComponent({
name: 'StylizeSelector',
components: {
ElSlider,
InfoIcon,
ElInputNumber
},
computed: {
value: {
get() {
return this.$store.state.midjourney.config.stylize;
},
set(val) {
console.debug('set stylize', val);
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
stylize: val
});
}
}
},
mounted() {
if (!this.value) {
this.value = MIDJOURNEY_DEFAULT_STYLIZE;
}
}
});
</script>
@@ -22,12 +22,11 @@ export default defineComponent({
computed: {
value: {
get() {
return this.$store.state.midjourney.preset?.translation;
return this.$store.state.midjourney.config.translation;
},
set(val) {
console.debug('set translation', val);
this.$store.commit('midjourney/setPreset', {
...this.$store.state.midjourney.preset,
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
translation: val
});
}
@@ -11,7 +11,7 @@
import { defineComponent } from 'vue';
import { ElSelect, ElOption } from 'element-plus';
const DEFAULT_VERSION = '6.0';
const DEFAULT_VERSION = '6.1';
export default defineComponent({
name: 'VersionSelector',
@@ -71,12 +71,11 @@ export default defineComponent({
computed: {
value: {
get() {
return this.$store.state.midjourney.preset?.version;
return this.$store.state.midjourney.config.version;
},
set(val) {
console.debug('set version', val);
this.$store.commit('midjourney/setPreset', {
...this.$store.state.midjourney.preset,
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
version: val
});
}
@@ -95,6 +94,7 @@ export default defineComponent({
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
.title {
font-size: 14px;
@@ -102,7 +102,7 @@ export default defineComponent({
width: 30%;
}
.value {
flex: 1;
width: 80px;
}
}
</style>
@@ -0,0 +1,50 @@
<template>
<div>
<div class="flex justify-between">
<div class="flex justify-start items-center">
<span class="text-sm font-bold">{{ $t('midjourney.name.weird') }}</span>
<info-icon :content="$t('midjourney.description.weird')" />
</div>
<div class="flex justify-end items-center">
<el-input-number v-model="value" size="small" controls-position="right" />
</div>
</div>
<div class="w-full">
<el-slider v-model="value" :min="0" :max="1000" :step="1" />
</div>
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElSlider, ElInputNumber } from 'element-plus';
import InfoIcon from '@/components/common/InfoIcon.vue';
import { MIDJOURNEY_DEFAULT_WIRED } from '@/constants';
export default defineComponent({
name: 'WeirdSelector',
components: {
ElSlider,
ElInputNumber,
InfoIcon
},
computed: {
value: {
get() {
return this.$store.state.midjourney.config.weird;
},
set(val) {
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
weird: val
});
}
}
},
mounted() {
if (!this.value) {
this.value = MIDJOURNEY_DEFAULT_WIRED;
}
}
});
</script>
@@ -1,59 +0,0 @@
<template>
<div class="field">
<h2 class="title">{{ $t('midjourney.name.chaos') }}</h2>
<el-slider v-model="value" :min="0" :max="100" :step="1" class="value" />
<info-icon :content="$t('midjourney.description.chaos')" class="info" />
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElSlider } from 'element-plus';
import InfoIcon from '@/components/common/InfoIcon.vue';
const DEFAULT_CHAOS = 0;
export default defineComponent({
name: 'ChaosSelector',
components: {
ElSlider,
InfoIcon
},
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
});
}
}
},
mounted() {
if (!this.value) {
this.value = DEFAULT_CHAOS;
}
}
});
</script>
<style lang="scss" scoped>
.field {
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 14px;
margin: 0;
width: 30%;
}
.value {
flex: 1;
}
}
</style>
@@ -1,58 +0,0 @@
<template>
<div class="field">
<h2 class="title">{{ $t('midjourney.name.stylize') }}</h2>
<el-slider v-model="value" :min="0" :max="1000" :step="1" class="value" />
<info-icon :content="$t('midjourney.description.stylize')" class="info" />
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElSlider } from 'element-plus';
import InfoIcon from '@/components/common/InfoIcon.vue';
import { MIDJOURNEY_DEFAULT_STYLIZE } from '@/constants';
export default defineComponent({
name: 'StylizeSelector',
components: {
ElSlider,
InfoIcon
},
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
});
}
}
},
mounted() {
if (!this.value) {
this.value = MIDJOURNEY_DEFAULT_STYLIZE;
}
}
});
</script>
<style lang="scss" scoped>
.field {
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 14px;
margin: 0;
width: 30%;
}
.value {
flex: 1;
}
}
</style>
@@ -1,58 +0,0 @@
<template>
<div class="field">
<h2 class="title">{{ $t('midjourney.name.weird') }}</h2>
<el-slider v-model="value" :min="0" :max="1000" :step="1" class="value" />
<info-icon :content="$t('midjourney.description.weird')" class="info" />
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElSlider } from 'element-plus';
import InfoIcon from '@/components/common/InfoIcon.vue';
import { MIDJOURNEY_DEFAULT_WIRED } from '@/constants';
export default defineComponent({
name: 'WeirdSelector',
components: {
ElSlider,
InfoIcon
},
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
});
}
}
},
mounted() {
if (!this.value) {
this.value = MIDJOURNEY_DEFAULT_WIRED;
}
}
});
</script>
<style lang="scss" scoped>
.field {
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 14px;
margin: 0;
width: 30%;
}
.value {
flex: 1;
}
}
</style>