+
{{ $t('kling.name.failure') }}
-
+
{{ $t('kling.name.taskId') }}:
{{ modelValue?.id }}
-
+
-
+
{{ $t('kling.name.traceId') }}:
{{ modelValue?.response?.trace_id }}
-
+
@@ -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');
}
diff --git a/src/components/midjourney/tasks/TaskList.vue b/src/components/midjourney/tasks/TaskList.vue
index 3e0dbe3b..b6979005 100644
--- a/src/components/midjourney/tasks/TaskList.vue
+++ b/src/components/midjourney/tasks/TaskList.vue
@@ -3,7 +3,7 @@
@@ -15,14 +15,15 @@
diff --git a/src/pages/flux/Index.vue b/src/pages/flux/Index.vue
index 5d0f5206..fb9287cd 100644
--- a/src/pages/flux/Index.vue
+++ b/src/pages/flux/Index.vue
@@ -105,22 +105,6 @@ export default defineComponent({
console.debug('end onGetApplication');
await this.onGetTasks();
},
- onApply() {
- applicationOperator
- .create({
- // @ts-ignore
- application: this.application
- })
- .then(({ data: data }: { data: IApplicationDetailResponse }) => {
- this.application = data;
- ElMessage.success(this.$t('application.message.applySuccessfully'));
- })
- .catch((error) => {
- if (error?.response?.data?.code === ERROR_CODE_DUPLICATION) {
- ElMessage.error(this.$t('application.message.alreadyApplied'));
- }
- });
- },
async onScrollDown() {
setTimeout(() => {
// scroll to bottom for `.tasks`
diff --git a/src/pages/hailuo/Index.vue b/src/pages/hailuo/Index.vue
index 5b5b7b57..b5fa90dc 100644
--- a/src/pages/hailuo/Index.vue
+++ b/src/pages/hailuo/Index.vue
@@ -4,7 +4,7 @@
-
+
@@ -13,10 +13,10 @@
import { defineComponent } from 'vue';
import Layout from '@/layouts/Hailuo.vue';
import ConfigPanel from '@/components/hailuo/ConfigPanel.vue';
-import { applicationOperator, hailuoOperator } from '@/operators';
-import { IApplicationDetailResponse, IHailuoGenerateRequest, Status } from '@/models';
+import { hailuoOperator } from '@/operators';
+import { IHailuoGenerateRequest, Status } from '@/models';
import { ElMessage } from 'element-plus';
-import { ERROR_CODE_DUPLICATION, ERROR_CODE_USED_UP } from '@/constants';
+import { ERROR_CODE_USED_UP } from '@/constants';
import RecentPanel from '@/components/hailuo/RecentPanel.vue';
import { IHailuoTask } from '@/models';
@@ -47,27 +47,15 @@ export default defineComponent({
loading() {
return this.$store.state.hailuo?.status?.getApplications === Status.Request;
},
- service() {
- return this.$store.state.hailuo.service;
- },
credential() {
return this.$store.state.hailuo.credential;
},
config() {
return this.$store.state.hailuo.config;
},
- initializing() {
- return this.$store.state.hailuo.status.getApplications === Status.Request;
- },
- needApply() {
- return this.$store.state.hailuo.status.getApplications === Status.Success && !this.application;
- },
application() {
return this.$store.state.hailuo.application;
},
- applications() {
- return this.$store.state.hailuo.applications;
- },
tasks() {
return this.$store.state.hailuo.tasks;
}
@@ -117,26 +105,9 @@ export default defineComponent({
console.debug('end onGetApplication');
await this.onGetTasks();
},
- onApply() {
- applicationOperator
- .create({
- // @ts-ignore
- application: this.application
- })
- .then(({ data: data }: { data: IApplicationDetailResponse }) => {
- this.application = data;
- ElMessage.success(this.$t('application.message.applySuccessfully'));
- })
- .catch((error) => {
- if (error?.response?.data?.code === ERROR_CODE_DUPLICATION) {
- ElMessage.error(this.$t('application.message.alreadyApplied'));
- }
- });
- },
async onScrollDown() {
setTimeout(() => {
- // scroll to bottom for `.recent`
- const el = document.querySelector('.recent');
+ const el = document.querySelector('.tasks');
if (el) {
el.scrollTop = el.scrollHeight;
}
@@ -173,9 +144,6 @@ export default defineComponent({
})
.then(() => {
ElMessage.success(this.$t('hailuo.message.startTaskSuccess'));
- this.$store.commit('hailuo/setConfig', {
- config: undefined
- });
})
.catch((error) => {
const response = error?.response?.data;
@@ -195,27 +163,3 @@ export default defineComponent({
}
});
-
-
diff --git a/src/pages/kling/Index.vue b/src/pages/kling/Index.vue
index 6c5f29f1..1fdbc5a0 100644
--- a/src/pages/kling/Index.vue
+++ b/src/pages/kling/Index.vue
@@ -4,7 +4,7 @@
-
+
@@ -13,8 +13,8 @@
import { defineComponent } from 'vue';
import Layout from '@/layouts/Kling.vue';
import ConfigPanel from '@/components/kling/ConfigPanel.vue';
-import { applicationOperator, klingOperator } from '@/operators';
-import { IApplicationDetailResponse, IKlingGenerateRequest, Status } from '@/models';
+import { klingOperator } from '@/operators';
+import { IKlingGenerateRequest, Status } from '@/models';
import { ElMessage } from 'element-plus';
import { ERROR_CODE_DUPLICATION, ERROR_CODE_USED_UP } from '@/constants';
import RecentPanel from '@/components/kling/RecentPanel.vue';
@@ -47,27 +47,12 @@ export default defineComponent({
loading() {
return this.$store.state.kling?.status?.getApplications === Status.Request;
},
- service() {
- return this.$store.state.kling.service;
- },
credential() {
return this.$store.state.kling.credential;
},
config() {
return this.$store.state.kling.config;
},
- initializing() {
- return this.$store.state.kling.status.getApplications === Status.Request;
- },
- needApply() {
- return this.$store.state.kling.status.getApplications === Status.Success && !this.application;
- },
- application() {
- return this.$store.state.kling.application;
- },
- applications() {
- return this.$store.state.kling.applications;
- },
tasks() {
return this.$store.state.kling.tasks;
}
@@ -117,26 +102,9 @@ export default defineComponent({
console.debug('end onGetApplication');
await this.onGetTasks();
},
- onApply() {
- applicationOperator
- .create({
- // @ts-ignore
- application: this.application
- })
- .then(({ data: data }: { data: IApplicationDetailResponse }) => {
- this.application = data;
- ElMessage.success(this.$t('application.message.applySuccessfully'));
- })
- .catch((error) => {
- if (error?.response?.data?.code === ERROR_CODE_DUPLICATION) {
- ElMessage.error(this.$t('application.message.alreadyApplied'));
- }
- });
- },
async onScrollDown() {
setTimeout(() => {
- // scroll to bottom for `.recent`
- const el = document.querySelector('.recent');
+ const el = document.querySelector('.tasks');
if (el) {
el.scrollTop = el.scrollHeight;
}
@@ -173,9 +141,6 @@ export default defineComponent({
})
.then(() => {
ElMessage.success(this.$t('kling.message.startTaskSuccess'));
- this.$store.commit('kling/setConfig', {
- config: undefined
- });
})
.catch((error) => {
const response = error?.response?.data;
@@ -195,27 +160,3 @@ export default defineComponent({
}
});
-
-
diff --git a/src/pages/midjourney/Index.vue b/src/pages/midjourney/Index.vue
index 6cbd6baa..828bfb9d 100644
--- a/src/pages/midjourney/Index.vue
+++ b/src/pages/midjourney/Index.vue
@@ -197,22 +197,6 @@ export default defineComponent({
console.debug('end onGetApplications');
await this.onGetTasks();
},
- onApply() {
- applicationOperator
- .create({
- // @ts-ignore
- application: this.application
- })
- .then(({ data: data }: { data: IApplicationDetailResponse }) => {
- this.application = data;
- ElMessage.success(this.$t('application.message.applySuccessfully'));
- })
- .catch((error) => {
- if (error?.response?.data?.code === ERROR_CODE_DUPLICATION) {
- ElMessage.error(this.$t('application.message.alreadyApplied'));
- }
- });
- },
async onStartTask(request: IMidjourneyImagineRequest) {
const token = this.credential?.token;
if (!token) {
diff --git a/src/store/hailuo/persist.ts b/src/store/hailuo/persist.ts
index e7bd0441..9ad2658e 100644
--- a/src/store/hailuo/persist.ts
+++ b/src/store/hailuo/persist.ts
@@ -1 +1 @@
-export default ['hailuo.credential', 'hailuo.application', 'hailuo.applications'];
+export default ['hailuo.config', 'hailuo.credential', 'hailuo.application', 'hailuo.applications'];
diff --git a/src/store/kling/persist.ts b/src/store/kling/persist.ts
index 8d4e5ace..6c8b1d65 100644
--- a/src/store/kling/persist.ts
+++ b/src/store/kling/persist.ts
@@ -1 +1 @@
-export default ['kling.credential', 'kling.application', 'kling.applications'];
+export default ['kling.config', 'kling.credential', 'kling.application', 'kling.applications'];