Refine video ui (#229)
Co-authored-by: AceDataCloud <office@acedata.cloud>
This commit is contained in:
1 parent
2997079593
commit
a0eb57c21a
113 files changed
+1740
-2556
No files matched your search
@@ -239,7 +239,7 @@ export default defineComponent({
|
||||
&[direction='row'] {
|
||||
flex-direction: row;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid var(--el-border-color-lighter);
|
||||
border-top: 1px solid var(--el-border-color);
|
||||
.chevron,
|
||||
.logo {
|
||||
display: none;
|
||||
@@ -321,7 +321,7 @@ export default defineComponent({
|
||||
height: 35px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
border: 1px solid var(--el-border-color);
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<p class="info">{{ $t('common.message.noTasks') }}</p>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'NoTasks'
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.info {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<vue-plyr :options="options" class="video">
|
||||
<video controls crossorigin playsinline>
|
||||
<div class="video">
|
||||
<vue-plyr :options="options">
|
||||
<video controls crossorigin="anonymous" playsinline>
|
||||
<source size="1080" :src="modelValue?.video_url" type="video/mp4" />
|
||||
</video>
|
||||
</vue-plyr>
|
||||
@@ -15,6 +15,7 @@ import VuePlyr from '@skjnldsv/vue-plyr';
|
||||
// @ts-ignore
|
||||
import { IKlingVideo } from '@/models';
|
||||
import '@skjnldsv/vue-plyr/dist/vue-plyr.css';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'VideoPlayer',
|
||||
components: { VuePlyr },
|
||||
@@ -34,7 +35,15 @@ export default defineComponent({
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.video {
|
||||
max-width: 100%;
|
||||
height: 450px;
|
||||
max-width: 800px;
|
||||
max-height: 450px;
|
||||
border-radius: 15px;
|
||||
overflow: hidden;
|
||||
.plyr--video,
|
||||
video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,25 +1,27 @@
|
||||
<template>
|
||||
<div v-if="tasks?.items === undefined" class="tasks">
|
||||
<div v-if="tasks?.items === undefined">
|
||||
<bot-placeholder />
|
||||
</div>
|
||||
<div v-else-if="tasks?.items?.length && tasks?.items?.length > 0" class="tasks">
|
||||
<div v-else-if="tasks?.items?.length && tasks?.items?.length > 0" class="h-full w-full overflow-y-auto">
|
||||
<task-preview v-for="(task, taskIndex) in tasks?.items" :key="taskIndex" :model-value="task" />
|
||||
</div>
|
||||
<p v-if="tasks?.items?.length === 0" class="description">
|
||||
{{ $t('flux.message.noTasks') }}
|
||||
</p>
|
||||
<div v-if="tasks?.items?.length === 0">
|
||||
<no-tasks />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import TaskPreview from './task/Preview.vue';
|
||||
import BotPlaceholder from '../common/BotPlaceholder.vue';
|
||||
import NoTasks from '@/components/common/NoTasks.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'RecentPanel',
|
||||
components: {
|
||||
TaskPreview,
|
||||
BotPlaceholder
|
||||
BotPlaceholder,
|
||||
NoTasks
|
||||
},
|
||||
emits: ['reach-top'],
|
||||
data() {
|
||||
@@ -47,23 +49,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.description {
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.tasks {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
.task {
|
||||
margin-bottom: 15px;
|
||||
width: 100%;
|
||||
height: fit-content;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="bot">
|
||||
{{ $t('flux.name.fluxBot') }}
|
||||
<span class="datetime">
|
||||
{{ $dayjs.format('' + new Date(parseFloat(modelValue?.created_at || '') * 1000)) }}
|
||||
{{ $dayjs.format('' + new Date(parseFloat((modelValue?.created_at || '').toString()) * 1000)) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="info">
|
||||
@@ -215,22 +215,3 @@ $left-width: 70px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.preview {
|
||||
.image.error {
|
||||
background: var(--el-bg-color-page);
|
||||
.image-slot {
|
||||
font-size: 14px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
.failure {
|
||||
background: var(--el-fill-color-light);
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="config">
|
||||
<prompt-input class="mb-4" />
|
||||
<model-selector class="mb-4" />
|
||||
<start-image-url-input v-if="config?.model === 'minimax-i2v'" class="mb-4" />
|
||||
<start-image-url-input v-if="config?.model === 'minimax-i2v'" class="mb-2" />
|
||||
<div class="actions">
|
||||
<el-button
|
||||
v-if="config?.video_url !== undefined || config?.custom"
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<template>
|
||||
<div class="panel detail">
|
||||
<task-detail />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import TaskDetail from './task/Detail.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'DetailPanel',
|
||||
components: {
|
||||
TaskDetail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
job: 0
|
||||
};
|
||||
},
|
||||
computed: {}
|
||||
});
|
||||
</script>
|
||||
@@ -1,77 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card v-show="operating">
|
||||
<content-input class="mb-4" />
|
||||
<prompt-input class="mb-4" />
|
||||
<preset-selector class="mb-4" />
|
||||
<div class="actions">
|
||||
<el-button type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('hailuo.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
<div>
|
||||
<el-button type="primary" class="btn btn-operate" @click="operating = !operating">+</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElButton, ElCard } from 'element-plus';
|
||||
import PresetSelector from './config/PresetSelector2.vue';
|
||||
import ContentInput from './config/ContentInput.vue';
|
||||
import PromptInput from './config/PromptInput.vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'OperationPanel',
|
||||
components: {
|
||||
ElButton,
|
||||
ElCard,
|
||||
PresetSelector,
|
||||
ContentInput,
|
||||
PromptInput,
|
||||
FontAwesomeIcon
|
||||
},
|
||||
emits: ['generate'],
|
||||
data() {
|
||||
return {
|
||||
operating: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onGenerate() {
|
||||
this.$emit('generate');
|
||||
this.operating = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
width: 580px;
|
||||
height: fit-content;
|
||||
overflow-y: scroll;
|
||||
position: absolute;
|
||||
bottom: 70px;
|
||||
left: calc(50% - 300px);
|
||||
@media (max-width: 767px) {
|
||||
width: 100%;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-operate {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
font-size: 24px;
|
||||
line-height: 40px;
|
||||
padding: 0;
|
||||
margin: auto;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
@@ -1,40 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<vue-plyr :options="options" class="video">
|
||||
<video controls crossorigin playsinline :data-poster="modelValue?.image_url">
|
||||
<source size="1080" :src="modelValue?.video_url" type="video/mp4" />
|
||||
</video>
|
||||
</vue-plyr>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
// @ts-ignore
|
||||
import VuePlyr from '@skjnldsv/vue-plyr';
|
||||
// @ts-ignore
|
||||
import { IHailuoVideo } from '@/models';
|
||||
import '@skjnldsv/vue-plyr/dist/vue-plyr.css';
|
||||
export default defineComponent({
|
||||
name: 'VideoPlayer',
|
||||
components: { VuePlyr },
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Object as () => IHailuoVideo | undefined,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
options: { quality: { default: '1080p' } }
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.video {
|
||||
max-width: 100%;
|
||||
height: 450px;
|
||||
}
|
||||
</style>
|
||||
@@ -10,7 +10,6 @@
|
||||
v-model:file-list="fileList"
|
||||
accept=".png,.jpg,.jpeg,.gif,.bmp,.webp"
|
||||
name="file"
|
||||
class="upload-wrapper"
|
||||
:show-file-list="true"
|
||||
:limit="1"
|
||||
:multiple="false"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div v-for="(video, videoIndex) in videos" :key="videoIndex" class="preview">
|
||||
<div class="preview">
|
||||
<div class="left">
|
||||
<el-image src="https://cdn.acedata.cloud/0qg4gp.png" class="avatar" />
|
||||
</div>
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="bot">
|
||||
{{ $t('hailuo.name.hailuoBot') }}
|
||||
<span class="datetime">
|
||||
{{ $dayjs.format('' + new Date(parseFloat(modelValue?.created_at || '') * 1000)) }}
|
||||
{{ $dayjs.format('' + new Date(parseFloat((modelValue?.created_at || '').toString()) * 1000)) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="info">
|
||||
@@ -21,8 +21,8 @@
|
||||
</div>
|
||||
<!-- Display success message -->
|
||||
<div v-if="modelValue?.response?.success === true" :class="{ content: true, failed: true }">
|
||||
<div class="image-wrapper">
|
||||
<VideoPlayer :model-value="video" />
|
||||
<div class="mb-4">
|
||||
<video-player :model-value="video" />
|
||||
</div>
|
||||
<div v-if="video" :class="{ operations: true, 'mt-2': true }">
|
||||
<el-tooltip
|
||||
@@ -31,17 +31,29 @@
|
||||
:content="$t('hailuo.message.downloadVideo')"
|
||||
placement="top-start"
|
||||
>
|
||||
<el-button type="info" size="small" class="btn-action" @click="onDownload($event, video?.video_url)">
|
||||
<el-button
|
||||
v-if="video?.video_url"
|
||||
type="info"
|
||||
size="small"
|
||||
class="mb-2"
|
||||
@click.stop="onDownload($event, video?.video_url)"
|
||||
>
|
||||
{{ $t('hailuo.button.download') }}
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<el-alert :closable="false" class="mt-2 success">
|
||||
<p class="description">
|
||||
<p v-if="modelValue?.request?.model" class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-hashtag" class="mr-1" />
|
||||
{{ $t('hailuo.name.model') }}:
|
||||
{{ modelValue?.request?.model }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" />
|
||||
</p>
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('hailuo.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.id!" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
@@ -52,46 +64,38 @@
|
||||
<font-awesome-icon icon="fa-solid fa-exclamation-triangle" class="mr-1" />
|
||||
{{ $t('hailuo.name.failure') }}
|
||||
</template>
|
||||
<p class="description">
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('hailuo.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.id!" />
|
||||
</p>
|
||||
<p class="description">
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-circle-info" class="mr-1" />
|
||||
{{ $t('hailuo.name.failureReason') }}:
|
||||
{{ modelValue?.response?.error?.message }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.error?.message!" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.response?.error?.message!" />
|
||||
</p>
|
||||
<p class="description">
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-hashtag" class="mr-1" />
|
||||
{{ $t('hailuo.name.traceId') }}:
|
||||
{{ modelValue?.response?.trace_id }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.trace_id" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.response?.trace_id" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
<!-- Display error message -->
|
||||
<div
|
||||
v-if="
|
||||
!modelValue?.response ||
|
||||
video?.state === 'processing' ||
|
||||
video?.state === 'pending' ||
|
||||
video?.state === 'running'
|
||||
"
|
||||
:class="{ content: true }"
|
||||
>
|
||||
<div v-if="modelValue?.response?.success === undefined" :class="{ content: true }">
|
||||
<el-alert :closable="false" class="info">
|
||||
<template #template>
|
||||
<font-awesome-icon icon="fa-solid fa-exclamation-triangle" class="mr-1" />
|
||||
{{ $t('hailuo.name.failure') }}
|
||||
</template>
|
||||
<p class="description">
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('hailuo.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.id!" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
@@ -102,10 +106,11 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElImage, ElAlert, ElButton, ElTooltip } from 'element-plus';
|
||||
import { IHailuoTask, IHailuoGenerateResponse, IHailuoVideo } from '@/models';
|
||||
import { IHailuoTask, IHailuoVideo } from '@/models';
|
||||
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import VideoPlayer from '../VideoPlayer.vue';
|
||||
import VideoPlayer from '@/components/common/VideoPlayer.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'TaskPreview',
|
||||
components: {
|
||||
@@ -123,9 +128,6 @@ export default defineComponent({
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
application() {
|
||||
return this.$store.state.hailuo?.application;
|
||||
@@ -133,64 +135,14 @@ export default defineComponent({
|
||||
config() {
|
||||
return this.$store.state.hailuo?.config;
|
||||
},
|
||||
videos(): IHailuoVideo[] {
|
||||
let result: IHailuoVideo[] = [];
|
||||
// @ts-ignore
|
||||
const action = this.modelValue?.request?.action;
|
||||
if (Array.isArray(this.modelValue?.response?.data)) {
|
||||
this.modelValue?.response?.data?.forEach((item: any) => {
|
||||
let audio = item as IHailuoVideo;
|
||||
// Add the action field to the audio object
|
||||
if (action) {
|
||||
audio.action = action;
|
||||
}
|
||||
result.push(audio);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
video(): IHailuoVideo | undefined {
|
||||
return this.modelValue?.response?.data?.[0];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onExtend(event: MouseEvent, response: IHailuoGenerateResponse) {
|
||||
event.stopPropagation();
|
||||
// extend url here
|
||||
console.debug('set config', response);
|
||||
this.$store.commit('hailuo/setConfig', {
|
||||
...this.$store.state.hailuo?.config,
|
||||
video_id: response.video_id,
|
||||
prompt: response.prompt,
|
||||
action: 'extend',
|
||||
thumbnail_url: response.thumbnail_url,
|
||||
video_url: response.video_url
|
||||
});
|
||||
},
|
||||
onDownload(event: MouseEvent, video_url: string) {
|
||||
event.stopPropagation();
|
||||
console.log('on download');
|
||||
// download url here
|
||||
console.debug('on download hailuo video', video_url);
|
||||
window.open(video_url, '_blank');
|
||||
},
|
||||
onReload(event: Event) {
|
||||
const target = event.target as HTMLImageElement;
|
||||
// append a random url query to existing url query, to force reload the image
|
||||
// extract exiting url query
|
||||
const url = new URL(target.src);
|
||||
// extract `retry` query
|
||||
const retry = url.searchParams.get('retry');
|
||||
if (!retry) {
|
||||
// if no retry query, set it as random string
|
||||
url.searchParams.set('retry', '1');
|
||||
} else if (parseInt(retry) < 2) {
|
||||
// if retry < 3, increase it by 1
|
||||
url.searchParams.set('retry', (parseInt(retry) + 1).toString());
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
// set the new url
|
||||
target.src = url.toString();
|
||||
},
|
||||
onOpenVideo(url: string) {
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -259,94 +211,6 @@ $left-width: 70px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.image-wrapper {
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
min-height: 50px;
|
||||
min-width: 100px;
|
||||
.image {
|
||||
max-height: 400px;
|
||||
max-width: 500px;
|
||||
display: block;
|
||||
width: fit-content;
|
||||
}
|
||||
.btn-raw {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 1000;
|
||||
display: none;
|
||||
}
|
||||
.play-icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-size: 48px;
|
||||
color: white;
|
||||
z-index: 500;
|
||||
pointer-events: none; /* Ensure the icon doesn't interfere with hover */
|
||||
}
|
||||
&:hover {
|
||||
.image {
|
||||
filter: brightness(0.6);
|
||||
}
|
||||
.btn-raw {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.play-icon {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
.operations {
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
align-items: baseline;
|
||||
flex-wrap: wrap;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 14px;
|
||||
overflow-y: scroll;
|
||||
|
||||
&.full {
|
||||
height: 70px;
|
||||
}
|
||||
|
||||
.btn-action {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.preview {
|
||||
.image.error {
|
||||
background: var(--el-bg-color-page);
|
||||
.image-slot {
|
||||
font-size: 14px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
.failure {
|
||||
background: var(--el-fill-color-light);
|
||||
width: 100%;
|
||||
.el-alert__content {
|
||||
p {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,23 +0,0 @@
|
||||
<template>
|
||||
<div class="panel detail">
|
||||
<task-detail />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import TaskDetail from './task/Detail.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'DetailPanel',
|
||||
components: {
|
||||
TaskDetail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
job: 0
|
||||
};
|
||||
},
|
||||
computed: {}
|
||||
});
|
||||
</script>
|
||||
@@ -1,77 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card v-show="operating">
|
||||
<content-input class="mb-4" />
|
||||
<prompt-input class="mb-4" />
|
||||
<preset-selector class="mb-4" />
|
||||
<div class="actions">
|
||||
<el-button type="primary" class="btn w-full" round @click="onGenerate">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-2" />
|
||||
{{ $t('kling.button.generate') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
<div>
|
||||
<el-button type="primary" class="btn btn-operate" @click="operating = !operating">+</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElButton, ElCard } from 'element-plus';
|
||||
import PresetSelector from './config/PresetSelector2.vue';
|
||||
import ContentInput from './config/ContentInput.vue';
|
||||
import PromptInput from './config/PromptInput.vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'OperationPanel',
|
||||
components: {
|
||||
ElButton,
|
||||
ElCard,
|
||||
PresetSelector,
|
||||
ContentInput,
|
||||
PromptInput,
|
||||
FontAwesomeIcon
|
||||
},
|
||||
emits: ['generate'],
|
||||
data() {
|
||||
return {
|
||||
operating: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onGenerate() {
|
||||
this.$emit('generate');
|
||||
this.operating = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
width: 580px;
|
||||
height: fit-content;
|
||||
overflow-y: scroll;
|
||||
position: absolute;
|
||||
bottom: 70px;
|
||||
left: calc(50% - 300px);
|
||||
@media (max-width: 767px) {
|
||||
width: 100%;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-operate {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
font-size: 24px;
|
||||
line-height: 40px;
|
||||
padding: 0;
|
||||
margin: auto;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
@@ -1,46 +1,27 @@
|
||||
<template>
|
||||
<div ref="panel" class="panel recent" @scroll="onHandleScroll">
|
||||
<div v-if="tasks?.items === undefined" class="tasks">
|
||||
<div v-for="_ in 3" :key="_" class="task placeholder">
|
||||
<div class="left">
|
||||
<el-skeleton animated>
|
||||
<template #template>
|
||||
<el-skeleton-item variant="image" class="avatar" />
|
||||
</template>
|
||||
</el-skeleton>
|
||||
</div>
|
||||
<div class="main">
|
||||
<el-skeleton animated>
|
||||
<template #template>
|
||||
<el-skeleton-item variant="p" class="title" />
|
||||
<el-skeleton-item variant="image" class="icon" />
|
||||
</template>
|
||||
</el-skeleton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else-if="tasks?.items?.length && tasks?.items?.length > 0" class="tasks">
|
||||
<!-- {{ tasks?.items }} -->
|
||||
<task-preview v-for="(task, taskIndex) in tasks?.items" :key="taskIndex" :model-value="task" class="preview" />
|
||||
</div>
|
||||
<p v-if="tasks?.items?.length === 0" class="description">
|
||||
{{ $t('kling.message.noTasks') }}
|
||||
</p>
|
||||
<div v-if="tasks?.items === undefined">
|
||||
<bot-placeholder />
|
||||
</div>
|
||||
<div v-else-if="tasks?.items?.length && tasks?.items?.length > 0" class="h-full w-full overflow-y-auto">
|
||||
<task-preview v-for="(task, taskIndex) in tasks?.items" :key="taskIndex" :model-value="task" />
|
||||
</div>
|
||||
<div v-if="tasks?.items?.length === 0">
|
||||
<no-tasks />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import TaskPreview from './task/Preview.vue';
|
||||
import { ElSkeleton, ElSkeletonItem } from 'element-plus';
|
||||
import BotPlaceholder from '@/components/common/BotPlaceholder.vue';
|
||||
import NoTasks from '@/components/common/NoTasks.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'RecentPanel',
|
||||
components: {
|
||||
TaskPreview,
|
||||
ElSkeleton,
|
||||
ElSkeletonItem
|
||||
NoTasks,
|
||||
BotPlaceholder
|
||||
},
|
||||
emits: ['reach-top'],
|
||||
data() {
|
||||
@@ -68,76 +49,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
&.recent {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
overflow-y: auto;
|
||||
flex-direction: column;
|
||||
.preview {
|
||||
margin-right: 15px;
|
||||
}
|
||||
.description {
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
.tasks {
|
||||
width: 100%;
|
||||
.task {
|
||||
margin-bottom: 15px;
|
||||
width: 100%;
|
||||
height: fit-content;
|
||||
text-align: left;
|
||||
|
||||
&.placeholder {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.left {
|
||||
width: 70px;
|
||||
padding: 10px;
|
||||
|
||||
.avatar {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.main {
|
||||
width: calc(100% - 70px);
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.icon {
|
||||
display: flex;
|
||||
height: 200px;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: block;
|
||||
width: 200px;
|
||||
height: 20px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.operations {
|
||||
height: fit-content !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -9,6 +9,7 @@
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
name="file"
|
||||
accept=".png,.jpg,.jpeg,.gif,.bmp,.webp"
|
||||
:limit="5"
|
||||
class="upload-wrapper"
|
||||
:multiple="false"
|
||||
|
||||
@@ -88,7 +88,7 @@ export default defineComponent({
|
||||
|
||||
.item {
|
||||
width: 48px;
|
||||
height: 65px;
|
||||
height: 70px;
|
||||
border: 1px solid var(--el-border-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -100,6 +100,7 @@ export default defineComponent({
|
||||
margin-top: 8px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-bottom: 4px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<el-upload
|
||||
v-model:file-list="fileList"
|
||||
name="file"
|
||||
accept=".png,.jpg,.jpeg,.gif,.bmp,.webp"
|
||||
:limit="5"
|
||||
class="upload-wrapper"
|
||||
:multiple="false"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="bot">
|
||||
{{ $t('kling.name.klingBot') }}
|
||||
<span class="datetime">
|
||||
{{ $dayjs.format('' + new Date(parseFloat(modelValue?.created_at || '') * 1000)) }}
|
||||
{{ $dayjs.format('' + new Date(parseFloat((modelValue?.created_at || '').toString()) * 1000)) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="info">
|
||||
@@ -28,12 +28,13 @@
|
||||
</div>
|
||||
<!-- Display success message -->
|
||||
<div v-if="modelValue?.response?.success === true" :class="{ content: true, failed: true }">
|
||||
<div class="image-wrapper">
|
||||
<VideoPlayer :model-value="modelValue?.response" />
|
||||
<div class="mb-4">
|
||||
<video-player :model-value="modelValue?.response" />
|
||||
</div>
|
||||
<div v-if="modelValue?.response.success" :class="{ operations: true, 'mt-2': true }">
|
||||
<el-tooltip class="box-item" effect="dark" :content="$t('kling.message.downloadVideo')" placement="top-start">
|
||||
<el-button
|
||||
v-if="modelValue?.response.video_url"
|
||||
type="info"
|
||||
size="small"
|
||||
class="btn-action"
|
||||
@@ -44,11 +45,16 @@
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<el-alert :closable="false" class="mt-2 success">
|
||||
<p class="description">
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-hashtag" class="mr-1" />
|
||||
{{ $t('kling.name.model') }}:
|
||||
{{ modelValue?.request?.model }}
|
||||
</p>
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('kling.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.id!" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
@@ -59,51 +65,44 @@
|
||||
<font-awesome-icon icon="fa-solid fa-exclamation-triangle" class="mr-1" />
|
||||
{{ $t('kling.name.failure') }}
|
||||
</template>
|
||||
<p class="description">
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('kling.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.id!" />
|
||||
</p>
|
||||
<p class="description">
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-circle-info" class="mr-1" />
|
||||
{{ $t('kling.name.failureReason') }}:
|
||||
{{ modelValue?.response?.error?.message }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.error?.message!" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.response?.error?.message!" />
|
||||
</p>
|
||||
<p v-if="modelValue?.response?.trace_id" class="description">
|
||||
<p v-if="modelValue?.response?.trace_id" class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-hashtag" class="mr-1" />
|
||||
{{ $t('kling.name.traceId') }}:
|
||||
{{ modelValue?.response?.trace_id }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.trace_id" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.response?.trace_id" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
<!-- Display error message -->
|
||||
<div
|
||||
v-if="
|
||||
!modelValue?.response ||
|
||||
modelValue?.response?.state === 'processing' ||
|
||||
modelValue?.response?.state === 'pending'
|
||||
"
|
||||
:class="{ content: true }"
|
||||
>
|
||||
<div v-if="modelValue?.response?.success === undefined" :class="{ content: true }">
|
||||
<el-alert :closable="false" class="info">
|
||||
<template #template>
|
||||
<font-awesome-icon icon="fa-solid fa-exclamation-triangle" class="mr-1" />
|
||||
{{ $t('kling.name.failure') }}
|
||||
</template>
|
||||
<p class="description">
|
||||
<p class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-magic" class="mr-1" />
|
||||
{{ $t('kling.name.taskId') }}:
|
||||
{{ modelValue?.id }}
|
||||
<copy-to-clipboard :content="modelValue?.id!" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.id!" />
|
||||
</p>
|
||||
<p v-if="modelValue?.response?.trace_id" class="description">
|
||||
<p v-if="modelValue?.response?.trace_id" class="mb-2">
|
||||
<font-awesome-icon icon="fa-solid fa-hashtag" class="mr-1" />
|
||||
{{ $t('kling.name.traceId') }}:
|
||||
{{ modelValue?.response?.trace_id }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.trace_id" class="btn-copy" />
|
||||
<copy-to-clipboard :content="modelValue?.response?.trace_id" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
@@ -117,7 +116,8 @@ import { ElImage, ElAlert, ElButton, ElTooltip } from 'element-plus';
|
||||
import { IKlingTask } from '@/models';
|
||||
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import VideoPlayer from '../VideoPlayer.vue';
|
||||
import VideoPlayer from '@/components/common/VideoPlayer.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'TaskPreview',
|
||||
components: {
|
||||
@@ -147,44 +147,12 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// onExtend(event: MouseEvent, response: IKlingGenerateResponse) {
|
||||
// event.stopPropagation();
|
||||
// // extend url here
|
||||
// console.debug('set config', response);
|
||||
// this.$store.commit('kling/setConfig', {
|
||||
// ...this.$store.state.kling?.config,
|
||||
// video_id: response.video_id,
|
||||
// prompt: response.prompt,
|
||||
// action: 'extend',
|
||||
// thumbnail_url: response.thumbnail_url,
|
||||
// video_url: response.video_url
|
||||
// });
|
||||
// },
|
||||
onDownload(event: MouseEvent, video_url: string) {
|
||||
event.stopPropagation();
|
||||
console.log('on download');
|
||||
// download url here
|
||||
window.open(video_url, '_blank');
|
||||
},
|
||||
onReload(event: Event) {
|
||||
const target = event.target as HTMLImageElement;
|
||||
// append a random url query to existing url query, to force reload the image
|
||||
// extract exiting url query
|
||||
const url = new URL(target.src);
|
||||
// extract `retry` query
|
||||
const retry = url.searchParams.get('retry');
|
||||
if (!retry) {
|
||||
// if no retry query, set it as random string
|
||||
url.searchParams.set('retry', '1');
|
||||
} else if (parseInt(retry) < 2) {
|
||||
// if retry < 3, increase it by 1
|
||||
url.searchParams.set('retry', (parseInt(retry) + 1).toString());
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
// set the new url
|
||||
target.src = url.toString();
|
||||
},
|
||||
onOpenVideo(url: string) {
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<bot-placeholder />
|
||||
</div>
|
||||
<div v-else-if="tasks && tasks?.length === 0">
|
||||
<p class="p-5 description">{{ $t('midjourney.message.noTasks') }}</p>
|
||||
<no-tasks />
|
||||
</div>
|
||||
<div v-else-if="tasks.length > 0" ref="panel" class="tasks" @scroll="onHandleScroll">
|
||||
<div v-for="(task, taskKey) in tasks" :key="taskKey" class="task">
|
||||
@@ -15,14 +15,15 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import TaskItem from './TaskItem.vue';
|
||||
import { ElSkeleton, ElSkeletonItem } from 'element-plus';
|
||||
import BotPlaceholder from '@/components/common/BotPlaceholder.vue';
|
||||
import NoTasks from '@/components/common/NoTasks.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'TaskList',
|
||||
components: {
|
||||
TaskItem,
|
||||
BotPlaceholder
|
||||
BotPlaceholder,
|
||||
NoTasks
|
||||
},
|
||||
emits: ['update:modelValue', 'custom', 'refresh', 'reach-top'],
|
||||
data() {
|
||||
|
||||
Reference in new issue
Block a user