1 parent
54bf77175b
commit
2b894cf243
45 files changed
+10799
-9648
No files matched your search
@@ -1,14 +1,17 @@
|
||||
<template>
|
||||
<div class="panel flex flex-col">
|
||||
<div class="flex-1 overflow-y-scroll p-4">
|
||||
<model-selector class="mb-2" />
|
||||
<is-videos-selector class="mb-2" />
|
||||
<model-selector v-if="!config.is_videos" 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" />
|
||||
<advanced-selector class="mb-2" />
|
||||
<image-url-input v-if="config.is_videos" class="mb-2" />
|
||||
<reference-image v-if="!config.is_videos" class="mb-2" />
|
||||
<ratio-selector v-if="!config.is_videos" class="mb-4" />
|
||||
<quality-selector v-if="!config.is_videos" class="mb-4" />
|
||||
<version-selector v-if="!config.is_videos" class="mb-4" />
|
||||
<reference-image v-if="!config.is_videos" class="mb-2" />
|
||||
<elements-selector v-if="!config.is_videos" class="mb-2" />
|
||||
<advanced-selector v-if="!config.is_videos" class="mb-2" />
|
||||
<stylize-selector v-show="config.advanced" class="mb-2" />
|
||||
<weird-selector v-show="config.advanced" class="mb-2" />
|
||||
<chaos-selector v-show="config.advanced" class="mb-2" />
|
||||
@@ -18,7 +21,10 @@
|
||||
<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')">
|
||||
<el-button v-if="config.action === 'extend'" type="primary" class="btn w-full" round @click="$emit('generate')">
|
||||
{{ $t('midjourney.button.extend') }}
|
||||
</el-button>
|
||||
<el-button v-else type="primary" class="btn w-full" round @click="$emit('generate')">
|
||||
{{ $t('midjourney.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -30,7 +36,9 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import RatioSelector from './config/RatioSelector.vue';
|
||||
import AdvancedSelector from './config/AdvancedSelector.vue';
|
||||
import IsVideosSelector from './config/IsVideosSelector.vue';
|
||||
import VersionSelector from './config/VersionSelector.vue';
|
||||
import ImageUrlInput from './config/ImageUrlInput.vue';
|
||||
import StylizeSelector from './config/StylizeSelector.vue';
|
||||
import ChaosSelector from './config/ChaosSelector.vue';
|
||||
import ModelSelector from './config/ModelSelector.vue';
|
||||
@@ -61,7 +69,9 @@ export default defineComponent({
|
||||
ChaosSelector,
|
||||
WeirdSelector,
|
||||
ImageWeightSelector,
|
||||
ReferenceImage
|
||||
ReferenceImage,
|
||||
IsVideosSelector,
|
||||
ImageUrlInput
|
||||
},
|
||||
emits: ['generate'],
|
||||
computed: {
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<div class="relative">
|
||||
<div class="flex justify-between">
|
||||
<div class="flex justify-start items-center">
|
||||
<span class="text-sm font-bold">{{ $t('midjourney.name.imageUrl') }}</span>
|
||||
<info-icon :content="$t('midjourney.description.imageUrl')" />
|
||||
</div>
|
||||
</div>
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
name="file"
|
||||
:limit="5"
|
||||
class="upload-wrapper"
|
||||
accept=".png,.jpg,.jpeg,.gif,.bmp,.webp"
|
||||
:multiple="true"
|
||||
list-type="picture"
|
||||
:action="uploadUrl"
|
||||
:on-exceed="onExceed"
|
||||
:on-error="onError"
|
||||
:headers="headers"
|
||||
>
|
||||
<template #file="{ file }">
|
||||
<image-preview
|
||||
:url="file.url || (file.response as any)?.file_url"
|
||||
:name="file.name"
|
||||
:percentage="file.percentage"
|
||||
@remove="fileList.splice(fileList.indexOf(file), 1)"
|
||||
/>
|
||||
</template>
|
||||
<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.uploadImageUrl') }}
|
||||
</el-button>
|
||||
</el-upload>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
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';
|
||||
import ImagePreview from '@/components/common/ImagePreview.vue';
|
||||
|
||||
interface IData {
|
||||
fileList: UploadFiles;
|
||||
uploadUrl: string;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ReferenceImage',
|
||||
components: {
|
||||
ElUpload,
|
||||
ElButton,
|
||||
InfoIcon,
|
||||
FontAwesomeIcon,
|
||||
ImagePreview
|
||||
},
|
||||
emits: ['change'],
|
||||
data(): IData {
|
||||
return {
|
||||
fileList: [],
|
||||
uploadUrl: getBaseUrlPlatform() + '/api/v1/files/'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
headers() {
|
||||
return {
|
||||
Authorization: `Bearer ${this.$store.state.token.access}`
|
||||
};
|
||||
},
|
||||
urls() {
|
||||
// @ts-ignore
|
||||
return this.fileList.map((file: UploadFile) => file?.response?.file_url);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
urls: {
|
||||
handler(val) {
|
||||
console.debug('URLs changed:', val);
|
||||
this.$store.commit('midjourney/setConfig', {
|
||||
...this.$store.state.midjourney.config,
|
||||
image_url: val[0]
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onExceed() {
|
||||
ElMessage.warning(this.$t('midjourney.message.uploadStartImageExceed'));
|
||||
},
|
||||
onError() {
|
||||
ElMessage.error(this.$t('midjourney.message.uploadStartImageError'));
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
font-size: 14px;
|
||||
margin-bottom: 0;
|
||||
width: 30%;
|
||||
}
|
||||
.btn.btn-upload {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.upload-wrapper {
|
||||
height: auto;
|
||||
display: flex;
|
||||
.el-upload-list {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div class="field">
|
||||
<h2 class="title">{{ $t('midjourney.name.isVideos') }}</h2>
|
||||
<el-switch v-model="value" class="value" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElSwitch } from 'element-plus';
|
||||
|
||||
const DEFAULT_IS_VIDEOS = false;
|
||||
|
||||
export default defineComponent({
|
||||
name: 'IsVideosSelector',
|
||||
components: {
|
||||
ElSwitch
|
||||
},
|
||||
computed: {
|
||||
value: {
|
||||
get() {
|
||||
return this.$store.state.midjourney.config.is_videos;
|
||||
},
|
||||
set(val: boolean) {
|
||||
console.debug('set is_videos', val);
|
||||
this.$store.commit('midjourney/setConfig', {
|
||||
...this.$store.state.midjourney.config,
|
||||
is_videos: val
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.value === undefined) {
|
||||
this.value = DEFAULT_IS_VIDEOS;
|
||||
}
|
||||
}
|
||||
});
|
||||
</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;
|
||||
}
|
||||
.info {
|
||||
width: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -110,16 +110,124 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="modelValue?.type === 'videos'" class="item">
|
||||
<div class="left">
|
||||
<el-image src="https://cdn.acedata.cloud/wto43b.png" class="avatar" />
|
||||
</div>
|
||||
<div class="preview">
|
||||
<div class="bot">
|
||||
{{ $t('midjourney.name.midjourneyBot') }}
|
||||
<span class="datetime">
|
||||
{{ $dayjs.format('' + new Date(parseFloat((modelValue?.created_at || '').toString()) * 1000)) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="info">
|
||||
<p v-if="modelValue?.request?.prompt" class="prompt mt-2">
|
||||
{{ modelValue?.request?.prompt }}
|
||||
<span v-if="!modelValue?.response"> - ({{ $t('midjourney.status.pending') }}) </span>
|
||||
<span v-if="modelValue?.response?.progress !== undefined && modelValue?.response?.progress !== 100">
|
||||
- ({{ modelValue?.response?.progress }}%)
|
||||
</span>
|
||||
<span>({{ modelValue?.request?.mode }})</span>
|
||||
</p>
|
||||
<p v-if="modelValue?.request?.video_id" class="prompt mt-2">
|
||||
{{ modelValue?.request?.video_id }} - {{ modelValue?.request?.action }}
|
||||
<span v-if="!modelValue?.response"> - ({{ $t('midjourney.status.pending') }}) </span>
|
||||
<span>({{ modelValue?.request?.mode }})</span>
|
||||
</p>
|
||||
</div>
|
||||
<!-- response error -->
|
||||
<div v-if="modelValue?.response?.success === false" :class="{ content: true, full: full, failed: true }">
|
||||
<el-alert :closable="false" class="failure">
|
||||
<p class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('midjourney.field.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" />
|
||||
</p>
|
||||
<p class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-circle-info" class="mr-1" />
|
||||
{{ $t('midjourney.field.failureReason') }}:
|
||||
{{ modelValue?.response?.error?.message }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.error?.message!" />
|
||||
</p>
|
||||
<p class="text-[var(--el-text-color-regular)] text-xs mb-0">
|
||||
<font-awesome-icon icon="fa-solid fa-hashtag" class="mr-1" />
|
||||
{{ $t('midjourney.field.traceId') }}:
|
||||
{{ modelValue?.response?.trace_id }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.trace_id" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
<!-- response success -->
|
||||
<div v-if="modelValue?.response?.success === true" :class="{ content: true, full: full }">
|
||||
<div v-if="modelValue?.response.video_urls" class="mb-4">
|
||||
<video-player :src="modelValue?.response.video_urls[0]" />
|
||||
</div>
|
||||
<div
|
||||
v-if="modelValue?.response && modelValue?.response?.video_urls"
|
||||
:class="{ operations: true, 'mt-2': true, 'mb-4': true }"
|
||||
>
|
||||
<el-tooltip class="box-item" effect="dark" :content="$t('luma.message.extendVideo')" placement="top-start">
|
||||
<el-button type="info" size="small" class="btn-action" @click.stop="onExtend($event, modelValue?.response)">
|
||||
{{ $t('midjourney.button.extend') }}
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip class="box-item" effect="dark" :content="$t('luma.message.downloadVideo')" placement="top-start">
|
||||
<el-button
|
||||
type="info"
|
||||
size="small"
|
||||
class="btn-action"
|
||||
@click.stop="onDownload(modelValue.response.video_urls[0])"
|
||||
>
|
||||
{{ $t('midjourney.button.download') }}
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<el-alert :closable="false" class="mt-2 success">
|
||||
<p class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('midjourney.field.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" />
|
||||
</p>
|
||||
<p class="text-[var(--el-text-color-regular)] text-xs mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-hashtag" class="mr-1" />
|
||||
{{ $t('midjourney.field.traceId') }}:
|
||||
{{ modelValue?.trace_id }}
|
||||
<copy-to-clipboard :content="modelValue?.trace_id" />
|
||||
</p>
|
||||
<p class="text-[var(--el-text-color-regular)] text-xs mb-0">
|
||||
<font-awesome-icon icon="fa-solid fa-image" class="mr-1" />
|
||||
{{ $t('midjourney.field.videoId') }}:
|
||||
{{ modelValue?.response?.video_id }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.video_id" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
<!-- response pending -->
|
||||
<div v-if="!modelValue?.response">
|
||||
<el-alert :closable="false" class="mt-2 info">
|
||||
<p class="text-[var(--el-text-color-regular)] text-xs mb-0">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('midjourney.field.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElImage, ElButton, ElTooltip, ElAlert } from 'element-plus';
|
||||
import { IMidjourneyTask, MidjourneyImagineAction, MidjourneyImagineState } from '@/models';
|
||||
import { IMidjourneyTask, MidjourneyImagineAction, MidjourneyImagineState, IMidjourneyVideosResponse } from '@/models';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
||||
import ImageWrapper from '@/components/common/ImageWrapper.vue';
|
||||
|
||||
import VideoPlayer from '@/components/common/VideoPlayer.vue';
|
||||
interface IData {
|
||||
midjourneyImagineState: typeof MidjourneyImagineState;
|
||||
actionMapping: Record<MidjourneyImagineAction, string>;
|
||||
@@ -135,7 +243,8 @@ export default defineComponent({
|
||||
FontAwesomeIcon,
|
||||
ElTooltip,
|
||||
ElAlert,
|
||||
CopyToClipboard
|
||||
CopyToClipboard,
|
||||
VideoPlayer
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
@@ -214,6 +323,9 @@ export default defineComponent({
|
||||
computed: {
|
||||
application() {
|
||||
return this.$store.state.midjourney.application;
|
||||
},
|
||||
config() {
|
||||
return this.$store.state.midjourney?.config;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -225,6 +337,16 @@ export default defineComponent({
|
||||
});
|
||||
}
|
||||
},
|
||||
onExtend(_event: MouseEvent, response: IMidjourneyVideosResponse) {
|
||||
// extend url here
|
||||
console.debug('set config', response);
|
||||
this.$store.commit('midjourney/setConfig', {
|
||||
...this.$store.state.midjourney?.config,
|
||||
video_id: response.video_id,
|
||||
action: 'extend',
|
||||
is_videos: true
|
||||
});
|
||||
},
|
||||
onDownload(url: string) {
|
||||
// download image using javascript
|
||||
const link = document.createElement('a');
|
||||
|
||||
@@ -6,7 +6,13 @@
|
||||
<no-tasks />
|
||||
</div>
|
||||
<div v-else-if="tasks.length > 0" ref="panel" class="p-2 flex flex-col overflow-y-auto" @scroll="onHandleScroll">
|
||||
<task-item v-for="(task, taskKey) in tasks" :key="taskKey" :model-value="task" @custom="$emit('custom', $event)" />
|
||||
<task-item
|
||||
v-for="(task, taskKey) in tasks"
|
||||
:key="taskKey"
|
||||
:model-value="task"
|
||||
@extend="$emit('extend', $event)"
|
||||
@custom="$emit('custom', $event)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -23,7 +29,7 @@ export default defineComponent({
|
||||
BotPlaceholder,
|
||||
NoTasks
|
||||
},
|
||||
emits: ['custom', 'reach-top'],
|
||||
emits: ['custom', 'extend', 'reach-top'],
|
||||
data() {
|
||||
return {
|
||||
job: 0
|
||||
|
||||
Reference in new issue
Block a user