update preview
This commit is contained in:
1 parent
d3c36def6b
commit
3d1982d533
8 files changed
+48
-15
No files matched your search
@@ -13,8 +13,6 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import AnsweringMark from './AnsweringMark.vue';
|
||||
import { ElImage, ElButton } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import copy from 'copy-to-clipboard';
|
||||
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
|
||||
import { IChatMessage, IChatMessageState } from '@/operators';
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElDropdown, ElButton, ElDropdownItem } from 'element-plus';
|
||||
import { ElButton } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import {
|
||||
IMidjourneyChannel,
|
||||
|
||||
@@ -30,6 +30,10 @@ export default defineComponent({
|
||||
value: this.modelValue,
|
||||
active: 0,
|
||||
options: [
|
||||
{
|
||||
value: '6.0',
|
||||
label: '6.0'
|
||||
},
|
||||
{
|
||||
value: '5.2',
|
||||
label: '5.2'
|
||||
|
||||
@@ -82,13 +82,15 @@ export default defineComponent({
|
||||
limit: 5,
|
||||
ordering: '-created_at'
|
||||
});
|
||||
const tasks = (await midjourneyOperator.tasks(apiUsages.map((apiUsage) => apiUsage.metadata?.task_id as string)))
|
||||
let tasks = (await midjourneyOperator.tasks(apiUsages.map((apiUsage) => apiUsage?.metadata?.task_id as string)))
|
||||
.data;
|
||||
// filter out null tasks
|
||||
tasks = tasks.filter((task) => task);
|
||||
this.tasks = tasks.map((task) => {
|
||||
const apiUsage = apiUsages.filter((apiUsage) => apiUsage.metadata?.task_id === task.id)[0];
|
||||
const apiUsage = apiUsages.filter((apiUsage) => apiUsage?.metadata?.task_id === task?.id)[0];
|
||||
return {
|
||||
...task,
|
||||
created_at: apiUsage.created_at
|
||||
created_at: apiUsage?.created_at
|
||||
};
|
||||
});
|
||||
this.loading = false;
|
||||
|
||||
@@ -33,13 +33,30 @@
|
||||
</template>
|
||||
</el-image>
|
||||
</div>
|
||||
<div v-else-if="modelValue?.response.success === false" :class="{ content: true, full: full, failed: true }">
|
||||
<el-image class="image">
|
||||
<template #error>
|
||||
<div class="image-slot">{{ modelValue?.response?.detail }}</div>
|
||||
<div
|
||||
v-else-if="modelValue?.response.success === false"
|
||||
:class="{ content: true, full: full, failed: true, 'p-2': true }"
|
||||
>
|
||||
<el-alert :closable="false">
|
||||
<template #template>
|
||||
<font-awesome-icon icon="fa-solid fa-exclamation-triangle" class="mr-1" />
|
||||
{{ $t('midjourney.field.failure') }}
|
||||
</template>
|
||||
</el-image>
|
||||
<p class="description">
|
||||
<font-awesome-icon icon="fa-solid fa-circle-info" class="mr-1" />
|
||||
{{ $t('midjourney.field.failureReason') }}:
|
||||
{{ modelValue?.response?.detail }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.detail" class="btn-copy" />
|
||||
</p>
|
||||
<p class="description">
|
||||
<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" class="btn-copy" />
|
||||
</p>
|
||||
</el-alert>
|
||||
</div>
|
||||
|
||||
<div v-else :class="{ content: true, full: full }">
|
||||
<el-image
|
||||
v-if="modelValue?.response?.image_url"
|
||||
@@ -85,7 +102,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElImage, ElTag, ElButton, ElTooltip, ElSkeleton } from 'element-plus';
|
||||
import { ElImage, ElTag, ElButton, ElTooltip, ElSkeleton, ElAlert } from 'element-plus';
|
||||
import { IApplication, IMidjourneyImagineTask, MidjourneyImagineAction, MidjourneyImagineState } from '@/operators';
|
||||
import {
|
||||
API_ID_MIDJOURNEY_FAST,
|
||||
@@ -96,6 +113,7 @@ import {
|
||||
MIDJOURNEY_CHANNEL_TURBO
|
||||
} from '@/operators/midjourney/constants';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
||||
|
||||
interface IData {
|
||||
midjourneyImagineState: typeof MidjourneyImagineState;
|
||||
@@ -111,7 +129,9 @@ export default defineComponent({
|
||||
ElButton,
|
||||
FontAwesomeIcon,
|
||||
ElTooltip,
|
||||
ElSkeleton
|
||||
ElSkeleton,
|
||||
ElAlert,
|
||||
CopyToClipboard
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
@@ -280,7 +300,9 @@ export default defineComponent({
|
||||
position: relative;
|
||||
margin-bottom: 10px;
|
||||
&.full {
|
||||
height: 318px;
|
||||
height: 220px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.image {
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
export default {
|
||||
taskId: '任务 ID',
|
||||
finalPrompt: '最终绘图指令',
|
||||
elements: '绘制风格'
|
||||
elements: '绘制风格',
|
||||
failureReason: '失败原因',
|
||||
traceId: 'Trace ID'
|
||||
};
|
||||
@@ -66,6 +66,7 @@ export interface IMidjourneyImagineResponse {
|
||||
progress: number;
|
||||
image_id: string;
|
||||
image_url: string;
|
||||
trace_id: string;
|
||||
raw_image_url: string;
|
||||
actions: MidjourneyImagineAction[];
|
||||
code?: string;
|
||||
|
||||
@@ -8,6 +8,8 @@ import {
|
||||
faClock as faRegularClock
|
||||
} from '@fortawesome/free-regular-svg-icons';
|
||||
import {
|
||||
faHashtag as faSolidHashtag,
|
||||
faCircleInfo as faSolidCircleInfo,
|
||||
faChevronLeft as faSolidChevronLeft,
|
||||
faMicrophone as faSolidMicrophone,
|
||||
faArrowLeft as faSolidArrowLeft,
|
||||
@@ -67,3 +69,5 @@ library.add(faSolidInfo);
|
||||
library.add(faSolidMagic);
|
||||
library.add(faSolidArrowLeft);
|
||||
library.add(faSolidChevronLeft);
|
||||
library.add(faSolidCircleInfo);
|
||||
library.add(faSolidHashtag);
|
||||
Reference in new issue
Block a user