update preset

This commit is contained in:
AceDataCloud committed 2023-10-08 02:25:19 +08:00
1 parent e43d40d76e
commit ac78a5ea6f
12 files changed
+353 -50

No files matched your search

+2
View File
@@ -30,5 +30,7 @@ export default defineComponent({
.info {
font-size: 14px;
color: var(--el-text-color-regular);
display: block;
text-align: center;
}
</style>
@@ -0,0 +1,65 @@
<template>
<div class="field">
<h2 class="title">高级模式</h2>
<el-switch v-model="value" class="ml-2" />
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElSwitch } from 'element-plus';
const DEFAULT_ADVANCED = false;
export default defineComponent({
name: 'AdvancedSelector',
components: {
ElSwitch
},
props: {
modelValue: {
type: Boolean,
default: false
}
},
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() {
if (this.value === undefined) {
this.value = DEFAULT_ADVANCED;
}
this.$emit('update:modelValue', this.value);
}
});
</script>
<style lang="scss" scoped>
.field {
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 14px;
margin-bottom: 0;
width: 30%;
}
.value {
flex: 1;
}
}
</style>
+31 -33
View File
@@ -1,27 +1,16 @@
<template>
<div class="model-selector">
<el-dropdown trigger="click" @command="onCommandChange">
<el-button>
<font-awesome-icon class="icon" icon="fa-regular fa-" />
<span>
{{ value.displayName }}
</span>
<font-awesome-icon icon="fa-solid fa-chevron-down" />
</el-button>
<template #dropdown>
<el-dropdown-menu class="menu">
<el-dropdown-item
v-for="(channel, channelIndex) in options"
:key="channelIndex"
:command="channel"
class="option"
>
<font-awesome-icon :icon="channel.icon" />
{{ channel.displayName }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<div class="channel-selector">
<el-button
v-for="(option, optionKey) in options"
:key="optionKey"
:class="{ button: true, active: option.name === value.name }"
@click="onSelect(option)"
>
<font-awesome-icon :class="{ icon: true, [option.name]: true }" :icon="option.icon" />
<span>
{{ option.displayName }}
</span>
</el-button>
</div>
</template>
@@ -39,9 +28,7 @@ import {
export default defineComponent({
name: 'ModelSelector',
components: {
ElDropdown,
ElButton,
ElDropdownItem,
FontAwesomeIcon
},
props: {
@@ -50,7 +37,7 @@ export default defineComponent({
required: true
}
},
emits: ['update:modelValue'],
emits: ['update:modelValue', 'select'],
data() {
return {
value: this.modelValue,
@@ -64,22 +51,30 @@ export default defineComponent({
}
}
},
mounted() {
this.$emit('update:modelValue', this.value);
this.$emit('select', this.value);
},
methods: {
onCommandChange(command: IMidjourneyChannel) {
this.value = command;
this.$emit('update:modelValue', command);
onSelect(option: IMidjourneyChannel) {
this.value = option;
this.$emit('update:modelValue', option);
this.$emit('select', option);
}
}
});
</script>
<style lang="scss" scoped>
.model-selector {
.channel-selector {
background-color: #ececf1;
padding: 7px 6px;
border-radius: 15px;
margin-bottom: 5px;
.group {
width: 372px;
margin-left: auto;
margin-right: auto;
.button {
padding: 20px 30px;
color: black;
border: none;
@@ -96,10 +91,13 @@ export default defineComponent({
.icon {
display: inline-block;
margin-right: 5px;
&.base {
&.turbo {
color: #ff9900;
}
&.plus {
&.fast {
color: #2dc49c;
}
&.relax {
color: #ce65e6;
}
}
+3 -2
View File
@@ -7,6 +7,7 @@
fit="fill"
class="image"
/>
<p v-if="modelValue?.progress !== undefined">{{ modelValue?.progress }}%</p>
</div>
</template>
@@ -43,8 +44,8 @@ export default defineComponent({
width: 100%;
text-align: center;
.image {
width: 200px;
height: 200px;
width: 300px;
height: 300px;
}
}
</style>
+19 -6
View File
@@ -1,10 +1,14 @@
<template>
<div class="panel">
<model-selector v-model="preset.model" class="block" />
<ratio-selector v-model="preset.ratio" class="block" />
<version-selector v-model="preset.version" class="block" />
<stylize-selector v-model="preset.stylize" class="block" />
<chaos-selector v-model="preset.chaos" class="block" />
<model-selector v-if="false" v-model="preset.model" class="mb-4" />
<ratio-selector v-model="preset.ratio" class="mb-4" />
<quality-selector v-model="preset.quality" class="mb-4" />
<version-selector v-model="preset.version" class="mb-4" />
<advanced-selector v-model="preset.advanced" class="mb-4" />
<stylize-selector v-if="preset.advanced" v-model="preset.stylize" class="mb-4" />
<wired-selector v-if="preset.advanced" v-model="preset.wired" class="mb-4" />
<chaos-selector v-if="preset.advanced" v-model="preset.chaos" class="mb-4" />
<raw-selector v-if="preset.advanced" v-model="preset.raw" class="mb-4" />
</div>
</template>
@@ -15,14 +19,23 @@ import VersionSelector from './VersionSelector.vue';
import StylizeSelector from './StylizeSelector.vue';
import ChaosSelector from './ChaosSelector.vue';
import ModelSelector from './ModelSelector.vue';
import QualitySelector from './QualitySelector.vue';
import WiredSelector from './WiredSelector.vue';
import RawSelector from './RawSelector.vue';
import AdvancedSelector from './AdvancedSelector.vue';
export default defineComponent({
name: 'PresetPanel',
components: {
ModelSelector,
QualitySelector,
RatioSelector,
VersionSelector,
StylizeSelector,
ChaosSelector
ChaosSelector,
WiredSelector,
RawSelector,
AdvancedSelector
},
props: {
modelValue: {
@@ -0,0 +1,85 @@
<template>
<div class="field">
<h2 class="title">画质</h2>
<el-radio-group v-model="value">
<el-radio-button v-for="item in options" :key="item.value" :label="item.value">
{{ item.label }}
</el-radio-button>
</el-radio-group>
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElRadioButton, ElRadioGroup } from 'element-plus';
export const DEFAULT_QUALITY = '.5';
export default defineComponent({
name: 'QualitySelector',
components: {
ElRadioButton,
ElRadioGroup
},
props: {
modelValue: {
type: String,
default: undefined
}
},
emits: ['update:modelValue'],
data() {
return {
value: this.modelValue,
active: 0,
options: [
{
label: '低',
value: '.25'
},
{
label: '中',
value: '.5'
},
{
label: '高',
value: '1'
}
]
};
},
watch: {
modelValue(val) {
if (val !== this.value) {
this.value = val;
}
},
value(val) {
this.$emit('update:modelValue', val);
}
},
mounted() {
if (!this.value) {
this.value = DEFAULT_QUALITY;
}
this.$emit('update:modelValue', this.value);
}
});
</script>
<style lang="scss" scoped>
.field {
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 14px;
margin-bottom: 0;
width: 30%;
}
.value {
flex: 1;
}
}
</style>
+65
View File
@@ -0,0 +1,65 @@
<template>
<div class="field">
<h2 class="title">原生</h2>
<el-switch v-model="value" class="ml-2" />
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElSwitch } from 'element-plus';
const DEFAULT_RAW = false;
export default defineComponent({
name: 'RawSelector',
components: {
ElSwitch
},
props: {
modelValue: {
type: Boolean,
default: false
}
},
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() {
if (this.value === undefined) {
this.value = DEFAULT_RAW;
}
this.$emit('update:modelValue', this.value);
}
});
</script>
<style lang="scss" scoped>
.field {
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 14px;
margin-bottom: 0;
width: 30%;
}
.value {
flex: 1;
}
}
</style>
@@ -1,7 +1,7 @@
<template>
<div class="field">
<h2 class="title">版本</h2>
<el-select v-model="value" class="value" placeholder="Select" size="small">
<el-select v-model="value" class="value" placeholder="Select">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
@@ -0,0 +1,64 @@
<template>
<div class="field">
<h2 class="title">怪异度</h2>
<el-slider v-model="value" :min="0" :max="1000" :step="1" class="value" />
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { ElSlider } from 'element-plus';
const DEFAULT_WIRED = 0;
export default defineComponent({
name: 'WiredSelector',
components: {
ElSlider
},
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() {
if (!this.value) {
this.value = DEFAULT_WIRED;
}
this.$emit('update:modelValue', this.value);
}
});
</script>
<style lang="scss" scoped>
.field {
display: flex;
flex-direction: row;
align-items: center;
.title {
font-size: 14px;
margin-bottom: 0;
width: 30%;
}
.value {
flex: 1;
}
}
</style>
+6 -6
View File
@@ -1,29 +1,29 @@
import { IMidjourneyChannel } from './models';
export const MIDJOURNEY_CHANNEL_NAME_FAST = 'Fast';
export const MIDJOURNEY_CHANNEL_NAME_RELAX = 'Relax';
export const MIDJOURNEY_CHANNEL_NAME_TURBO = 'Turbo';
export const MIDJOURNEY_CHANNEL_NAME_FAST = 'fast';
export const MIDJOURNEY_CHANNEL_NAME_RELAX = 'relax';
export const MIDJOURNEY_CHANNEL_NAME_TURBO = 'turbo';
export const API_ID_MIDJOURNEY_FAST = '9a628863-8879-462b-bbee-5dc46505b733';
export const API_ID_MIDJOURNEY_RELAX = 'c58713f3-fef7-4c18-824c-9f76b5a07a7f';
export const API_ID_MIDJOURNEY_TURBO = '62ec82bd-7de3-427f-b71a-ab3551ac7677';
export const MIDJOURNEY_CHANNEL_FAST: IMidjourneyChannel = {
icon: 'fa-bolt fa-regular',
icon: 'fa-solid fa-wind',
apiId: API_ID_MIDJOURNEY_FAST,
name: MIDJOURNEY_CHANNEL_NAME_FAST,
displayName: 'Fast'
};
export const MIDJOURNEY_CHANNEL_RELAX: IMidjourneyChannel = {
icon: 'fa-bolt fa-regular',
icon: 'fa-solid fa-mug-saucer',
apiId: API_ID_MIDJOURNEY_RELAX,
name: MIDJOURNEY_CHANNEL_NAME_RELAX,
displayName: 'Relax'
};
export const MIDJOURNEY_CHANNEL_TURBO: IMidjourneyChannel = {
icon: 'fa-bolt fa-regular',
icon: 'fa-solid fa-bolt',
apiId: API_ID_MIDJOURNEY_TURBO,
name: MIDJOURNEY_CHANNEL_NAME_TURBO,
displayName: 'Turbo'
+8 -2
View File
@@ -1,10 +1,11 @@
<template>
<div class="page">
<div class="presets">
<channel-selector v-model="channel" />
<preset-panel v-model="preset" />
</div>
<div class="main">
<channel-selector v-model="channel" class="mb-4" @select="onSelectChannel" />
<api-status :application="application" class="mb-4" />
<prompt-input v-model="prompt" class="mb-4" />
<elements-selector v-model="elements" class="mb-4" />
<ignore-selector v-model="ignore" class="mb-4" />
@@ -34,6 +35,7 @@ import {
midjourneyOperator,
MidjourneyImagineState
} from '@/operators';
import ApiStatus from '@/components/common/ApiStatus.vue';
interface IData {
channel: IMidjourneyChannel;
@@ -57,7 +59,8 @@ export default defineComponent({
ElementsSelector,
IgnoreSelector,
ElButton,
ImaginePreview
ImaginePreview,
ApiStatus
},
data(): IData {
return {
@@ -77,6 +80,9 @@ export default defineComponent({
this.onFetchChannel();
},
methods: {
async onSelectChannel() {
await this.onFetchChannel();
},
async onFetchChannel() {
this.initializing = true;
const { data: applications } = await applicationOperator.getAll({
+4
View File
@@ -13,11 +13,13 @@ import {
faPalette as faSolidPalette,
faBars as faSolidBars,
faGear as faSolidGear,
faMugSaucer as faSolidMugSaucer,
faRotateRight as faSolidRotateRight,
faCheck as faSolidCheck,
faPlus as faSolidPlus,
faBolt as faSolidBolt,
faQuestion as faSolidQuestion,
faWind as faSolidWind,
faTrash as faSolidTrash,
faChevronDown as faSolidChevronDown,
faArrowsRotate as faSolidArrowsRotate,
@@ -45,9 +47,11 @@ library.add(faSolidTriangleExclamation);
library.add(faSolidUpRightFromSquare);
library.add(faSolidArrowsRotate);
library.add(faRegularPaperPlane);
library.add(faSolidWind);
library.add(faRegularComment);
library.add(faSolidArrowRightFromBracket);
library.add(faSolidTrash);
library.add(faSolidChevronDown);
library.add(faSolidPalette);
library.add(faSolidWandMagicSparkles);
library.add(faSolidMugSaucer);