Fix known bugs of mj chat (#258)

Co-authored-by: AceDataCloud <office@acedata.cloud>
This commit is contained in:
GermeyandAceDataCloud authored and GitHub committed 2025-08-16 17:32:33 +08:00
1 parent 7877ec5c06
commit 8e5711d083
95 files changed
+5899 -5177

No files matched your search

+2 -3
View File
@@ -162,9 +162,8 @@ export default defineComponent({
modelGroup() {
console.debug('modelGroup changed, refreshing conversations');
const firstConversation = this.conversations?.[0];
if (firstConversation) {
this.$emit('change-conversation', firstConversation.id);
}
// will create new conversation once no conversation
this.$emit('change-conversation', firstConversation?.id);
}
},
methods: {
+23 -2
View File
@@ -1,6 +1,6 @@
<template>
<div class="video">
<vue-plyr :options="options">
<vue-plyr :options="mergedOptions">
<video controls crossorigin="anonymous" playsinline>
<source size="1080" :src="src" type="video/mp4" />
</video>
@@ -22,11 +22,32 @@ export default defineComponent({
src: {
type: String,
required: true
},
options: {
type: Object,
required: false,
default: () => ({})
}
},
data() {
return {
options: { quality: { default: '1080p' } }
mergedOptions: {
controls: [
'play-large',
'play',
'progress',
'current-time',
'mute',
'volume',
'captions',
'settings',
'pip',
'fullscreen'
],
iconUrl: 'https://cdn.acedata.cloud/7jq4t0.svg',
quality: { default: '1080p', ...this.options.quality },
...this.options
}
};
}
});
+1 -1
View File
@@ -2,7 +2,7 @@
<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">
<div v-else-if="tasks?.items?.length && tasks?.items?.length > 0" class="h-full w-full overflow-y-auto tasks">
<task-preview v-for="(task, taskIndex) in tasks?.items" :key="taskIndex" :model-value="task" />
</div>
<div v-if="tasks?.items?.length === 0" class="w-full h-full flex items-center justify-center">
+15 -10
View File
@@ -1,10 +1,11 @@
<template>
<div class="flex flex-col h-full">
<div class="flex-1 overflow-y-auto p-[15px]">
<el-tabs v-model="activeTab" class="demo-tabs" stretch>
<el-tab-pane :label="$t('midjourney.tab.images')" name="image">
<el-tabs v-model="type" class="demo-tabs" stretch>
<el-tab-pane :label="$t('midjourney.tab.images')" name="imagine">
<div class="pt-2">
<model-selector class="mb-2" />
<prompt-input class="mb-4" />
<reference-image class="mb-2" />
<ratio-selector class="mb-4" />
<quality-selector class="mb-4" />
@@ -18,11 +19,9 @@
<image-weight-selector class="mb-2" />
<style-selector class="mb-2" />
</div>
<prompt-input class="mb-4" />
</div>
</el-tab-pane>
<el-tab-pane :label="$t('midjourney.tab.videos')" name="video">
<el-tab-pane :label="$t('midjourney.tab.videos')" name="videos">
<div class="pt-2">
<video-from-input v-show="config?.action === 'extend'" class="mb-4" />
<image-url-input class="mb-2" />
@@ -39,7 +38,7 @@
<div class="flex flex-col px-[15px] pb-[15px]">
<consumption :value="consumption" :service="service" />
<div class="flex gap-1">
<mode-selector v-if="activeTab !== 'describe'" />
<mode-selector v-if="type !== 'describe'" />
<el-button v-if="config.action === 'extend'" type="primary" class="btn w-full" round @click="$emit('generate')">
{{ $t('midjourney.button.extend') }}
</el-button>
@@ -73,6 +72,7 @@ import ReferenceImage from './config/ReferenceImage.vue';
import { ElButton, ElTabs, ElTabPane } from 'element-plus';
import Consumption from '../common/Consumption.vue';
import { getConsumption } from '@/utils';
import { MIDJOURNEY_DEFAULT_TYPE } from '@/constants';
export default defineComponent({
name: 'ConfigPanel',
@@ -104,15 +104,15 @@ export default defineComponent({
config() {
return this.$store.state.midjourney.config;
},
activeTab: {
type: {
get() {
return this.$store.state.midjourney.config.active_tab || 'image';
return this.$store.state.midjourney.config.type || MIDJOURNEY_DEFAULT_TYPE;
},
set(val: string) {
console.debug('set active_tab', val);
console.debug('set type', val);
this.$store.commit('midjourney/setConfig', {
...this.$store.state.midjourney.config,
active_tab: val
type: val
});
}
},
@@ -122,6 +122,11 @@ export default defineComponent({
service() {
return this.$store.state.midjourney?.service;
}
},
mounted() {
if (!this.config.type) {
this.type = MIDJOURNEY_DEFAULT_TYPE;
}
}
});
</script>
@@ -9,7 +9,7 @@
<el-input-number v-model="value" controls-position="right" />
</div>
</div>
<div class="w-full">
<div class="w-full px-2">
<el-slider v-model="value" :min="0" :max="100" :step="1" />
</div>
</div>
@@ -9,7 +9,7 @@
<el-input-number v-model="value" size="small" controls-position="right" />
</div>
</div>
<div class="w-full">
<div class="w-full px-2">
<el-slider v-model="value" :min="0" :max="2" :step="0.1" />
</div>
</div>
@@ -9,7 +9,7 @@
<el-input-number v-model="value" controls-position="right" />
</div>
</div>
<div class="w-full">
<div class="w-full px-2">
<el-slider v-model="value" :min="0" :max="100" :step="1" />
</div>
</div>
@@ -4,7 +4,7 @@
<span class="text-sm font-bold">{{ $t('midjourney.name.extend') }}</span>
</div>
<div>
<video-player v-if="config?.video_url" :src="config?.video_url" />
<video-player v-if="config?.video_url" :src="config?.video_url" :options="options" />
</div>
</div>
</template>
@@ -27,7 +27,9 @@ export default defineComponent({
},
data() {
return {
options: { quality: { default: '1080p' } }
options: {
controls: ['play-large', 'play', 'progress', 'current-time', 'mute', 'captions', 'settings', 'fullscreen']
}
};
},
computed: {
@@ -9,7 +9,7 @@
<el-input-number v-model="value" controls-position="right" />
</div>
</div>
<div class="w-full">
<div class="w-full px-2">
<el-slider v-model="value" :min="0" :max="1000" :step="1" />
</div>
</div>
+15 -29
View File
@@ -11,7 +11,7 @@
</span>
</div>
<div class="info">
<p v-if="modelValue?.request?.prompt" class="prompt mt-2">
<p v-if="modelValue?.request?.prompt" class="prompt">
{{ modelValue?.request?.prompt }}
<span v-if="!modelValue?.response"> - ({{ $t('midjourney.status.pending') }}) </span>
<span v-if="modelValue?.response?.progress !== undefined && modelValue?.response?.progress !== 100">
@@ -19,7 +19,7 @@
</span>
<span>({{ modelValue?.request?.mode }})</span>
</p>
<p v-if="modelValue?.request?.image_id" class="prompt mt-2">
<p v-if="modelValue?.request?.image_id" class="prompt">
{{ modelValue?.request?.image_id }} - {{ modelValue?.request?.action }}
<span v-if="!modelValue?.response"> - ({{ $t('midjourney.status.pending') }}) </span>
<span>({{ modelValue?.request?.mode }})</span>
@@ -56,7 +56,7 @@
:raw-src="modelValue?.response?.raw_image_url"
class="image"
/>
<div v-if="modelValue?.response?.actions" :class="{ operations: true, full, 'mt-2': true }">
<div v-if="modelValue?.response?.actions" :class="{ operations: true, full }">
<el-tooltip
v-for="(action, actionKey) in modelValue?.response?.actions"
:key="actionKey"
@@ -122,7 +122,7 @@
</span>
</div>
<div class="info">
<p v-if="modelValue?.request?.prompt" class="prompt mt-2">
<p v-if="modelValue?.request?.prompt" class="prompt">
{{ modelValue?.request?.prompt }}
<span v-if="!modelValue?.response"> - ({{ $t('midjourney.status.pending') }}) </span>
<span v-if="modelValue?.response?.progress !== undefined && modelValue?.response?.progress !== 100">
@@ -130,7 +130,7 @@
</span>
<span>({{ modelValue?.request?.mode }})</span>
</p>
<p v-if="modelValue?.request?.video_id" class="prompt mt-2">
<p v-if="modelValue?.request?.video_id" class="prompt">
{{ modelValue?.request?.video_id }} - {{ modelValue?.request?.action }}
<span v-if="!modelValue?.response"> - ({{ $t('midjourney.status.pending') }}) </span>
<span>({{ modelValue?.request?.mode }})</span>
@@ -207,7 +207,7 @@
</div>
<!-- response pending -->
<div v-if="!modelValue?.response">
<el-alert :closable="false" class="mt-2 info">
<el-alert :closable="false" class="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') }}:
@@ -230,7 +230,7 @@
</span>
</div>
<div class="info">
<p v-if="modelValue?.request?.image_url" class="prompt mt-2">
<p v-if="modelValue?.request?.image_url" class="prompt">
{{ modelValue?.request?.image_url }}
<span v-if="!modelValue?.response?.descriptions"> - ({{ $t('midjourney.status.describePending') }}) </span>
<span v-if="modelValue?.response?.descriptions"> - ({{ $t('midjourney.status.describeComplete') }}) </span>
@@ -262,35 +262,21 @@
</p>
</el-alert>
</div>
<!-- response success -->
<div v-if="modelValue?.response?.descriptions" :class="{ content: true, full: full }">
<div class="mb-4">
<!-- 描述列表 -->
<div class="mb-4">
<div
v-for="(description, index) in modelValue.response.descriptions"
:key="index"
class="flex items-start mb-3"
>
<div class="mb-2">
<div class="mb-2">
<div v-for="(description, index) in modelValue.response.descriptions" :key="index" class="flex items-start">
<div v-if="description !== ''">
<!-- 使用 el-tag 美化序号 -->
<el-tag
effect="dark"
color="#3574F0"
size="small"
type="primary"
class="flex-shrink-0 font-bold mr-3 mt-0.5 border-0"
>
<el-tag effect="dark" size="small" type="primary" round class="mr-1">
{{ index + 1 }}
</el-tag>
<span class="text-sm text-[var(--el-text-color-primary)]">
{{ description }}
<copy-to-clipboard :content="description" />
</span>
</div>
</div>
</div>
<!-- 参考图片 -->
<image-wrapper
v-if="modelValue?.request?.image_url"
:src="modelValue?.request?.image_url"
@@ -298,7 +284,7 @@
class="image w-full rounded-lg"
/>
</div>
<el-alert :closable="false" class="mt-2 success">
<el-alert :closable="false" class="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') }}:
@@ -315,7 +301,7 @@
</div>
<!-- response pending -->
<div v-if="!modelValue?.response">
<el-alert :closable="false" class="mt-2 info">
<el-alert :closable="false" class="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') }}:
@@ -496,7 +482,7 @@ $left-width: 70px;
font-size: 16px;
font-weight: bold;
color: rgb(46, 204, 113);
margin-bottom: 0;
margin-bottom: 10px;
margin-top: 0;
.datetime {
font-size: 12px;
+1 -2
View File
@@ -8,7 +8,7 @@
<div
v-else-if="tasks.length > 0"
ref="panel"
class="p-2 h-full flex flex-col overflow-y-auto"
class="p-2 py-3 h-full flex flex-col overflow-y-auto tasks"
@scroll="onHandleScroll"
>
<task-item
@@ -52,7 +52,6 @@ export default defineComponent({
methods: {
onHandleScroll() {
const el = this.$refs.panel as HTMLElement;
console.log('onHandleScroll ', el.scrollTop);
if (el.scrollTop === 0) {
console.log('reach-top reach-top');
this.$emit('reach-top');
+1 -1
View File
@@ -2,7 +2,7 @@
<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">
<div v-else-if="tasks?.items?.length && tasks?.items?.length > 0" class="h-full w-full overflow-y-auto tasks">
<task-preview v-for="(task, taskIndex) in tasks?.items" :key="taskIndex" :model-value="task" />
</div>
<div v-if="tasks?.items?.length === 0" class="w-full h-full flex items-center justify-center">
+1 -1
View File
@@ -14,7 +14,7 @@
<div class="content">
<div class="artist">
<el-avatar :size="30" :src="audio?.image_url"></el-avatar>
<span>{{ audio?.prompt }}</span>
<span>{{ audio?.title }}</span>
</div>
<p class="style">{{ audio?.style }}</p>
<p class="time">{{ $dayjs.format(audio?.created_at) }}</p>
@@ -7,9 +7,9 @@
class="control"
@click="togglePlay"
/>
<el-popover placement="top" width="50px">
<el-popover placement="top" width="50px" trigger="click">
<template #reference>
<icon-park :icon="VolumeSmall" size="20" :stroke-width="3" class="hover-text" />
<icon-park :icon="VolumeSmall" size="20" :stroke-width="2" class="hover-text" />
</template>
<player-volume-slider />
</el-popover>
@@ -1,34 +1,21 @@
<template>
<div class="player-volume flex flex-col items-center pt-2">
<div>
<el-slider
v-model="volume"
vertical
height="100px"
:show-tooltip="false"
:max="100"
:min="0"
size="small"
:disabled="muted"
@input="setVolume"
/>
</div>
<el-slider
v-model="volume"
vertical
height="100px"
:show-tooltip="false"
:max="100"
:min="0"
size="small"
:disabled="muted"
@input="setVolume"
/>
<div class="text-sm mt-3">{{ volume }}</div>
<div class="mt-2">
<icon-park
:icon="muted ? VolumeMute : VolumeSmall"
size="16"
theme="filled"
class="hover-text"
@click="toggleMuted"
/>
</div>
</div>
</template>
<script setup lang="ts">
import { VolumeMute, VolumeSmall } from '@icon-park/vue-next';
import IconPark from '@/components/common/IconPark.vue';
import { ElSlider } from 'element-plus';
import { computed } from 'vue';
import { useStore } from 'vuex';
@@ -44,8 +31,6 @@ const muted = computed({
set: (value) => store.commit('suno/setAudio', { ...store.state.suno.audio, muted: value })
});
const toggleMuted = () => store.dispatch('suno/toggleMuted');
const setVolume = (value: any) => store.dispatch('suno/setVolume', value);
</script>
<style lang="scss">
+1 -1
View File
@@ -2,7 +2,7 @@
<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">
<div v-else-if="tasks?.items?.length && tasks?.items?.length > 0" class="tasks 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" class="w-full h-full flex items-center justify-center">