feat: 图片广场优化

This commit is contained in:
Gsh
2026-01-04 17:09:28 +08:00
parent 9ec9ace8e2
commit 9721b8bd74
7 changed files with 314 additions and 48 deletions

View File

@@ -47,6 +47,7 @@ const currentTaskId = ref('');
const currentTask = ref<TaskStatusResponse | null>(null);
const showViewer = ref(false);
let pollTimer: any = null;
let debounceTimer: any = null;
const canGenerate = computed(() => {
return selectedModelId.value && prompt.value && !generating.value;
@@ -142,6 +143,18 @@ async function handleGenerate() {
if (!canGenerate.value)
return;
// Clear existing debounce timer
if (debounceTimer) {
clearTimeout(debounceTimer);
}
// Set debounce timer
debounceTimer = setTimeout(async () => {
await executeGenerate();
}, 300);
}
async function executeGenerate() {
generating.value = true;
// Reset current task display immediately
currentTask.value = {
@@ -360,7 +373,7 @@ onUnmounted(() => {
配置
</h2>
<el-form label-position="top" class="space-y-2">
<el-form label-position="top" class="space-y-1">
<!-- Token -->
<el-form-item label="API密钥 (可选)">
<el-select
@@ -417,7 +430,7 @@ onUnmounted(() => {
<el-input
v-model="prompt"
type="textarea"
:autosize="{ minRows: 8, maxRows: 15 }"
:autosize="{ minRows: 4, maxRows: 15 }"
placeholder="描述你想要生成的画面,例如:一只在太空中飞行的赛博朋克风格的猫..."
maxlength="2000"
show-word-limit
@@ -456,7 +469,7 @@ onUnmounted(() => {
</el-form>
</div>
<div class="mt-auto pt-4">
<div class="mt-auto pt-1">
<el-button
type="primary"
class="w-full h-12 text-lg shadow-lg shadow-blue-500/30 transition-all hover:shadow-blue-500/50"
@@ -511,6 +524,10 @@ onUnmounted(() => {
<p class="text-gray-400 text-sm mt-2">
请稍候这可能需要几秒钟
</p>
<p class="text-gray-400 text-sm mt-2">
您可以离开或者继续创建下一个任务稍后到我的图库中查看任务进度
</p>
</div>
<!-- Fail State -->
@@ -531,7 +548,7 @@ onUnmounted(() => {
circle
:icon="CopyDocument"
title="复制错误信息"
@click="copyError(currentTask.errorInfo || '')"
@click.stop="copyError(currentTask.errorInfo || '')"
/>
</div>
<el-button class="mt-6" icon="Refresh" @click="handleGenerate">