update preset
This commit is contained in:
1 parent
ab3016534f
commit
f03b70d89c
6 files changed
+127
-8
No files matched your search
@@ -1,7 +1,7 @@
|
||||
@forward 'element-plus/theme-chalk/src/common/var.scss' with (
|
||||
$colors: (
|
||||
'primary': (
|
||||
'base': #705cf6
|
||||
'base': #277186
|
||||
),
|
||||
'danger': (
|
||||
'base': #ec4450
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title">图片权重</h2>
|
||||
<el-slider v-model="value" :min="0" :max="2" :step="0.1" class="value" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElSlider } from 'element-plus';
|
||||
const DEFAULT_IW = 1;
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ImageWeightSelector',
|
||||
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_IW;
|
||||
}
|
||||
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>
|
||||
@@ -8,6 +8,7 @@
|
||||
<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" />
|
||||
<image-weight-selector v-if="preset.advanced" v-model="preset.iw" class="mb-4" />
|
||||
<raw-selector v-if="preset.advanced" v-model="preset.raw" class="mb-4" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -20,6 +21,7 @@ import StylizeSelector from './StylizeSelector.vue';
|
||||
import ChaosSelector from './ChaosSelector.vue';
|
||||
import ModelSelector from './ModelSelector.vue';
|
||||
import QualitySelector from './QualitySelector.vue';
|
||||
import ImageWeightSelector from './ImageWeightSelector.vue';
|
||||
import WiredSelector from './WiredSelector.vue';
|
||||
import RawSelector from './RawSelector.vue';
|
||||
import AdvancedSelector from './AdvancedSelector.vue';
|
||||
@@ -35,7 +37,8 @@ export default defineComponent({
|
||||
ChaosSelector,
|
||||
WiredSelector,
|
||||
RawSelector,
|
||||
AdvancedSelector
|
||||
AdvancedSelector,
|
||||
ImageWeightSelector
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<el-image
|
||||
v-if="modelValue?.response?.image_url"
|
||||
:src="modelValue?.response?.image_url"
|
||||
:preview-src-list="[modelValue?.response?.image_url as string]"
|
||||
:preview-src-list="[modelValue?.response?.raw_image_url as string]"
|
||||
fit="fill"
|
||||
class="image"
|
||||
/>
|
||||
|
||||
@@ -9,8 +9,13 @@ export interface IMidjourneyPreset {
|
||||
model?: string;
|
||||
ratio?: string;
|
||||
version?: string;
|
||||
stylize?: string;
|
||||
chaos?: string;
|
||||
stylize?: number;
|
||||
chaos?: number;
|
||||
advanced?: boolean;
|
||||
quality?: string;
|
||||
wired?: number;
|
||||
raw?: boolean;
|
||||
iw: number;
|
||||
}
|
||||
|
||||
export enum MidjourneyImagineAction {
|
||||
@@ -32,7 +37,11 @@ export enum MidjourneyImagineAction {
|
||||
PAN_UP = 'pan_up',
|
||||
PAN_DOWN = 'pan_down',
|
||||
PAN_RIGHT = 'pan_right',
|
||||
REROLL = 'reroll'
|
||||
REROLL = 'reroll',
|
||||
UPSAMPLE_2X = 'upsample_2x',
|
||||
UPSAMPLE_4X = 'upsample_4x',
|
||||
REDO_UPSAMPLE_2X = 'redo_upsample_2x',
|
||||
REDO_UPSAMPLE_4X = 'redo_upsample_4x'
|
||||
}
|
||||
|
||||
export enum MidjourneyImagineState {
|
||||
@@ -53,6 +62,7 @@ export interface IMidjourneyImagineResponse {
|
||||
progress: number;
|
||||
image_id: string;
|
||||
image_url: string;
|
||||
raw_image_url: string;
|
||||
actions: MidjourneyImagineAction[];
|
||||
code?: string;
|
||||
detail?: string;
|
||||
|
||||
@@ -8,7 +8,10 @@
|
||||
<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" />
|
||||
<ignore-selector v-if="preset.advanced" v-model="ignore" class="mb-4" />
|
||||
<p>
|
||||
{{ finalPrompt }}
|
||||
</p>
|
||||
<el-button type="primary" @click="onGenerate"> 生成 </el-button>
|
||||
</div>
|
||||
<div class="tasks">
|
||||
@@ -23,7 +26,7 @@ import PresetPanel from '@/components/midjourney/PresetPanel.vue';
|
||||
import PromptInput from '@/components/midjourney/PromptInput.vue';
|
||||
import ElementsSelector from '@/components/midjourney/ElementsSelector.vue';
|
||||
import IgnoreSelector from '@/components/midjourney/IgnoreSelector.vue';
|
||||
import { ElButton, ElImage } from 'element-plus';
|
||||
import { ElButton } from 'element-plus';
|
||||
import ChannelSelector from '@/components/midjourney/ChannelSelector.vue';
|
||||
import {
|
||||
IApplication,
|
||||
@@ -78,6 +81,45 @@ export default defineComponent({
|
||||
task: undefined
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
finalPrompt(): string {
|
||||
let content = '';
|
||||
if (this.prompt) {
|
||||
content += this.prompt;
|
||||
}
|
||||
if (this.elements.length > 0) {
|
||||
content += ',' + this.elements.join(',');
|
||||
}
|
||||
if (this.preset.version) {
|
||||
content += ` --version ${this.preset.version}`;
|
||||
}
|
||||
if (this.preset.chaos) {
|
||||
content += ` --chaos ${this.preset.chaos}`;
|
||||
}
|
||||
if (this.preset.quality) {
|
||||
content += ` --quality ${this.preset.quality}`;
|
||||
}
|
||||
if (this.preset.ratio) {
|
||||
content += ` --ar ${this.preset.ratio}`;
|
||||
}
|
||||
if (this.preset.stylize) {
|
||||
content += ` --stylize ${this.preset.stylize}`;
|
||||
}
|
||||
if (this.preset.wired) {
|
||||
content += ` --wired ${this.preset.wired}`;
|
||||
}
|
||||
if (this.ignore) {
|
||||
content += ` --no ${this.ignore}`;
|
||||
}
|
||||
if (this.preset.iw) {
|
||||
content += ` --iw ${this.preset.iw}`;
|
||||
}
|
||||
if (this.preset.raw) {
|
||||
content += ` --raw`;
|
||||
}
|
||||
return this.prompt ? content : '';
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.onFetchApplication();
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user