update mj history
This commit is contained in:
1 parent
d4e406feab
commit
443375fbed
22 files changed
+780
-99
No files matched your search
@@ -71,7 +71,7 @@ export default defineComponent({
|
||||
padding: 7px 6px;
|
||||
border-radius: 15px;
|
||||
margin-bottom: 5px;
|
||||
width: 372px;
|
||||
width: fit-content;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
.button {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- eslint-disable vue/no-use-v-if-with-v-for -->
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title">绘制风格</h2>
|
||||
<h2 class="title">{{ $t('midjourney.field.elements') }}</h2>
|
||||
<el-tabs v-model="tab">
|
||||
<el-tab-pane
|
||||
v-for="(element, elementKey) in elements"
|
||||
@@ -2140,6 +2140,7 @@ export default defineComponent({
|
||||
border-color: #eee;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
|
||||
&.hidden {
|
||||
display: none;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="mb-4">
|
||||
<h2 class="title">最终绘图指令</h2>
|
||||
<h2 class="title">{{ $t('midjourney.field.finalPrompt') }}</h2>
|
||||
<el-alert :title="modelValue" :closable="false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,71 +1,78 @@
|
||||
<template>
|
||||
<div class="tasks">
|
||||
<div v-if="tasks?.length > 0" class="tasks">
|
||||
<div v-for="(task, taskKey) in tasks" :key="taskKey" class="task">
|
||||
<task-preview :model-value="task" @custom="$emit('custom', $event)" />
|
||||
<task-preview :full="false" :model-value="task" :applications="applications" @custom="$emit('custom', $event)" />
|
||||
</div>
|
||||
<el-button type="primary" class="btn mb-4" @click="onLoadHistory">{{ $t('midjourney.button.history') }}</el-button>
|
||||
</div>
|
||||
<div v-else class="tasks">
|
||||
<el-card v-for="_ in 3" :key="_" class="task">
|
||||
<el-skeleton animated>
|
||||
<template #template>
|
||||
<el-skeleton-item variant="image" class="icon-placeholder" />
|
||||
<el-skeleton-item variant="p" class="title-placeholder" />
|
||||
</template>
|
||||
</el-skeleton>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import TaskPreview from './TaskPreview.vue';
|
||||
import {
|
||||
IApplication,
|
||||
IMidjourneyImagineTask,
|
||||
MidjourneyImagineState,
|
||||
apiUsageOperator,
|
||||
midjourneyOperator
|
||||
} from '@/operators';
|
||||
import { IApplication, IMidjourneyImagineTask, apiUsageOperator, midjourneyOperator } from '@/operators';
|
||||
import { ROUTE_MIDJOURNEY_HISTORY } from '@/router';
|
||||
import { ElButton, ElCard, ElSkeleton, ElSkeletonItem } from 'element-plus';
|
||||
|
||||
interface IData {
|
||||
historyTasks: IMidjourneyImagineTask[];
|
||||
tasks: IMidjourneyImagineTask[];
|
||||
mounted: boolean;
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'TaskBriefList',
|
||||
components: {
|
||||
TaskPreview
|
||||
TaskPreview,
|
||||
ElButton,
|
||||
ElCard,
|
||||
ElSkeleton,
|
||||
ElSkeletonItem
|
||||
},
|
||||
props: {
|
||||
activeTask: {
|
||||
type: Object as () => IMidjourneyImagineTask | undefined,
|
||||
required: true
|
||||
},
|
||||
applications: {
|
||||
type: Object as () => IApplication[],
|
||||
required: true
|
||||
}
|
||||
},
|
||||
emits: ['update:modelValue', 'custom', 'update:activeTask'],
|
||||
emits: ['update:modelValue', 'custom'],
|
||||
data(): IData {
|
||||
return {
|
||||
historyTasks: []
|
||||
tasks: [],
|
||||
mounted: false,
|
||||
loading: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
tasks() {
|
||||
return [...(this.activeTask ? [this.activeTask] : []), ...this.historyTasks];
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
applications(val) {
|
||||
if (val) {
|
||||
this.getHistoryTasks();
|
||||
}
|
||||
},
|
||||
activeTask(val: IMidjourneyImagineTask | undefined, oldVal: IMidjourneyImagineTask | undefined) {
|
||||
if (
|
||||
(val?.state === MidjourneyImagineState.FINISHED && oldVal?.state !== MidjourneyImagineState.FINISHED) ||
|
||||
(val?.state === MidjourneyImagineState.FAILED && oldVal?.state !== MidjourneyImagineState.FAILED)
|
||||
) {
|
||||
console.log('need to refresh history tasks');
|
||||
this.getHistoryTasks();
|
||||
this.$emit('update:activeTask', undefined);
|
||||
this.getTasks();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.mounted = true;
|
||||
},
|
||||
methods: {
|
||||
async getHistoryTasks() {
|
||||
async onLoadHistory() {
|
||||
this.$router.push({ name: ROUTE_MIDJOURNEY_HISTORY });
|
||||
},
|
||||
async getTasks() {
|
||||
// ensure that the previous request has been completed
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
const {
|
||||
data: { items: apiUsages }
|
||||
} = await apiUsageOperator.getAll({
|
||||
@@ -77,7 +84,20 @@ export default defineComponent({
|
||||
});
|
||||
const tasks = (await midjourneyOperator.tasks(apiUsages.map((apiUsage) => apiUsage.metadata?.task_id as string)))
|
||||
.data;
|
||||
this.historyTasks = tasks.filter((task) => task && task?.response);
|
||||
|
||||
this.tasks = tasks.map((task) => {
|
||||
const apiUsage = apiUsages.filter((apiUsage) => apiUsage.metadata?.task_id === task.id)[0];
|
||||
return {
|
||||
...task,
|
||||
created_at: apiUsage.created_at
|
||||
};
|
||||
});
|
||||
this.loading = false;
|
||||
if (this.mounted) {
|
||||
setTimeout(() => {
|
||||
this.getTasks();
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -86,11 +106,39 @@ export default defineComponent({
|
||||
<style lang="scss" scoped>
|
||||
.tasks {
|
||||
padding-top: 20px;
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
border-left: 1px solid var(--el-border-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
.task {
|
||||
margin-bottom: 15px;
|
||||
width: 350px;
|
||||
margin: 8px;
|
||||
height: fit-content;
|
||||
|
||||
.icon-placeholder {
|
||||
display: flex;
|
||||
height: 310px;
|
||||
width: 310px;
|
||||
margin: 0 auto 15px auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title-placeholder {
|
||||
display: block;
|
||||
width: 80px;
|
||||
height: 20px;
|
||||
margin: 0 auto 10px auto;
|
||||
}
|
||||
|
||||
.operations {
|
||||
height: fit-content !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
border-radius: 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,181 @@
|
||||
<template>
|
||||
<div v-if="tasks.length > 0" class="tasks">
|
||||
<div v-for="(task, taskKey) in tasks" :key="taskKey" class="task">
|
||||
<task-preview :full="true" :model-value="task" :applications="applications" @custom="onCustom($event)" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="tasks">
|
||||
<el-card v-for="_ in 8" :key="_" class="task">
|
||||
<el-skeleton animated>
|
||||
<template #template>
|
||||
<el-skeleton-item variant="image" class="icon-placeholder" />
|
||||
<el-skeleton-item variant="p" class="title-placeholder" />
|
||||
</template>
|
||||
</el-skeleton>
|
||||
</el-card>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="10" :offset="14">
|
||||
<div class="pagination m-v-lg">
|
||||
<pagination :current-page="page" :page-size="limit" :total="total" @change="onPageChange" />
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import TaskPreview from './TaskPreview.vue';
|
||||
import { IApplication, IMidjourneyImagineTask, apiUsageOperator, midjourneyOperator } from '@/operators';
|
||||
import Pagination from '@/components/common/Pagination.vue';
|
||||
import { ElRow, ElCol, ElCard, ElSkeleton, ElSkeletonItem } from 'element-plus';
|
||||
|
||||
interface IData {
|
||||
tasks: IMidjourneyImagineTask[];
|
||||
mounted: boolean;
|
||||
total: number | undefined;
|
||||
limit: number;
|
||||
offset: number;
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'TaskFullList',
|
||||
components: {
|
||||
TaskPreview,
|
||||
Pagination,
|
||||
ElRow,
|
||||
ElCol,
|
||||
ElSkeleton,
|
||||
ElSkeletonItem,
|
||||
ElCard
|
||||
},
|
||||
props: {
|
||||
applications: {
|
||||
type: Object as () => IApplication[],
|
||||
required: true
|
||||
}
|
||||
},
|
||||
emits: ['update:modelValue', 'custom'],
|
||||
data(): IData {
|
||||
return {
|
||||
tasks: [],
|
||||
mounted: false,
|
||||
limit: 12,
|
||||
offset: 0,
|
||||
total: undefined,
|
||||
loading: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
page() {
|
||||
return parseInt(this.$route.query.page?.toString() || '1');
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
applications(val) {
|
||||
if (val) {
|
||||
this.getTasks();
|
||||
}
|
||||
},
|
||||
page: {
|
||||
handler() {
|
||||
this.getTasks();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.mounted = true;
|
||||
},
|
||||
methods: {
|
||||
onPageChange(page: number) {
|
||||
this.$router.push({
|
||||
name: this.$route.name?.toString(),
|
||||
query: {
|
||||
page: page
|
||||
}
|
||||
});
|
||||
},
|
||||
async onCustom(event: any) {
|
||||
this.$emit('custom', event);
|
||||
setTimeout(() => {
|
||||
this.$router.push({
|
||||
name: this.$route.name?.toString(),
|
||||
query: {
|
||||
page: 1
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
},
|
||||
async getTasks() {
|
||||
// ensure that the previous request has been completed
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
const {
|
||||
data: { items: apiUsages, count }
|
||||
} = await apiUsageOperator.getAll({
|
||||
user_id: this.$store.state.user.id,
|
||||
application_id: this.applications?.map((application) => application.id),
|
||||
offset: (this.page - 1) * this.limit,
|
||||
limit: this.limit,
|
||||
ordering: '-created_at'
|
||||
});
|
||||
this.total = count;
|
||||
const tasks = (await midjourneyOperator.tasks(apiUsages.map((apiUsage) => apiUsage.metadata?.task_id as string)))
|
||||
.data;
|
||||
this.tasks = tasks.map((task) => {
|
||||
const apiUsage = apiUsages.filter((apiUsage) => apiUsage.metadata?.task_id === task?.id)[0];
|
||||
return {
|
||||
...task,
|
||||
created_at: apiUsage.created_at
|
||||
};
|
||||
});
|
||||
this.loading = false;
|
||||
if (this.mounted) {
|
||||
setTimeout(() => {
|
||||
this.getTasks();
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tasks {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
overflow-y: scroll;
|
||||
margin-top: 15px;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
.task {
|
||||
width: 350px;
|
||||
margin-bottom: 30px;
|
||||
|
||||
.icon-placeholder {
|
||||
display: flex;
|
||||
height: 310px;
|
||||
width: 310px;
|
||||
margin: 0 auto 15px auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title-placeholder {
|
||||
display: block;
|
||||
width: 80px;
|
||||
height: 20px;
|
||||
margin: 0 auto 10px auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pagination {
|
||||
height: 60px;
|
||||
}
|
||||
</style>
|
||||
@@ -2,19 +2,38 @@
|
||||
<div class="preview">
|
||||
<div class="info mb-4">
|
||||
<div class="left">
|
||||
<el-tag v-if="modelValue?.response?.success === true" type="success">成功</el-tag>
|
||||
<el-tag v-if="modelValue?.response?.success === false" type="danger">失败</el-tag>
|
||||
<el-tag v-if="modelValue?.response?.success === true" type="success">
|
||||
{{ $t('midjourney.button.success') }}
|
||||
</el-tag>
|
||||
<el-tag v-if="modelValue?.response?.success === false" type="danger">
|
||||
{{ $t('midjourney.button.failed') }}
|
||||
</el-tag>
|
||||
<el-tag v-if="!modelValue?.response" type="info">
|
||||
{{ $t('midjourney.button.generating') }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<div class="right">
|
||||
<el-tag v-if="channel" type="info" class="channel">
|
||||
<font-awesome-icon :class="{ icon: true, [channel.name]: true }" :icon="channel?.icon" />
|
||||
{{ channel?.displayName }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<div class="right"></div>
|
||||
</div>
|
||||
<div v-if="modelValue?.state === midjourneyImagineState.PENDING" class="content">
|
||||
<div v-if="false" class="extra">
|
||||
<p v-if="modelValue?.request?.prompt" class="prompt">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ modelValue?.request?.prompt }}
|
||||
</p>
|
||||
</div>
|
||||
<p v-show="false" class="description">{{ $t('midjourney.field.taskId') }}: {{ modelValue?.id }}</p>
|
||||
<div v-if="!modelValue?.response" class="content">
|
||||
<el-image class="image">
|
||||
<template #error>
|
||||
<div class="image-slot">Loading...</div>
|
||||
<div class="image-slot">{{ $t('midjourney.message.generating') }}</div>
|
||||
</template>
|
||||
</el-image>
|
||||
</div>
|
||||
<div v-else-if="modelValue?.state === midjourneyImagineState.FAILED" class="content">
|
||||
<div v-else-if="modelValue?.response.success === false" class="content">
|
||||
<el-image class="image">
|
||||
<template #error>
|
||||
<div class="image-slot">{{ modelValue?.response?.detail }}</div>
|
||||
@@ -26,36 +45,62 @@
|
||||
v-if="modelValue?.response?.image_url"
|
||||
:src="modelValue?.response?.image_url"
|
||||
:preview-src-list="[modelValue?.response?.raw_image_url as string]"
|
||||
fit="fill"
|
||||
fit="contain"
|
||||
class="image"
|
||||
/>
|
||||
<p v-if="modelValue?.response?.progress !== undefined && modelValue?.response?.progress !== 100" class="progress">
|
||||
{{ modelValue?.response?.progress }}%
|
||||
</p>
|
||||
</div>
|
||||
<div class="operations">
|
||||
<el-button
|
||||
<div v-if="modelValue?.response?.actions" :class="{ operations: true, full }">
|
||||
<el-tooltip
|
||||
v-for="(action, actionKey) in modelValue?.response?.actions"
|
||||
:key="actionKey"
|
||||
type="info"
|
||||
size="small"
|
||||
class="btn-action"
|
||||
@click="onCustom(action)"
|
||||
class="box-item"
|
||||
effect="dark"
|
||||
:content="descriptionMapping[action]"
|
||||
placement="top-start"
|
||||
>
|
||||
{{ actionMapping[action] }}
|
||||
</el-button>
|
||||
<el-button type="info" size="small" class="btn-action" @click="onCustom(action)">
|
||||
{{ actionMapping[action] }}
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div v-else-if="!modelValue?.response" :class="{ operations: true, full }">
|
||||
<el-skeleton :rows="1" />
|
||||
</div>
|
||||
<div v-else :class="{ operations: true, full }">
|
||||
<p>
|
||||
{{ $t('midjourney.message.noOperations') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="extra">
|
||||
<p class="datetime">
|
||||
<font-awesome-icon icon="fa-regular fa-clock" class="mr-1" />
|
||||
{{ $dayjs.format(modelValue?.created_at) }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElImage, ElTag, ElButton } from 'element-plus';
|
||||
import { IMidjourneyImagineTask, MidjourneyImagineAction, MidjourneyImagineState } from '@/operators';
|
||||
import { ElImage, ElTag, ElButton, ElTooltip, ElSkeleton } from 'element-plus';
|
||||
import { IApplication, IMidjourneyImagineTask, MidjourneyImagineAction, MidjourneyImagineState } from '@/operators';
|
||||
import {
|
||||
API_ID_MIDJOURNEY_FAST,
|
||||
API_ID_MIDJOURNEY_RELAX,
|
||||
API_ID_MIDJOURNEY_TURBO,
|
||||
MIDJOURNEY_CHANNEL_FAST,
|
||||
MIDJOURNEY_CHANNEL_RELAX,
|
||||
MIDJOURNEY_CHANNEL_TURBO
|
||||
} from '@/operators/midjourney/constants';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
interface IData {
|
||||
midjourneyImagineState: typeof MidjourneyImagineState;
|
||||
actionMapping: Record<MidjourneyImagineAction, string>;
|
||||
descriptionMapping: Record<MidjourneyImagineAction, string>;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
@@ -63,12 +108,23 @@ export default defineComponent({
|
||||
components: {
|
||||
ElImage,
|
||||
ElTag,
|
||||
ElButton
|
||||
ElButton,
|
||||
FontAwesomeIcon,
|
||||
ElTooltip,
|
||||
ElSkeleton
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Object as () => IMidjourneyImagineTask | undefined,
|
||||
required: true
|
||||
},
|
||||
applications: {
|
||||
type: Object as () => IApplication[],
|
||||
required: true
|
||||
},
|
||||
full: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
emits: ['custom'],
|
||||
@@ -89,21 +145,74 @@ export default defineComponent({
|
||||
[MidjourneyImagineAction.LOW_VARIATION]: 'Vary (Subtle)',
|
||||
[MidjourneyImagineAction.ZOOM_OUT_2X]: 'Zoom Out 2x',
|
||||
[MidjourneyImagineAction.ZOOM_OUT_1_5X]: 'Zoom Out 1.5x',
|
||||
[MidjourneyImagineAction.UPSAMPLE_2X]: 'Upsample 2x',
|
||||
[MidjourneyImagineAction.UPSAMPLE_4X]: 'Upsample 4x',
|
||||
[MidjourneyImagineAction.REDO_UPSAMPLE_2X]: 'Redo Upsample 2x',
|
||||
[MidjourneyImagineAction.REDO_UPSAMPLE_4X]: 'Redo Upsample 4x',
|
||||
[MidjourneyImagineAction.SQUARE]: 'Make Square',
|
||||
[MidjourneyImagineAction.PAN_LEFT]: '⬅️',
|
||||
[MidjourneyImagineAction.PAN_UP]: '⬆️',
|
||||
[MidjourneyImagineAction.PAN_DOWN]: '⬇️',
|
||||
[MidjourneyImagineAction.PAN_RIGHT]: '➡️',
|
||||
[MidjourneyImagineAction.REROLL]: '🔄'
|
||||
},
|
||||
descriptionMapping: {
|
||||
[MidjourneyImagineAction.GENERATE]: this.$t('midjourney.description.generate'),
|
||||
[MidjourneyImagineAction.UPSAMPLE1]: this.$t('midjourney.description.upsample1'),
|
||||
[MidjourneyImagineAction.UPSAMPLE2]: this.$t('midjourney.description.upsample2'),
|
||||
[MidjourneyImagineAction.UPSAMPLE3]: this.$t('midjourney.description.upsample3'),
|
||||
[MidjourneyImagineAction.UPSAMPLE4]: this.$t('midjourney.description.upsample4'),
|
||||
[MidjourneyImagineAction.VARIATION1]: this.$t('midjourney.description.variation1'),
|
||||
[MidjourneyImagineAction.VARIATION2]: this.$t('midjourney.description.variation2'),
|
||||
[MidjourneyImagineAction.VARIATION3]: this.$t('midjourney.description.variation3'),
|
||||
[MidjourneyImagineAction.VARIATION4]: this.$t('midjourney.description.variation4'),
|
||||
[MidjourneyImagineAction.HIGH_VARIATION]: this.$t('midjourney.description.high_variation'),
|
||||
[MidjourneyImagineAction.LOW_VARIATION]: this.$t('midjourney.description.low_variation'),
|
||||
[MidjourneyImagineAction.ZOOM_OUT_2X]: this.$t('midjourney.description.zoom_out_2x'),
|
||||
[MidjourneyImagineAction.ZOOM_OUT_1_5X]: this.$t('midjourney.description.zoom_out_1_5x'),
|
||||
[MidjourneyImagineAction.UPSAMPLE_2X]: this.$t('midjourney.description.upsample_2x'),
|
||||
[MidjourneyImagineAction.UPSAMPLE_4X]: this.$t('midjourney.description.upsample_4x'),
|
||||
[MidjourneyImagineAction.REDO_UPSAMPLE_2X]: this.$t('midjourney.description.redo_upsample_2x'),
|
||||
[MidjourneyImagineAction.REDO_UPSAMPLE_4X]: this.$t('midjourney.description.redo_upsample_4x'),
|
||||
[MidjourneyImagineAction.SQUARE]: this.$t('midjourney.description.square'),
|
||||
[MidjourneyImagineAction.PAN_LEFT]: this.$t('midjourney.description.pan_left'),
|
||||
[MidjourneyImagineAction.PAN_UP]: this.$t('midjourney.description.pan_up'),
|
||||
[MidjourneyImagineAction.PAN_DOWN]: this.$t('midjourney.description.pan_down'),
|
||||
[MidjourneyImagineAction.PAN_RIGHT]: this.$t('midjourney.description.pan_right'),
|
||||
[MidjourneyImagineAction.REROLL]: this.$t('midjourney.description.reroll')
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
application() {
|
||||
return this.applications?.find((application) => {
|
||||
return application.id === this.modelValue?.request?.application_id;
|
||||
});
|
||||
},
|
||||
channel() {
|
||||
if (this.application?.api_id === API_ID_MIDJOURNEY_FAST) {
|
||||
return MIDJOURNEY_CHANNEL_FAST;
|
||||
} else if (this.application?.api_id === API_ID_MIDJOURNEY_RELAX) {
|
||||
return MIDJOURNEY_CHANNEL_RELAX;
|
||||
} else if (this.application?.api_id === API_ID_MIDJOURNEY_TURBO) {
|
||||
return MIDJOURNEY_CHANNEL_TURBO;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onCustom(action: string) {
|
||||
this.$emit('custom', {
|
||||
action,
|
||||
image_id: this.modelValue?.response?.image_id
|
||||
});
|
||||
},
|
||||
onDownload(url: string) {
|
||||
// download image using javascript
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = url.split('/').pop() as string;
|
||||
link.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -120,18 +229,60 @@ export default defineComponent({
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid var(--el-border-color);
|
||||
|
||||
.description {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.info {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: stretch;
|
||||
width: 100%;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
flex: 1;
|
||||
|
||||
.btn {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.channel {
|
||||
.icon {
|
||||
display: inline-block;
|
||||
margin-right: 2px;
|
||||
&.turbo {
|
||||
color: #ff9900;
|
||||
}
|
||||
&.fast {
|
||||
color: #2dc49c;
|
||||
}
|
||||
&.relax {
|
||||
color: #ce65e6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.content {
|
||||
width: 100%;
|
||||
height: 318px;
|
||||
position: relative;
|
||||
margin-bottom: 10px;
|
||||
.image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 200px;
|
||||
.image-slot {
|
||||
display: flex;
|
||||
@@ -163,10 +314,29 @@ export default defineComponent({
|
||||
width: 100%;
|
||||
align-items: baseline;
|
||||
flex-wrap: wrap;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
overflow-y: scroll;
|
||||
|
||||
&.full {
|
||||
height: 70px;
|
||||
}
|
||||
|
||||
.btn-action {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.extra {
|
||||
text-align: center;
|
||||
.datetime,
|
||||
.prompt {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user