Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style: redesign image / video (#13126)

CanisMinor57469f860e4e
diff --git a/locales/ar/components.json b/locales/ar/components.json
index e5645f0d16d..af0b2663361 100644
--- a/locales/ar/components.json
+++ b/locales/ar/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "فشل في التجزئة، يرجى التحقق والمحاولة مرة أخرى. تفاصيل الخطأ:",
"FileParsingStatus.chunks.status.processing": "جارٍ التجزئة",
"FileParsingStatus.chunks.status.processingTip": "الخادم يقوم بتقسيم أجزاء النص؛ إغلاق الصفحة لن يؤثر على تقدم التجزئة.",
+ "GenerationModelItem.creditsPerImageApproximate": "تقريباً {{amount}} ائتمانات / صورة",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} ائتمانات / صورة",
+ "GenerationModelItem.creditsPerVideoApproximate": "تقريباً {{amount}} ائتمانات / فيديو",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} ائتمانات / فيديو",
"GoBack.back": "رجوع",
"HtmlPreview.actions.download": "تنزيل",
"HtmlPreview.actions.preview": "معاينة",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "النص",
"ModelSwitchPanel.detail.pricing.input": "المدخلات ${{amount}}/مليون",
"ModelSwitchPanel.detail.pricing.output": "المخرجات ${{amount}}/مليون",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / صورة",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / فيديو",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "مدخل صوتي",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "مدخل صوتي (مخزن)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "مخرج صوتي",
diff --git a/locales/ar/image.json b/locales/ar/image.json
index 7718fd6d5ce..91a6cb3df9d 100644
--- a/locales/ar/image.json
+++ b/locales/ar/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "صور مرجعية",
"config.model.label": "النموذج",
"config.prompt.placeholder": "صف ما ترغب في إنشائه",
+ "config.prompt.placeholderWithRef": "وصف كيف تريد تعديل الصورة",
"config.quality.label": "جودة الصورة",
"config.quality.options.hd": "عالية الدقة",
"config.quality.options.standard": "قياسية",
@@ -22,7 +23,7 @@
"config.seed.random": "بذرة عشوائية",
"config.size.label": "الحجم",
"config.steps.label": "الخطوات",
- "config.title": "صورة بالذكاء الاصطناعي",
+ "config.title": "الإعدادات",
"config.width.label": "العرض",
"generation.actions.applySeed": "تطبيق البذرة",
"generation.actions.copyError": "نسخ رسالة الخطأ",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "يدعم عدة مزودي خدمات لإنشاء الصور بالذكاء الاصطناعي، بما في ذلك OpenAI gpt-image-1 وGoogle Imagen وFAL.ai والمزيد، مما يوفر مجموعة واسعة من النماذج.",
"notSupportGuide.features.multiProviders.title": "دعم متعدد المزودين",
"notSupportGuide.title": "وضع النشر الحالي لا يدعم إنشاء الصور بالذكاء الاصطناعي",
- "topic.createNew": "موضوع جديد",
+ "topic.createNew": "إنشاء موضوع جديد",
"topic.deleteConfirm": "حذف موضوع الإنشاء",
"topic.deleteConfirmDesc": "أنت على وشك حذف موضوع الإنشاء هذا. لا يمكن التراجع عن هذا الإجراء، يرجى المتابعة بحذر.",
"topic.empty": "لا توجد مواضيع إنشاء",
diff --git a/locales/ar/video.json b/locales/ar/video.json
index 06197411649..880375bcbbb 100644
--- a/locales/ar/video.json
+++ b/locales/ar/video.json
@@ -7,6 +7,7 @@
"config.header.title": "فيديو",
"config.imageUrl.label": "الإطار الابتدائي",
"config.prompt.placeholder": "صف الفيديو الذي ترغب في إنشائه",
+ "config.prompt.placeholderWithRef": "وصف المشهد الذي تريد إنشاؤه مع الصورة",
"config.referenceImage.label": "صورة مرجعية",
"config.resolution.label": "الدقة",
"config.seed.label": "البذرة",
@@ -20,7 +21,7 @@
"generation.status.failed": "فشل في الإنشاء",
"generation.status.generating": "جارٍ الإنشاء...",
"generation.validation.endFrameRequiresStartFrame": "لا يمكن استخدام الإطار النهائي بدون إطار ابتدائي. يرجى تعيين إطار ابتدائي أولاً.",
- "topic.createNew": "موضوع جديد",
+ "topic.createNew": "إنشاء موضوع جديد",
"topic.deleteConfirm": "حذف موضوع الفيديو",
"topic.deleteConfirmDesc": "أنت على وشك حذف موضوع الفيديو هذا. لا يمكن التراجع عن هذا الإجراء.",
"topic.title": "مواضيع الفيديو",
diff --git a/locales/bg-BG/components.json b/locales/bg-BG/components.json
index 5f177e51149..93f32f73cc3 100644
--- a/locales/bg-BG/components.json
+++ b/locales/bg-BG/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "Разделянето не бе успешно, моля, проверете и опитайте отново. Подробности за грешката:",
"FileParsingStatus.chunks.status.processing": "Разделяне",
"FileParsingStatus.chunks.status.processingTip": "Сървърът разделя текстовите части; затварянето на страницата няма да прекъсне процеса.",
+ "GenerationModelItem.creditsPerImageApproximate": "Прибл. {{amount}} Кредита / изображение",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} Кредита / изображение",
+ "GenerationModelItem.creditsPerVideoApproximate": "Прибл. {{amount}} Кредита / видео",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} Кредита / видео",
"GoBack.back": "Назад",
"HtmlPreview.actions.download": "Изтегли",
"HtmlPreview.actions.preview": "Преглед",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "Текст",
"ModelSwitchPanel.detail.pricing.input": "Вход ${{amount}}/М",
"ModelSwitchPanel.detail.pricing.output": "Изход ${{amount}}/М",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / изображение",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / видео",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "Аудио вход",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "Аудио вход (кеширан)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "Аудио изход",
diff --git a/locales/bg-BG/image.json b/locales/bg-BG/image.json
index 4adb7b3339d..c27e7f8f2c4 100644
--- a/locales/bg-BG/image.json
+++ b/locales/bg-BG/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "Референтни изображения",
"config.model.label": "Модел",
"config.prompt.placeholder": "Опишете какво искате да генерирате",
+ "config.prompt.placeholderWithRef": "Опишете как искате да промените изображението",
"config.quality.label": "Качество на изображението",
"config.quality.options.hd": "Висока резолюция",
"config.quality.options.standard": "Стандартно",
@@ -22,7 +23,7 @@
"config.seed.random": "Случаен сийд",
"config.size.label": "Размер",
"config.steps.label": "Стъпки",
- "config.title": "AI Изображение",
+ "config.title": "Конфигурация",
"config.width.label": "Ширина",
"generation.actions.applySeed": "Приложи сийд",
"generation.actions.copyError": "Копирай съобщението за грешка",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "Поддържа множество доставчици на AI генериране на изображения, включително OpenAI gpt-image-1, Google Imagen, FAL.ai и други, предлагащи богат избор от модели.",
"notSupportGuide.features.multiProviders.title": "Поддръжка на множество доставчици",
"notSupportGuide.title": "Текущият режим на внедряване не поддържа AI генериране на изображения",
- "topic.createNew": "Нова тема",
+ "topic.createNew": "Създаване на нова тема",
"topic.deleteConfirm": "Изтриване на тема за генериране",
"topic.deleteConfirmDesc": "Ще изтриете тази тема за генериране. Това действие не може да бъде отменено, моля, бъдете внимателни.",
"topic.empty": "Няма теми за генериране",
diff --git a/locales/bg-BG/video.json b/locales/bg-BG/video.json
index 04f7f88dfcc..cc89cc41a74 100644
--- a/locales/bg-BG/video.json
+++ b/locales/bg-BG/video.json
@@ -7,6 +7,7 @@
"config.header.title": "Видео",
"config.imageUrl.label": "Начална рамка",
"config.prompt.placeholder": "Опишете видеото, което искате да генерирате",
+ "config.prompt.placeholderWithRef": "Опишете сцената, която искате да създадете с изображението",
"config.referenceImage.label": "Референтно изображение",
"config.resolution.label": "Резолюция",
"config.seed.label": "Сийд",
@@ -20,7 +21,7 @@
"generation.status.failed": "Генерирането неуспешно",
"generation.status.generating": "Генериране...",
"generation.validation.endFrameRequiresStartFrame": "Крайната рамка не може да се използва без начална рамка. Моля, задайте първо начална рамка.",
- "topic.createNew": "Нова тема",
+ "topic.createNew": "Създаване на нова тема",
"topic.deleteConfirm": "Изтриване на видео тема",
"topic.deleteConfirmDesc": "Ще изтриете тази видео тема. Това действие не може да бъде отменено.",
"topic.title": "Видео теми",
diff --git a/locales/de-DE/components.json b/locales/de-DE/components.json
index a092413181a..8208c906ecc 100644
--- a/locales/de-DE/components.json
+++ b/locales/de-DE/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "Segmentierung fehlgeschlagen, bitte überprüfen und erneut versuchen. Fehlerdetails:",
"FileParsingStatus.chunks.status.processing": "Segmentierung",
"FileParsingStatus.chunks.status.processingTip": "Der Server teilt Textsegmente auf; das Schließen der Seite beeinflusst den Fortschritt nicht.",
+ "GenerationModelItem.creditsPerImageApproximate": "Ca. {{amount}} Credits / Bild",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} Credits / Bild",
+ "GenerationModelItem.creditsPerVideoApproximate": "Ca. {{amount}} Credits / Video",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} Credits / Video",
"GoBack.back": "Zurück",
"HtmlPreview.actions.download": "Herunterladen",
"HtmlPreview.actions.preview": "Vorschau",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "Text",
"ModelSwitchPanel.detail.pricing.input": "Input ${{amount}}/M",
"ModelSwitchPanel.detail.pricing.output": "Output ${{amount}}/M",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / Bild",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / Video",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "Audioeingabe",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "Audioeingabe (Cache)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "Audioausgabe",
diff --git a/locales/de-DE/image.json b/locales/de-DE/image.json
index dedfd1f3da6..ca7d145351c 100644
--- a/locales/de-DE/image.json
+++ b/locales/de-DE/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "Referenzbilder",
"config.model.label": "Modell",
"config.prompt.placeholder": "Beschreiben Sie, was Sie generieren möchten",
+ "config.prompt.placeholderWithRef": "Beschreiben Sie, wie Sie das Bild anpassen möchten",
"config.quality.label": "Bildqualität",
"config.quality.options.hd": "Hohe Auflösung",
"config.quality.options.standard": "Standard",
@@ -22,7 +23,7 @@
"config.seed.random": "Zufälliger Seed",
"config.size.label": "Größe",
"config.steps.label": "Schritte",
- "config.title": "KI-Bild",
+ "config.title": "Konfiguration",
"config.width.label": "Breite",
"generation.actions.applySeed": "Seed anwenden",
"generation.actions.copyError": "Fehlermeldung kopieren",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "Unterstützt mehrere Anbieter für KI-Bilderzeugung, darunter OpenAI gpt-image-1, Google Imagen, FAL.ai und weitere – für eine große Modellauswahl.",
"notSupportGuide.features.multiProviders.title": "Unterstützung mehrerer Anbieter",
"notSupportGuide.title": "Aktueller Bereitstellungsmodus unterstützt keine KI-Bilderzeugung",
- "topic.createNew": "Neues Thema",
+ "topic.createNew": "Neues Thema erstellen",
"topic.deleteConfirm": "Generierungsthema löschen",
"topic.deleteConfirmDesc": "Sie sind dabei, dieses Generierungsthema zu löschen. Diese Aktion kann nicht rückgängig gemacht werden. Bitte seien Sie vorsichtig.",
"topic.empty": "Keine Generierungsthemen",
diff --git a/locales/de-DE/video.json b/locales/de-DE/video.json
index 828479f4529..4f1d7d5be65 100644
--- a/locales/de-DE/video.json
+++ b/locales/de-DE/video.json
@@ -7,6 +7,7 @@
"config.header.title": "Video",
"config.imageUrl.label": "Startbild",
"config.prompt.placeholder": "Beschreiben Sie das Video, das Sie erstellen möchten",
+ "config.prompt.placeholderWithRef": "Beschreiben Sie die Szene, die Sie mit dem Bild erstellen möchten",
"config.referenceImage.label": "Referenzbild",
"config.resolution.label": "Auflösung",
"config.seed.label": "Seed",
@@ -20,7 +21,7 @@
"generation.status.failed": "Erstellung fehlgeschlagen",
"generation.status.generating": "Wird erstellt...",
"generation.validation.endFrameRequiresStartFrame": "Ein Endbild kann nicht ohne ein Startbild verwendet werden. Bitte zuerst ein Startbild festlegen.",
- "topic.createNew": "Neues Thema",
+ "topic.createNew": "Neues Thema erstellen",
"topic.deleteConfirm": "Video-Thema löschen",
"topic.deleteConfirmDesc": "Sie sind dabei, dieses Video-Thema zu löschen. Diese Aktion kann nicht rückgängig gemacht werden.",
"topic.title": "Video-Themen",
diff --git a/locales/en-US/components.json b/locales/en-US/components.json
index 3e3127671c8..48ef705aee1 100644
--- a/locales/en-US/components.json
+++ b/locales/en-US/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "Chunking failed, please check and try again. Error detail:",
"FileParsingStatus.chunks.status.processing": "Chunking",
"FileParsingStatus.chunks.status.processingTip": "The server is splitting text chunks; closing the page will not affect the chunking progress.",
+ "GenerationModelItem.creditsPerImageApproximate": "Approx. {{amount}} Credits / image",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} Credits / image",
+ "GenerationModelItem.creditsPerVideoApproximate": "Approx. {{amount}} Credits / video",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} Credits / video",
"GoBack.back": "Back",
"HtmlPreview.actions.download": "Download",
"HtmlPreview.actions.preview": "Preview",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "Text",
"ModelSwitchPanel.detail.pricing.input": "Input ${{amount}}/M",
"ModelSwitchPanel.detail.pricing.output": "Output ${{amount}}/M",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ ${{amount}} / image",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ ${{amount}} / video",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "Audio Input",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "Audio Input (Cached)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "Audio Output",
diff --git a/locales/en-US/image.json b/locales/en-US/image.json
index eaf690e128e..4bab39f03ee 100644
--- a/locales/en-US/image.json
+++ b/locales/en-US/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "Reference Images",
"config.model.label": "Model",
"config.prompt.placeholder": "Describe what you want to generate",
+ "config.prompt.placeholderWithRef": "Describe how you want to adjust the image",
"config.quality.label": "Image Quality",
"config.quality.options.hd": "High Definition",
"config.quality.options.standard": "Standard",
@@ -22,7 +23,7 @@
"config.seed.random": "Random Seed",
"config.size.label": "Size",
"config.steps.label": "Steps",
- "config.title": "AI Image",
+ "config.title": "Configuration",
"config.width.label": "Width",
"generation.actions.applySeed": "Apply Seed",
"generation.actions.copyError": "Copy Error Message",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "Supports multiple AI image generation providers, including OpenAI gpt-image-1, Google Imagen, FAL.ai, and more, offering a wide selection of models.",
"notSupportGuide.features.multiProviders.title": "Multi-Provider Support",
"notSupportGuide.title": "Current Deployment Mode Does Not Support AI Image Generation",
- "topic.createNew": "New Topic",
+ "topic.createNew": "Create New Topic",
"topic.deleteConfirm": "Delete Generation Topic",
"topic.deleteConfirmDesc": "You are about to delete this generation topic. This action cannot be undone, please proceed with caution.",
"topic.empty": "No generation topics",
diff --git a/locales/en-US/video.json b/locales/en-US/video.json
index dbe93a3ffbf..d9303748868 100644
--- a/locales/en-US/video.json
+++ b/locales/en-US/video.json
@@ -7,6 +7,7 @@
"config.header.title": "Video",
"config.imageUrl.label": "Start Frame",
"config.prompt.placeholder": "Describe the video you want to generate",
+ "config.prompt.placeholderWithRef": "Describe the scene you want to generate with the image",
"config.referenceImage.label": "Reference Image",
"config.resolution.label": "Resolution",
"config.seed.label": "Seed",
@@ -20,7 +21,7 @@
"generation.status.failed": "Generation Failed",
"generation.status.generating": "Generating...",
"generation.validation.endFrameRequiresStartFrame": "End frame cannot be used without a start frame. Please set a start frame first.",
- "topic.createNew": "New Topic",
+ "topic.createNew": "Create New Topic",
"topic.deleteConfirm": "Delete Video Topic",
"topic.deleteConfirmDesc": "You are about to delete this video topic. This action cannot be undone.",
"topic.title": "Video Topics",
diff --git a/locales/es-ES/components.json b/locales/es-ES/components.json
index c5f980755fd..c409d734458 100644
--- a/locales/es-ES/components.json
+++ b/locales/es-ES/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "Error al fragmentar, por favor revisa e inténtalo de nuevo. Detalle del error:",
"FileParsingStatus.chunks.status.processing": "Fragmentando",
"FileParsingStatus.chunks.status.processingTip": "El servidor está dividiendo los fragmentos de texto; cerrar la página no afectará el progreso.",
+ "GenerationModelItem.creditsPerImageApproximate": "Aprox. {{amount}} Créditos / imagen",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} Créditos / imagen",
+ "GenerationModelItem.creditsPerVideoApproximate": "Aprox. {{amount}} Créditos / video",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} Créditos / video",
"GoBack.back": "Volver",
"HtmlPreview.actions.download": "Descargar",
"HtmlPreview.actions.preview": "Vista previa",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "Texto",
"ModelSwitchPanel.detail.pricing.input": "Entrada ${{amount}}/M",
"ModelSwitchPanel.detail.pricing.output": "Salida ${{amount}}/M",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / imagen",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / video",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "Entrada de audio",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "Entrada de audio (en caché)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "Salida de audio",
diff --git a/locales/es-ES/image.json b/locales/es-ES/image.json
index f9ea89f565c..c91c9500301 100644
--- a/locales/es-ES/image.json
+++ b/locales/es-ES/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "Imágenes de referencia",
"config.model.label": "Modelo",
"config.prompt.placeholder": "Describe lo que deseas generar",
+ "config.prompt.placeholderWithRef": "Describe cómo quieres ajustar la imagen",
"config.quality.label": "Calidad de imagen",
"config.quality.options.hd": "Alta definición",
"config.quality.options.standard": "Estándar",
@@ -22,7 +23,7 @@
"config.seed.random": "Semilla aleatoria",
"config.size.label": "Tamaño",
"config.steps.label": "Pasos",
- "config.title": "Imagen con IA",
+ "config.title": "Configuración",
"config.width.label": "Anchura",
"generation.actions.applySeed": "Aplicar semilla",
"generation.actions.copyError": "Copiar mensaje de error",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "Admite múltiples proveedores de generación de imágenes con IA, incluyendo OpenAI gpt-image-1, Google Imagen, FAL.ai y más, ofreciendo una amplia selección de modelos.",
"notSupportGuide.features.multiProviders.title": "Compatibilidad con múltiples proveedores",
"notSupportGuide.title": "El modo de implementación actual no admite la generación de imágenes con IA",
- "topic.createNew": "Nuevo tema",
+ "topic.createNew": "Crear nuevo tema",
"topic.deleteConfirm": "Eliminar tema de generación",
"topic.deleteConfirmDesc": "Estás a punto de eliminar este tema de generación. Esta acción no se puede deshacer, procede con precaución.",
"topic.empty": "No hay temas de generación",
diff --git a/locales/es-ES/video.json b/locales/es-ES/video.json
index 98981cc174d..16b0bfef264 100644
--- a/locales/es-ES/video.json
+++ b/locales/es-ES/video.json
@@ -7,6 +7,7 @@
"config.header.title": "Vídeo",
"config.imageUrl.label": "Fotograma inicial",
"config.prompt.placeholder": "Describe el vídeo que deseas generar",
+ "config.prompt.placeholderWithRef": "Describe la escena que deseas generar con la imagen",
"config.referenceImage.label": "Imagen de referencia",
"config.resolution.label": "Resolución",
"config.seed.label": "Semilla",
@@ -20,7 +21,7 @@
"generation.status.failed": "Generación fallida",
"generation.status.generating": "Generando...",
"generation.validation.endFrameRequiresStartFrame": "El fotograma final no puede usarse sin un fotograma inicial. Por favor, establece primero un fotograma inicial.",
- "topic.createNew": "Nuevo tema",
+ "topic.createNew": "Crear nuevo tema",
"topic.deleteConfirm": "Eliminar tema de vídeo",
"topic.deleteConfirmDesc": "Estás a punto de eliminar este tema de vídeo. Esta acción no se puede deshacer.",
"topic.title": "Temas de vídeo",
diff --git a/locales/fa-IR/components.json b/locales/fa-IR/components.json
index add54ba2100..13ddcce9c6b 100644
--- a/locales/fa-IR/components.json
+++ b/locales/fa-IR/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "تقسیم‌بندی ناموفق بود، لطفاً بررسی کرده و دوباره تلاش کنید. جزئیات خطا:",
"FileParsingStatus.chunks.status.processing": "در حال تقسیم‌بندی",
"FileParsingStatus.chunks.status.processingTip": "سرور در حال تقسیم متن به بخش‌هاست؛ بستن صفحه تأثیری بر روند تقسیم ندارد.",
+ "GenerationModelItem.creditsPerImageApproximate": "تقریباً {{amount}} اعتبار / تصویر",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} اعتبار / تصویر",
+ "GenerationModelItem.creditsPerVideoApproximate": "تقریباً {{amount}} اعتبار / ویدیو",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} اعتبار / ویدیو",
"GoBack.back": "بازگشت",
"HtmlPreview.actions.download": "دانلود",
"HtmlPreview.actions.preview": "پیش‌نمایش",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "متن",
"ModelSwitchPanel.detail.pricing.input": "ورودی ${{amount}}/میلیون",
"ModelSwitchPanel.detail.pricing.output": "خروجی ${{amount}}/میلیون",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / تصویر",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / ویدیو",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "ورودی صوتی",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "ورودی صوتی (کش‌شده)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "خروجی صوتی",
diff --git a/locales/fa-IR/image.json b/locales/fa-IR/image.json
index d3a470755d3..985a8d55cb6 100644
--- a/locales/fa-IR/image.json
+++ b/locales/fa-IR/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "تصاویر مرجع",
"config.model.label": "مدل",
"config.prompt.placeholder": "توصیف کنید که چه چیزی می‌خواهید تولید شود",
+ "config.prompt.placeholderWithRef": "توضیح دهید که چگونه می‌خواهید تصویر را تنظیم کنید",
"config.quality.label": "کیفیت تصویر",
"config.quality.options.hd": "وضوح بالا",
"config.quality.options.standard": "استاندارد",
@@ -22,7 +23,7 @@
"config.seed.random": "بذر تصادفی",
"config.size.label": "اندازه",
"config.steps.label": "مراحل",
- "config.title": "تصویر هوش مصنوعی",
+ "config.title": "پیکربندی",
"config.width.label": "عرض",
"generation.actions.applySeed": "اعمال بذر",
"generation.actions.copyError": "کپی پیام خطا",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "پشتیبانی از چندین ارائه‌دهنده تولید تصویر هوش مصنوعی، از جمله OpenAI gpt-image-1، Google Imagen، FAL.ai و دیگران، با ارائه انتخاب گسترده‌ای از مدل‌ها.",
"notSupportGuide.features.multiProviders.title": "پشتیبانی از چند ارائه‌دهنده",
"notSupportGuide.title": "حالت فعلی استقرار از تولید تصویر با هوش مصنوعی پشتیبانی نمی‌کند",
- "topic.createNew": "موضوع جدید",
+ "topic.createNew": "ایجاد موضوع جدید",
"topic.deleteConfirm": "حذف موضوع تولید",
"topic.deleteConfirmDesc": "در حال حذف این موضوع تولید هستید. این عمل قابل بازگشت نیست، لطفاً با احتیاط ادامه دهید.",
"topic.empty": "هیچ موضوع تولیدی وجود ندارد",
diff --git a/locales/fa-IR/video.json b/locales/fa-IR/video.json
index 944645c92a2..b9893c41088 100644
--- a/locales/fa-IR/video.json
+++ b/locales/fa-IR/video.json
@@ -7,6 +7,7 @@
"config.header.title": "ویدیو",
"config.imageUrl.label": "فریم آغازین",
"config.prompt.placeholder": "ویدیویی که می‌خواهید تولید شود را توصیف کنید",
+ "config.prompt.placeholderWithRef": "صحنه‌ای که می‌خواهید با تصویر ایجاد کنید را توصیف کنید",
"config.referenceImage.label": "تصویر مرجع",
"config.resolution.label": "وضوح تصویر",
"config.seed.label": "بذر (Seed)",
@@ -20,7 +21,7 @@
"generation.status.failed": "تولید ناموفق بود",
"generation.status.generating": "در حال تولید...",
"generation.validation.endFrameRequiresStartFrame": "استفاده از فریم پایانی بدون فریم آغازین امکان‌پذیر نیست. لطفاً ابتدا فریم آغازین را تنظیم کنید.",
- "topic.createNew": "موضوع جدید",
+ "topic.createNew": "ایجاد موضوع جدید",
"topic.deleteConfirm": "حذف موضوع ویدیو",
"topic.deleteConfirmDesc": "در حال حذف این موضوع ویدیو هستید. این عملیات قابل بازگشت نیست.",
"topic.title": "موضوعات ویدیو",
diff --git a/locales/fr-FR/components.json b/locales/fr-FR/components.json
index 47e5d89b95a..9c1ca25dd1a 100644
--- a/locales/fr-FR/components.json
+++ b/locales/fr-FR/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "Échec du découpage, veuillez vérifier et réessayer. Détail de l'erreur :",
"FileParsingStatus.chunks.status.processing": "Découpage",
"FileParsingStatus.chunks.status.processingTip": "Le serveur est en train de découper le texte ; fermer la page n'interrompra pas le processus.",
+ "GenerationModelItem.creditsPerImageApproximate": "Env. {{amount}} Crédits / image",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} Crédits / image",
+ "GenerationModelItem.creditsPerVideoApproximate": "Env. {{amount}} Crédits / vidéo",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} Crédits / vidéo",
"GoBack.back": "Retour",
"HtmlPreview.actions.download": "Télécharger",
"HtmlPreview.actions.preview": "Aperçu",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "Texte",
"ModelSwitchPanel.detail.pricing.input": "Entrée ${{amount}}/M",
"ModelSwitchPanel.detail.pricing.output": "Sortie ${{amount}}/M",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / image",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / vidéo",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "Entrée audio",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "Entrée audio (en cache)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "Sortie audio",
diff --git a/locales/fr-FR/image.json b/locales/fr-FR/image.json
index 86f43e83ba0..c1b8e2ed18e 100644
--- a/locales/fr-FR/image.json
+++ b/locales/fr-FR/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "Images de référence",
"config.model.label": "Modèle",
"config.prompt.placeholder": "Décrivez ce que vous souhaitez générer",
+ "config.prompt.placeholderWithRef": "Décrivez comment vous souhaitez ajuster l'image",
"config.quality.label": "Qualité de l'image",
"config.quality.options.hd": "Haute définition",
"config.quality.options.standard": "Standard",
@@ -22,7 +23,7 @@
"config.seed.random": "Graine aléatoire",
"config.size.label": "Taille",
"config.steps.label": "Étapes",
- "config.title": "Image IA",
+ "config.title": "Configuration",
"config.width.label": "Largeur",
"generation.actions.applySeed": "Appliquer la graine",
"generation.actions.copyError": "Copier le message d'erreur",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "Prend en charge plusieurs fournisseurs de génération d'images IA, y compris OpenAI gpt-image-1, Google Imagen, FAL.ai, et d'autres, offrant un large choix de modèles.",
"notSupportGuide.features.multiProviders.title": "Prise en charge multi-fournisseurs",
"notSupportGuide.title": "Le mode de déploiement actuel ne prend pas en charge la génération d'images IA",
- "topic.createNew": "Nouveau sujet",
+ "topic.createNew": "Créer un nouveau sujet",
"topic.deleteConfirm": "Supprimer le sujet de génération",
"topic.deleteConfirmDesc": "Vous êtes sur le point de supprimer ce sujet de génération. Cette action est irréversible, veuillez procéder avec prudence.",
"topic.empty": "Aucun sujet de génération",
diff --git a/locales/fr-FR/video.json b/locales/fr-FR/video.json
index 903457516c8..b217620943a 100644
--- a/locales/fr-FR/video.json
+++ b/locales/fr-FR/video.json
@@ -7,6 +7,7 @@
"config.header.title": "Vidéo",
"config.imageUrl.label": "Image de début",
"config.prompt.placeholder": "Décrivez la vidéo que vous souhaitez générer",
+ "config.prompt.placeholderWithRef": "Décrivez la scène que vous souhaitez générer avec l'image",
"config.referenceImage.label": "Image de référence",
"config.resolution.label": "Résolution",
"config.seed.label": "Graine",
@@ -20,7 +21,7 @@
"generation.status.failed": "Échec de la génération",
"generation.status.generating": "Génération en cours...",
"generation.validation.endFrameRequiresStartFrame": "L'image de fin ne peut pas être utilisée sans image de début. Veuillez d'abord définir une image de début.",
- "topic.createNew": "Nouveau sujet",
+ "topic.createNew": "Créer un nouveau sujet",
"topic.deleteConfirm": "Supprimer le sujet vidéo",
"topic.deleteConfirmDesc": "Vous êtes sur le point de supprimer ce sujet vidéo. Cette action est irréversible.",
"topic.title": "Sujets vidéo",
diff --git a/locales/it-IT/components.json b/locales/it-IT/components.json
index bae3b96143f..e7a8e4bd0d7 100644
--- a/locales/it-IT/components.json
+++ b/locales/it-IT/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "Segmentazione non riuscita, controlla e riprova. Dettagli errore:",
"FileParsingStatus.chunks.status.processing": "Segmentazione in corso",
"FileParsingStatus.chunks.status.processingTip": "Il server sta dividendo i segmenti di testo; chiudere la pagina non influirà sul progresso.",
+ "GenerationModelItem.creditsPerImageApproximate": "Circa {{amount}} Crediti / immagine",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} Crediti / immagine",
+ "GenerationModelItem.creditsPerVideoApproximate": "Circa {{amount}} Crediti / video",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} Crediti / video",
"GoBack.back": "Indietro",
"HtmlPreview.actions.download": "Scarica",
"HtmlPreview.actions.preview": "Anteprima",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "Testo",
"ModelSwitchPanel.detail.pricing.input": "Input ${{amount}}/M",
"ModelSwitchPanel.detail.pricing.output": "Output ${{amount}}/M",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / immagine",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / video",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "Input Audio",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "Input Audio (Memorizzato)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "Output Audio",
diff --git a/locales/it-IT/image.json b/locales/it-IT/image.json
index 5b19ce6b52a..f9e54be6702 100644
--- a/locales/it-IT/image.json
+++ b/locales/it-IT/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "Immagini di riferimento",
"config.model.label": "Modello",
"config.prompt.placeholder": "Descrivi cosa vuoi generare",
+ "config.prompt.placeholderWithRef": "Descrivi come desideri modificare l'immagine",
"config.quality.label": "Qualità immagine",
"config.quality.options.hd": "Alta definizione",
"config.quality.options.standard": "Standard",
@@ -22,7 +23,7 @@
"config.seed.random": "Seed casuale",
"config.size.label": "Dimensione",
"config.steps.label": "Passaggi",
- "config.title": "Immagine AI",
+ "config.title": "Configurazione",
"config.width.label": "Larghezza",
"generation.actions.applySeed": "Applica seed",
"generation.actions.copyError": "Copia messaggio di errore",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "Supporta più fornitori di generazione immagini AI, inclusi OpenAI gpt-image-1, Google Imagen, FAL.ai e altri, offrendo un'ampia selezione di modelli.",
"notSupportGuide.features.multiProviders.title": "Supporto multi-fornitore",
"notSupportGuide.title": "La modalità di distribuzione attuale non supporta la generazione di immagini AI",
- "topic.createNew": "Nuovo argomento",
+ "topic.createNew": "Crea Nuovo Argomento",
"topic.deleteConfirm": "Elimina argomento di generazione",
"topic.deleteConfirmDesc": "Stai per eliminare questo argomento di generazione. Questa azione è irreversibile, procedi con cautela.",
"topic.empty": "Nessun argomento di generazione",
diff --git a/locales/it-IT/video.json b/locales/it-IT/video.json
index 2728fb1bd4a..adaefefd7a4 100644
--- a/locales/it-IT/video.json
+++ b/locales/it-IT/video.json
@@ -7,6 +7,7 @@
"config.header.title": "Video",
"config.imageUrl.label": "Fotogramma Iniziale",
"config.prompt.placeholder": "Descrivi il video che vuoi generare",
+ "config.prompt.placeholderWithRef": "Descrivi la scena che vuoi generare con l'immagine",
"config.referenceImage.label": "Immagine di Riferimento",
"config.resolution.label": "Risoluzione",
"config.seed.label": "Seed",
@@ -20,7 +21,7 @@
"generation.status.failed": "Generazione Fallita",
"generation.status.generating": "Generazione in corso...",
"generation.validation.endFrameRequiresStartFrame": "Il fotogramma finale non può essere utilizzato senza un fotogramma iniziale. Imposta prima un fotogramma iniziale.",
- "topic.createNew": "Nuovo Argomento",
+ "topic.createNew": "Crea Nuovo Argomento",
"topic.deleteConfirm": "Elimina Argomento Video",
"topic.deleteConfirmDesc": "Stai per eliminare questo argomento video. Questa azione non può essere annullata.",
"topic.title": "Argomenti Video",
diff --git a/locales/ja-JP/components.json b/locales/ja-JP/components.json
index 16da91b9881..28b696d95ae 100644
--- a/locales/ja-JP/components.json
+++ b/locales/ja-JP/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "分割に失敗しました。再試行する前に確認してください。失敗の理由:",
"FileParsingStatus.chunks.status.processing": "分割中",
"FileParsingStatus.chunks.status.processingTip": "サーバーがテキストブロックを分割しています。ページを閉じても分割の進行には影響しません",
+ "GenerationModelItem.creditsPerImageApproximate": "約 {{amount}} クレジット / 画像",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} クレジット / 画像",
+ "GenerationModelItem.creditsPerVideoApproximate": "約 {{amount}} クレジット / 動画",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} クレジット / 動画",
"GoBack.back": "戻る",
"HtmlPreview.actions.download": "ダウンロード",
"HtmlPreview.actions.preview": "プレビュー",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "テキスト",
"ModelSwitchPanel.detail.pricing.input": "入力 ${{amount}}/M",
"ModelSwitchPanel.detail.pricing.output": "出力 ${{amount}}/M",
+ "ModelSwitchPanel.detail.pricing.perImage": "〜 {{amount}} / 画像",
+ "ModelSwitchPanel.detail.pricing.perVideo": "〜 {{amount}} / 動画",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "音声入力",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "音声入力(キャッシュ読み取り)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "音声出力",
diff --git a/locales/ja-JP/image.json b/locales/ja-JP/image.json
index 0b387d3130f..c8b92a38e73 100644
--- a/locales/ja-JP/image.json
+++ b/locales/ja-JP/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "参考画像",
"config.model.label": "モデル",
"config.prompt.placeholder": "生成したい内容を記述してください",
+ "config.prompt.placeholderWithRef": "画像をどのように調整したいか説明してください",
"config.quality.label": "画像品質",
"config.quality.options.hd": "高精細",
"config.quality.options.standard": "標準",
@@ -22,7 +23,7 @@
"config.seed.random": "ランダムシード",
"config.size.label": "サイズ",
"config.steps.label": "ステップ数",
- "config.title": "AI 絵画",
+ "config.title": "設定",
"config.width.label": "幅",
"generation.actions.applySeed": "シードを適用する",
"generation.actions.copyError": "エラー情報をコピー",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "OpenAI gpt-image-1、Google Imagen、FAL.ai など複数のAI絵画サービスプロバイダーをサポートし、多彩なモデル選択を提供します",
"notSupportGuide.features.multiProviders.title": "複数プロバイダー対応",
"notSupportGuide.title": "現在のデプロイモードはAI絵画をサポートしていません",
- "topic.createNew": "新しいテーマを作成",
+ "topic.createNew": "新しいトピックを作成",
"topic.deleteConfirm": "生成テーマを削除",
"topic.deleteConfirmDesc": "この生成テーマを削除すると復元できません。慎重に操作してください。",
"topic.empty": "生成されたテーマはありません",
diff --git a/locales/ja-JP/video.json b/locales/ja-JP/video.json
index 01427007333..fb9c8bf1ced 100644
--- a/locales/ja-JP/video.json
+++ b/locales/ja-JP/video.json
@@ -7,6 +7,7 @@
"config.header.title": "ビデオ",
"config.imageUrl.label": "開始フレーム",
"config.prompt.placeholder": "生成したいビデオの内容を説明してください",
+ "config.prompt.placeholderWithRef": "生成したい画像のシーンを説明してください",
"config.referenceImage.label": "参照画像",
"config.resolution.label": "解像度",
"config.seed.label": "シード値",
@@ -20,7 +21,7 @@
"generation.status.failed": "生成に失敗しました",
"generation.status.generating": "生成中...",
"generation.validation.endFrameRequiresStartFrame": "終了フレームを使用するには、開始フレームを設定してください。",
- "topic.createNew": "新しいトピック",
+ "topic.createNew": "新しいトピックを作成",
"topic.deleteConfirm": "ビデオトピックを削除",
"topic.deleteConfirmDesc": "このビデオトピックを削除しようとしています。この操作は元に戻せません。",
"topic.title": "ビデオトピック",
diff --git a/locales/ko-KR/components.json b/locales/ko-KR/components.json
index 044e29ae458..8228327f5de 100644
--- a/locales/ko-KR/components.json
+++ b/locales/ko-KR/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "분할에 실패했습니다. 확인 후 다시 시도하세요. 실패 원인:",
"FileParsingStatus.chunks.status.processing": "분할 중",
"FileParsingStatus.chunks.status.processingTip": "서버에서 텍스트 블록을 분할 중입니다. 페이지를 닫아도 작업은 계속됩니다.",
+ "GenerationModelItem.creditsPerImageApproximate": "약 {{amount}} 크레딧 / 이미지",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} 크레딧 / 이미지",
+ "GenerationModelItem.creditsPerVideoApproximate": "약 {{amount}} 크레딧 / 비디오",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} 크레딧 / 비디오",
"GoBack.back": "뒤로가기",
"HtmlPreview.actions.download": "다운로드",
"HtmlPreview.actions.preview": "미리보기",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "텍스트",
"ModelSwitchPanel.detail.pricing.input": "입력 ${{amount}}/백만자",
"ModelSwitchPanel.detail.pricing.output": "출력 ${{amount}}/백만자",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / 이미지",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / 비디오",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "오디오 입력",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "오디오 입력 (캐시 읽기)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "오디오 출력",
diff --git a/locales/ko-KR/image.json b/locales/ko-KR/image.json
index 303fc452033..5d98ba38605 100644
--- a/locales/ko-KR/image.json
+++ b/locales/ko-KR/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "참고 이미지",
"config.model.label": "모델",
"config.prompt.placeholder": "생성하고 싶은 내용을 설명하세요",
+ "config.prompt.placeholderWithRef": "이미지를 어떻게 조정하고 싶은지 설명하세요",
"config.quality.label": "이미지 품질",
"config.quality.options.hd": "고화질",
"config.quality.options.standard": "표준",
@@ -22,7 +23,7 @@
"config.seed.random": "무작위 시드",
"config.size.label": "크기",
"config.steps.label": "단계 수",
- "config.title": "AI 그림 그리기",
+ "config.title": "구성",
"config.width.label": "너비",
"generation.actions.applySeed": "시드 적용",
"generation.actions.copyError": "오류 정보 복사",
diff --git a/locales/ko-KR/video.json b/locales/ko-KR/video.json
index 29ce845d092..fae335af001 100644
--- a/locales/ko-KR/video.json
+++ b/locales/ko-KR/video.json
@@ -7,6 +7,7 @@
"config.header.title": "비디오",
"config.imageUrl.label": "시작 프레임",
"config.prompt.placeholder": "생성하고 싶은 비디오를 설명하세요",
+ "config.prompt.placeholderWithRef": "생성하고자 하는 이미지의 장면을 설명하세요",
"config.referenceImage.label": "참조 이미지",
"config.resolution.label": "해상도",
"config.seed.label": "시드",
diff --git a/locales/nl-NL/components.json b/locales/nl-NL/components.json
index f189f0e573c..2a51fb669fb 100644
--- a/locales/nl-NL/components.json
+++ b/locales/nl-NL/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "Verdeling mislukt, controleer en probeer opnieuw. Foutdetails:",
"FileParsingStatus.chunks.status.processing": "Bezig met verdelen",
"FileParsingStatus.chunks.status.processingTip": "De server splitst tekstfragmenten; het sluiten van de pagina heeft geen invloed op de voortgang.",
+ "GenerationModelItem.creditsPerImageApproximate": "Ongeveer {{amount}} Credits / afbeelding",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} Credits / afbeelding",
+ "GenerationModelItem.creditsPerVideoApproximate": "Ongeveer {{amount}} Credits / video",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} Credits / video",
"GoBack.back": "Terug",
"HtmlPreview.actions.download": "Downloaden",
"HtmlPreview.actions.preview": "Voorbeeld",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "Tekst",
"ModelSwitchPanel.detail.pricing.input": "Invoer ${{amount}}/M",
"ModelSwitchPanel.detail.pricing.output": "Uitvoer ${{amount}}/M",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / afbeelding",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / video",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "Audio-invoer",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "Audio-invoer (cache)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "Audio-uitvoer",
diff --git a/locales/nl-NL/image.json b/locales/nl-NL/image.json
index 41e467ab490..8985018416c 100644
--- a/locales/nl-NL/image.json
+++ b/locales/nl-NL/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "Referentieafbeeldingen",
"config.model.label": "Model",
"config.prompt.placeholder": "Beschrijf wat je wilt genereren",
+ "config.prompt.placeholderWithRef": "Beschrijf hoe u de afbeelding wilt aanpassen",
"config.quality.label": "Beeldkwaliteit",
"config.quality.options.hd": "Hoge definitie",
"config.quality.options.standard": "Standaard",
@@ -22,7 +23,7 @@
"config.seed.random": "Willekeurige seed",
"config.size.label": "Formaat",
"config.steps.label": "Stappen",
- "config.title": "AI-afbeelding",
+ "config.title": "Configuratie",
"config.width.label": "Breedte",
"generation.actions.applySeed": "Seed toepassen",
"generation.actions.copyError": "Foutmelding kopiëren",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "Ondersteunt meerdere AI-afbeeldingsgeneratoren, waaronder OpenAI gpt-image-1, Google Imagen, FAL.ai en meer, met een ruime keuze aan modellen.",
"notSupportGuide.features.multiProviders.title": "Ondersteuning voor meerdere providers",
"notSupportGuide.title": "Huidige implementatiemodus ondersteunt geen AI-afbeeldingsgeneratie",
- "topic.createNew": "Nieuw onderwerp",
+ "topic.createNew": "Nieuw Onderwerp Maken",
"topic.deleteConfirm": "Generatieonderwerp verwijderen",
"topic.deleteConfirmDesc": "Je staat op het punt dit generatieonderwerp te verwijderen. Deze actie kan niet ongedaan worden gemaakt, wees voorzichtig.",
"topic.empty": "Geen generatieonderwerpen",
diff --git a/locales/nl-NL/video.json b/locales/nl-NL/video.json
index bcd26560a70..ebe9a5f33ea 100644
--- a/locales/nl-NL/video.json
+++ b/locales/nl-NL/video.json
@@ -7,6 +7,7 @@
"config.header.title": "Video",
"config.imageUrl.label": "Startframe",
"config.prompt.placeholder": "Beschrijf de video die je wilt genereren",
+ "config.prompt.placeholderWithRef": "Beschrijf de scène die je wilt genereren met de afbeelding",
"config.referenceImage.label": "Referentieafbeelding",
"config.resolution.label": "Resolutie",
"config.seed.label": "Zaadwaarde",
@@ -20,7 +21,7 @@
"generation.status.failed": "Generatie Mislukt",
"generation.status.generating": "Bezig met genereren...",
"generation.validation.endFrameRequiresStartFrame": "Eindframe kan niet worden gebruikt zonder een startframe. Stel eerst een startframe in.",
- "topic.createNew": "Nieuw Onderwerp",
+ "topic.createNew": "Nieuw Onderwerp Maken",
"topic.deleteConfirm": "Videothema Verwijderen",
"topic.deleteConfirmDesc": "Je staat op het punt dit videothema te verwijderen. Deze actie kan niet ongedaan worden gemaakt.",
"topic.title": "Videothema's",
diff --git a/locales/pl-PL/components.json b/locales/pl-PL/components.json
index 6902868943b..f60eb00cea2 100644
--- a/locales/pl-PL/components.json
+++ b/locales/pl-PL/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "Dzielenie na fragmenty nie powiodło się, sprawdź i spróbuj ponownie. Szczegóły błędu:",
"FileParsingStatus.chunks.status.processing": "Dzielenie na fragmenty",
"FileParsingStatus.chunks.status.processingTip": "Serwer dzieli tekst na fragmenty; zamknięcie strony nie wpłynie na postęp procesu.",
+ "GenerationModelItem.creditsPerImageApproximate": "Około {{amount}} Kredytów / obraz",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} Kredytów / obraz",
+ "GenerationModelItem.creditsPerVideoApproximate": "Około {{amount}} Kredytów / wideo",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} Kredytów / wideo",
"GoBack.back": "Wstecz",
"HtmlPreview.actions.download": "Pobierz",
"HtmlPreview.actions.preview": "Podgląd",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "Tekst",
"ModelSwitchPanel.detail.pricing.input": "Dane wejściowe ${{amount}}/M",
"ModelSwitchPanel.detail.pricing.output": "Dane wyjściowe ${{amount}}/M",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / obraz",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / wideo",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "Wejście audio",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "Wejście audio (z bufora)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "Wyjście audio",
diff --git a/locales/pl-PL/image.json b/locales/pl-PL/image.json
index 3c619fac7e8..dc702886d0d 100644
--- a/locales/pl-PL/image.json
+++ b/locales/pl-PL/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "Obrazy referencyjne",
"config.model.label": "Model",
"config.prompt.placeholder": "Opisz, co chcesz wygenerować",
+ "config.prompt.placeholderWithRef": "Opisz, jak chcesz dostosować obraz",
"config.quality.label": "Jakość obrazu",
"config.quality.options.hd": "Wysoka rozdzielczość",
"config.quality.options.standard": "Standardowa",
@@ -22,7 +23,7 @@
"config.seed.random": "Losowe ziarno",
"config.size.label": "Rozmiar",
"config.steps.label": "Kroki",
- "config.title": "Obraz AI",
+ "config.title": "Konfiguracja",
"config.width.label": "Szerokość",
"generation.actions.applySeed": "Zastosuj ziarno",
"generation.actions.copyError": "Skopiuj komunikat o błędzie",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "Obsługuje wielu dostawców generowania obrazów AI, w tym OpenAI gpt-image-1, Google Imagen, FAL.ai i innych, oferując szeroki wybór modeli.",
"notSupportGuide.features.multiProviders.title": "Wsparcie wielu dostawców",
"notSupportGuide.title": "Obecny tryb wdrożenia nie obsługuje generowania obrazów AI",
- "topic.createNew": "Nowy temat",
+ "topic.createNew": "Utwórz nowy temat",
"topic.deleteConfirm": "Usuń temat generowania",
"topic.deleteConfirmDesc": "Zamierzasz usunąć ten temat generowania. Tej operacji nie można cofnąć, proszę zachować ostrożność.",
"topic.empty": "Brak tematów generowania",
diff --git a/locales/pl-PL/video.json b/locales/pl-PL/video.json
index 018e708936a..8687c2ce185 100644
--- a/locales/pl-PL/video.json
+++ b/locales/pl-PL/video.json
@@ -7,6 +7,7 @@
"config.header.title": "Wideo",
"config.imageUrl.label": "Klatka początkowa",
"config.prompt.placeholder": "Opisz wideo, które chcesz wygenerować",
+ "config.prompt.placeholderWithRef": "Opisz scenę, którą chcesz wygenerować na obrazie",
"config.referenceImage.label": "Obraz referencyjny",
"config.resolution.label": "Rozdzielczość",
"config.seed.label": "Ziarno",
@@ -20,7 +21,7 @@
"generation.status.failed": "Generowanie nie powiodło się",
"generation.status.generating": "Generowanie...",
"generation.validation.endFrameRequiresStartFrame": "Klatka końcowa wymaga ustawienia klatki początkowej. Najpierw ustaw klatkę początkową.",
- "topic.createNew": "Nowy temat",
+ "topic.createNew": "Utwórz nowy temat",
"topic.deleteConfirm": "Usuń temat wideo",
"topic.deleteConfirmDesc": "Zamierzasz usunąć ten temat wideo. Tej operacji nie można cofnąć.",
"topic.title": "Tematy wideo",
diff --git a/locales/pt-BR/components.json b/locales/pt-BR/components.json
index 452555cee6a..0066a0fa8a0 100644
--- a/locales/pt-BR/components.json
+++ b/locales/pt-BR/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "Falha na divisão, verifique e tente novamente. Detalhes do erro:",
"FileParsingStatus.chunks.status.processing": "Dividindo",
"FileParsingStatus.chunks.status.processingTip": "O servidor está dividindo os trechos de texto; fechar a página não afetará o progresso.",
+ "GenerationModelItem.creditsPerImageApproximate": "Aprox. {{amount}} Créditos / imagem",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} Créditos / imagem",
+ "GenerationModelItem.creditsPerVideoApproximate": "Aprox. {{amount}} Créditos / vídeo",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} Créditos / vídeo",
"GoBack.back": "Voltar",
"HtmlPreview.actions.download": "Baixar",
"HtmlPreview.actions.preview": "Visualizar",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "Texto",
"ModelSwitchPanel.detail.pricing.input": "Entrada ${{amount}}/M",
"ModelSwitchPanel.detail.pricing.output": "Saída ${{amount}}/M",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / imagem",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / vídeo",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "Entrada de Áudio",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "Entrada de Áudio (em Cache)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "Saída de Áudio",
diff --git a/locales/pt-BR/image.json b/locales/pt-BR/image.json
index f351a1db8c3..03dd0cdf245 100644
--- a/locales/pt-BR/image.json
+++ b/locales/pt-BR/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "Imagens de Referência",
"config.model.label": "Modelo",
"config.prompt.placeholder": "Descreva o que você deseja gerar",
+ "config.prompt.placeholderWithRef": "Descreva como você deseja ajustar a imagem",
"config.quality.label": "Qualidade da Imagem",
"config.quality.options.hd": "Alta Definição",
"config.quality.options.standard": "Padrão",
@@ -22,7 +23,7 @@
"config.seed.random": "Semente Aleatória",
"config.size.label": "Tamanho",
"config.steps.label": "Etapas",
- "config.title": "Imagem com IA",
+ "config.title": "Configuração",
"config.width.label": "Largura",
"generation.actions.applySeed": "Aplicar Semente",
"generation.actions.copyError": "Copiar Mensagem de Erro",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "Suporta múltiplos provedores de geração de imagens com IA, incluindo OpenAI gpt-image-1, Google Imagen, FAL.ai e outros, oferecendo uma ampla seleção de modelos.",
"notSupportGuide.features.multiProviders.title": "Suporte a Múltiplos Provedores",
"notSupportGuide.title": "O Modo de Implantação Atual Não Suporta Geração de Imagens com IA",
- "topic.createNew": "Novo Tópico",
+ "topic.createNew": "Criar Novo Tópico",
"topic.deleteConfirm": "Excluir Tópico de Geração",
"topic.deleteConfirmDesc": "Você está prestes a excluir este tópico de geração. Esta ação não pode ser desfeita, prossiga com cautela.",
"topic.empty": "Nenhum tópico de geração",
diff --git a/locales/pt-BR/video.json b/locales/pt-BR/video.json
index 6fb6b2d64a5..0fe38f463b6 100644
--- a/locales/pt-BR/video.json
+++ b/locales/pt-BR/video.json
@@ -7,6 +7,7 @@
"config.header.title": "Vídeo",
"config.imageUrl.label": "Quadro Inicial",
"config.prompt.placeholder": "Descreva o vídeo que você deseja gerar",
+ "config.prompt.placeholderWithRef": "Descreva a cena que você deseja gerar com a imagem",
"config.referenceImage.label": "Imagem de Referência",
"config.resolution.label": "Resolução",
"config.seed.label": "Semente",
@@ -20,7 +21,7 @@
"generation.status.failed": "Falha na Geração",
"generation.status.generating": "Gerando...",
"generation.validation.endFrameRequiresStartFrame": "O quadro final não pode ser usado sem um quadro inicial. Por favor, defina primeiro um quadro inicial.",
- "topic.createNew": "Novo Tópico",
+ "topic.createNew": "Criar Novo Tópico",
"topic.deleteConfirm": "Excluir Tópico de Vídeo",
"topic.deleteConfirmDesc": "Você está prestes a excluir este tópico de vídeo. Esta ação não poderá ser desfeita.",
"topic.title": "Tópicos de Vídeo",
diff --git a/locales/ru-RU/components.json b/locales/ru-RU/components.json
index 2f3e1053011..efa464777f4 100644
--- a/locales/ru-RU/components.json
+++ b/locales/ru-RU/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "Сегментация не удалась, пожалуйста, проверьте и повторите попытку. Подробности ошибки:",
"FileParsingStatus.chunks.status.processing": "Сегментация",
"FileParsingStatus.chunks.status.processingTip": "Сервер разделяет текст на фрагменты; закрытие страницы не повлияет на процесс.",
+ "GenerationModelItem.creditsPerImageApproximate": "Примерно {{amount}} кредитов / изображение",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} кредитов / изображение",
+ "GenerationModelItem.creditsPerVideoApproximate": "Примерно {{amount}} кредитов / видео",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} кредитов / видео",
"GoBack.back": "Назад",
"HtmlPreview.actions.download": "Скачать",
"HtmlPreview.actions.preview": "Предпросмотр",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "Текст",
"ModelSwitchPanel.detail.pricing.input": "Ввод ${{amount}}/М",
"ModelSwitchPanel.detail.pricing.output": "Вывод ${{amount}}/М",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / изображение",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / видео",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "Аудио-ввод",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "Аудио-ввод (из кэша)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "Аудио-вывод",
diff --git a/locales/ru-RU/image.json b/locales/ru-RU/image.json
index d21511678c9..eb483e4345a 100644
--- a/locales/ru-RU/image.json
+++ b/locales/ru-RU/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "Референсные изображения",
"config.model.label": "Модель",
"config.prompt.placeholder": "Опишите, что вы хотите сгенерировать",
+ "config.prompt.placeholderWithRef": "Опишите, как вы хотите изменить изображение",
"config.quality.label": "Качество изображения",
"config.quality.options.hd": "Высокое качество",
"config.quality.options.standard": "Стандартное",
@@ -22,7 +23,7 @@
"config.seed.random": "Случайный сид",
"config.size.label": "Размер",
"config.steps.label": "Шаги",
- "config.title": "AI Изображение",
+ "config.title": "Конфигурация",
"config.width.label": "Ширина",
"generation.actions.applySeed": "Применить сид",
"generation.actions.copyError": "Скопировать сообщение об ошибке",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "Поддержка нескольких провайдеров генерации AI-изображений, включая OpenAI gpt-image-1, Google Imagen, FAL.ai и других, предлагая широкий выбор моделей.",
"notSupportGuide.features.multiProviders.title": "Поддержка нескольких провайдеров",
"notSupportGuide.title": "Текущий режим развертывания не поддерживает генерацию AI-изображений",
- "topic.createNew": "Новая тема",
+ "topic.createNew": "Создать новую тему",
"topic.deleteConfirm": "Удалить тему генерации",
"topic.deleteConfirmDesc": "Вы собираетесь удалить эту тему генерации. Это действие необратимо, пожалуйста, будьте осторожны.",
"topic.empty": "Нет тем генерации",
diff --git a/locales/ru-RU/video.json b/locales/ru-RU/video.json
index 41ca4d1c9de..3ae29558e73 100644
--- a/locales/ru-RU/video.json
+++ b/locales/ru-RU/video.json
@@ -7,6 +7,7 @@
"config.header.title": "Видео",
"config.imageUrl.label": "Начальный кадр",
"config.prompt.placeholder": "Опишите видео, которое хотите создать",
+ "config.prompt.placeholderWithRef": "Опишите сцену, которую вы хотите создать с изображением",
"config.referenceImage.label": "Референсное изображение",
"config.resolution.label": "Разрешение",
"config.seed.label": "Сид",
@@ -20,7 +21,7 @@
"generation.status.failed": "Ошибка генерации",
"generation.status.generating": "Создание...",
"generation.validation.endFrameRequiresStartFrame": "Конечный кадр нельзя использовать без начального. Пожалуйста, сначала задайте начальный кадр.",
- "topic.createNew": "Новая тема",
+ "topic.createNew": "Создать новую тему",
"topic.deleteConfirm": "Удалить тему видео",
"topic.deleteConfirmDesc": "Вы собираетесь удалить эту тему видео. Это действие необратимо.",
"topic.title": "Темы видео",
diff --git a/locales/tr-TR/components.json b/locales/tr-TR/components.json
index 68ea7dd80a7..a31296f47f4 100644
--- a/locales/tr-TR/components.json
+++ b/locales/tr-TR/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "Parçalama başarısız oldu, lütfen kontrol edip tekrar deneyin. Hata detayı:",
"FileParsingStatus.chunks.status.processing": "Parçalanıyor",
"FileParsingStatus.chunks.status.processingTip": "Sunucu metin parçalarını bölüyor; sayfayı kapatmak işlemi etkilemez.",
+ "GenerationModelItem.creditsPerImageApproximate": "Yaklaşık {{amount}} Kredi / resim",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} Kredi / resim",
+ "GenerationModelItem.creditsPerVideoApproximate": "Yaklaşık {{amount}} Kredi / video",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} Kredi / video",
"GoBack.back": "Geri",
"HtmlPreview.actions.download": "İndir",
"HtmlPreview.actions.preview": "Önizleme",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "Metin",
"ModelSwitchPanel.detail.pricing.input": "Girdi ${{amount}}/M",
"ModelSwitchPanel.detail.pricing.output": "Çıktı ${{amount}}/M",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / resim",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / video",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "Ses Girdisi",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "Ses Girdisi (Önbellekten)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "Ses Çıktısı",
diff --git a/locales/tr-TR/image.json b/locales/tr-TR/image.json
index 91945d60fd7..65b9ed47b17 100644
--- a/locales/tr-TR/image.json
+++ b/locales/tr-TR/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "Referans Görseller",
"config.model.label": "Model",
"config.prompt.placeholder": "Oluşturmak istediğinizi tanımlayın",
+ "config.prompt.placeholderWithRef": "Resmi nasıl ayarlamak istediğinizi açıklayın",
"config.quality.label": "Görüntü Kalitesi",
"config.quality.options.hd": "Yüksek Çözünürlük",
"config.quality.options.standard": "Standart",
@@ -22,7 +23,7 @@
"config.seed.random": "Rastgele Tohum",
"config.size.label": "Boyut",
"config.steps.label": "Adımlar",
- "config.title": "Yapay Zeka Görseli",
+ "config.title": "Yapılandırma",
"config.width.label": "Genişlik",
"generation.actions.applySeed": "Tohumu Uygula",
"generation.actions.copyError": "Hata Mesajını Kopyala",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "OpenAI gpt-image-1, Google Imagen, FAL.ai ve daha fazlası dahil olmak üzere birden fazla yapay zeka görsel oluşturma sağlayıcısını destekler, geniş model seçenekleri sunar.",
"notSupportGuide.features.multiProviders.title": "Çoklu Sağlayıcı Desteği",
"notSupportGuide.title": "Mevcut Dağıtım Modu Yapay Zeka Görsel Oluşturmayı Desteklemiyor",
- "topic.createNew": "Yeni Konu",
+ "topic.createNew": "Yeni Konu Oluştur",
"topic.deleteConfirm": "Oluşturma Konusunu Sil",
"topic.deleteConfirmDesc": "Bu oluşturma konusunu silmek üzeresiniz. Bu işlem geri alınamaz, lütfen dikkatli olun.",
"topic.empty": "Henüz oluşturma konusu yok",
diff --git a/locales/tr-TR/video.json b/locales/tr-TR/video.json
index 7fb88459dda..d7759c4b3a4 100644
--- a/locales/tr-TR/video.json
+++ b/locales/tr-TR/video.json
@@ -7,6 +7,7 @@
"config.header.title": "Video",
"config.imageUrl.label": "Başlangıç Kare Görseli",
"config.prompt.placeholder": "Oluşturmak istediğiniz videoyu tanımlayın",
+ "config.prompt.placeholderWithRef": "Oluşturmak istediğiniz sahneyi görüntü ile tanımlayın",
"config.referenceImage.label": "Referans Görsel",
"config.resolution.label": "Çözünürlük",
"config.seed.label": "Tohum",
@@ -20,7 +21,7 @@
"generation.status.failed": "Oluşturma Başarısız",
"generation.status.generating": "Oluşturuluyor...",
"generation.validation.endFrameRequiresStartFrame": "Bitiş karesi, başlangıç karesi olmadan kullanılamaz. Lütfen önce bir başlangıç karesi ayarlayın.",
- "topic.createNew": "Yeni Konu",
+ "topic.createNew": "Yeni Konu Oluştur",
"topic.deleteConfirm": "Video Konusunu Sil",
"topic.deleteConfirmDesc": "Bu video konusunu silmek üzeresiniz. Bu işlem geri alınamaz.",
"topic.title": "Video Konuları",
diff --git a/locales/vi-VN/components.json b/locales/vi-VN/components.json
index bcdba779485..0bc01005ddd 100644
--- a/locales/vi-VN/components.json
+++ b/locales/vi-VN/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "Phân đoạn thất bại, vui lòng kiểm tra và thử lại. Chi tiết lỗi:",
"FileParsingStatus.chunks.status.processing": "Đang phân đoạn",
"FileParsingStatus.chunks.status.processingTip": "Máy chủ đang chia nhỏ văn bản; việc đóng trang sẽ không ảnh hưởng đến tiến trình phân đoạn.",
+ "GenerationModelItem.creditsPerImageApproximate": "Khoảng {{amount}} Tín dụng / hình ảnh",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} Tín dụng / hình ảnh",
+ "GenerationModelItem.creditsPerVideoApproximate": "Khoảng {{amount}} Tín dụng / video",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} Tín dụng / video",
"GoBack.back": "Quay lại",
"HtmlPreview.actions.download": "Tải xuống",
"HtmlPreview.actions.preview": "Xem trước",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "Văn bản",
"ModelSwitchPanel.detail.pricing.input": "Đầu vào ${{amount}}/M",
"ModelSwitchPanel.detail.pricing.output": "Đầu ra ${{amount}}/M",
+ "ModelSwitchPanel.detail.pricing.perImage": "~ {{amount}} / hình ảnh",
+ "ModelSwitchPanel.detail.pricing.perVideo": "~ {{amount}} / video",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "Đầu vào âm thanh",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "Đầu vào âm thanh (đã lưu)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "Đầu ra âm thanh",
diff --git a/locales/vi-VN/image.json b/locales/vi-VN/image.json
index 5b0729af0a9..ab1314f744a 100644
--- a/locales/vi-VN/image.json
+++ b/locales/vi-VN/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "Các ảnh tham khảo",
"config.model.label": "Mô hình",
"config.prompt.placeholder": "Mô tả những gì bạn muốn tạo",
+ "config.prompt.placeholderWithRef": "Mô tả cách bạn muốn điều chỉnh hình ảnh",
"config.quality.label": "Chất lượng ảnh",
"config.quality.options.hd": "Độ nét cao",
"config.quality.options.standard": "Tiêu chuẩn",
@@ -22,7 +23,7 @@
"config.seed.random": "Hạt giống ngẫu nhiên",
"config.size.label": "Kích thước",
"config.steps.label": "Số bước",
- "config.title": "Ảnh AI",
+ "config.title": "Cấu hình",
"config.width.label": "Chiều rộng",
"generation.actions.applySeed": "Áp dụng hạt giống",
"generation.actions.copyError": "Sao chép thông báo lỗi",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "Hỗ trợ nhiều nhà cung cấp tạo ảnh AI, bao gồm OpenAI gpt-image-1, Google Imagen, FAL.ai và nhiều hơn nữa, mang đến lựa chọn mô hình đa dạng.",
"notSupportGuide.features.multiProviders.title": "Hỗ trợ nhiều nhà cung cấp",
"notSupportGuide.title": "Chế độ triển khai hiện tại không hỗ trợ tạo ảnh AI",
- "topic.createNew": "Chủ đề mới",
+ "topic.createNew": "Tạo Chủ Đề Mới",
"topic.deleteConfirm": "Xóa chủ đề tạo ảnh",
"topic.deleteConfirmDesc": "Bạn sắp xóa chủ đề tạo ảnh này. Hành động này không thể hoàn tác, vui lòng cẩn trọng.",
"topic.empty": "Chưa có chủ đề tạo ảnh",
diff --git a/locales/vi-VN/video.json b/locales/vi-VN/video.json
index cfd57202fca..bdcef833765 100644
--- a/locales/vi-VN/video.json
+++ b/locales/vi-VN/video.json
@@ -7,6 +7,7 @@
"config.header.title": "Video",
"config.imageUrl.label": "Khung hình bắt đầu",
"config.prompt.placeholder": "Mô tả video bạn muốn tạo",
+ "config.prompt.placeholderWithRef": "Mô tả cảnh bạn muốn tạo với hình ảnh",
"config.referenceImage.label": "Hình ảnh tham chiếu",
"config.resolution.label": "Độ phân giải",
"config.seed.label": "Hạt giống",
@@ -20,7 +21,7 @@
"generation.status.failed": "Tạo thất bại",
"generation.status.generating": "Đang tạo...",
"generation.validation.endFrameRequiresStartFrame": "Không thể sử dụng khung hình kết thúc nếu chưa có khung hình bắt đầu. Vui lòng thiết lập khung hình bắt đầu trước.",
- "topic.createNew": "Chủ đề mới",
+ "topic.createNew": "Tạo Chủ Đề Mới",
"topic.deleteConfirm": "Xóa chủ đề video",
"topic.deleteConfirmDesc": "Bạn sắp xóa chủ đề video này. Hành động này không thể hoàn tác.",
"topic.title": "Chủ đề video",
diff --git a/locales/zh-CN/components.json b/locales/zh-CN/components.json
index ca75bb45326..989edc2f00d 100644
--- a/locales/zh-CN/components.json
+++ b/locales/zh-CN/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "分块失败,请检查后重试。失败原因:",
"FileParsingStatus.chunks.status.processing": "分块中…",
"FileParsingStatus.chunks.status.processingTip": "服务端正在拆分文本块,关闭页面不会影响进度",
+ "GenerationModelItem.creditsPerImageApproximate": "约 {{amount}} 算力积分/张",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} 算力积分/张",
+ "GenerationModelItem.creditsPerVideoApproximate": "约 {{amount}} 算力积分/条",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} 算力积分/条",
"GoBack.back": "返回",
"HtmlPreview.actions.download": "下载",
"HtmlPreview.actions.preview": "预览",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "文本",
"ModelSwitchPanel.detail.pricing.input": "输入 ${{amount}}/百万",
"ModelSwitchPanel.detail.pricing.output": "输出 ${{amount}}/百万",
+ "ModelSwitchPanel.detail.pricing.perImage": "约 ${{amount}}/张",
+ "ModelSwitchPanel.detail.pricing.perVideo": "约 ${{amount}}/条",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "音频输入",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "音频输入(缓存读取)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "音频输出",
diff --git a/locales/zh-CN/image.json b/locales/zh-CN/image.json
index 3d2ec920579..d410a19fd56 100644
--- a/locales/zh-CN/image.json
+++ b/locales/zh-CN/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "参考图",
"config.model.label": "模型",
"config.prompt.placeholder": "描述你想要生成的内容",
+ "config.prompt.placeholderWithRef": "描述你想如何调整图片",
"config.quality.label": "图片质量",
"config.quality.options.hd": "高清",
"config.quality.options.standard": "标准",
@@ -22,7 +23,7 @@
"config.seed.random": "随机种子",
"config.size.label": "尺寸",
"config.steps.label": "步数",
- "config.title": "AI 图像",
+ "config.title": "配置",
"config.width.label": "宽度",
"generation.actions.applySeed": "应用种子",
"generation.actions.copyError": "复制错误信息",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "支持多种 AI 绘画服务商,包括 OpenAI、Google Imagen、FAL.ai 等。提供丰富的模型选择",
"notSupportGuide.features.multiProviders.title": "多服务商支持",
"notSupportGuide.title": "当前部署模式不支持 AI 绘画",
- "topic.createNew": "新建主题",
+ "topic.createNew": "创作新主题",
"topic.deleteConfirm": "删除生成主题",
"topic.deleteConfirmDesc": "确认删除该生成主题吗?删除后无法恢复",
"topic.empty": "暂无生成主题",
diff --git a/locales/zh-CN/video.json b/locales/zh-CN/video.json
index f7d0f0210a2..1d25890be9a 100644
--- a/locales/zh-CN/video.json
+++ b/locales/zh-CN/video.json
@@ -7,6 +7,7 @@
"config.header.title": "视频",
"config.imageUrl.label": "起始画面",
"config.prompt.placeholder": "描述你想生成的视频内容",
+ "config.prompt.placeholderWithRef": "结合图片,描述你想生成的画面",
"config.referenceImage.label": "参考图像",
"config.resolution.label": "分辨率",
"config.seed.label": "种子",
@@ -20,7 +21,7 @@
"generation.status.failed": "生成失败",
"generation.status.generating": "生成中...",
"generation.validation.endFrameRequiresStartFrame": "使用结束画面前需先设置起始画面。请先设置起始画面。",
- "topic.createNew": "新建主题",
+ "topic.createNew": "创作新主题",
"topic.deleteConfirm": "删除视频主题",
"topic.deleteConfirmDesc": "你即将删除该视频主题,此操作无法撤销。",
"topic.title": "视频主题",
diff --git a/locales/zh-TW/components.json b/locales/zh-TW/components.json
index a5281ac4da8..a4b8beb1455 100644
--- a/locales/zh-TW/components.json
+++ b/locales/zh-TW/components.json
@@ -65,6 +65,10 @@
"FileParsingStatus.chunks.status.errorResult": "分塊失敗,請檢查後重試。失敗原因:",
"FileParsingStatus.chunks.status.processing": "分塊中",
"FileParsingStatus.chunks.status.processingTip": "服務端正在拆分文本塊,關閉頁面不影響分塊進度",
+ "GenerationModelItem.creditsPerImageApproximate": "約 {{amount}} 點數 / 圖片",
+ "GenerationModelItem.creditsPerImageExact": "{{amount}} 點數 / 圖片",
+ "GenerationModelItem.creditsPerVideoApproximate": "約 {{amount}} 點數 / 影片",
+ "GenerationModelItem.creditsPerVideoExact": "{{amount}} 點數 / 影片",
"GoBack.back": "返回",
"HtmlPreview.actions.download": "下載",
"HtmlPreview.actions.preview": "預覽",
@@ -116,6 +120,8 @@
"ModelSwitchPanel.detail.pricing.group.text": "文字",
"ModelSwitchPanel.detail.pricing.input": "輸入 ${{amount}}/百萬",
"ModelSwitchPanel.detail.pricing.output": "輸出 ${{amount}}/百萬",
+ "ModelSwitchPanel.detail.pricing.perImage": "約 {{amount}} / 圖片",
+ "ModelSwitchPanel.detail.pricing.perVideo": "約 {{amount}} / 影片",
"ModelSwitchPanel.detail.pricing.unit.audioInput": "音訊輸入",
"ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead": "音訊輸入(快取)",
"ModelSwitchPanel.detail.pricing.unit.audioOutput": "音訊輸出",
diff --git a/locales/zh-TW/image.json b/locales/zh-TW/image.json
index 9f9f8d782d8..134b6e9fee3 100644
--- a/locales/zh-TW/image.json
+++ b/locales/zh-TW/image.json
@@ -11,6 +11,7 @@
"config.imageUrls.label": "參考圖",
"config.model.label": "模型",
"config.prompt.placeholder": "描述你想要生成的內容",
+ "config.prompt.placeholderWithRef": "描述您希望如何調整圖片",
"config.quality.label": "圖片品質",
"config.quality.options.hd": "高清",
"config.quality.options.standard": "標準",
@@ -22,7 +23,7 @@
"config.seed.random": "隨機種子",
"config.size.label": "尺寸",
"config.steps.label": "步數",
- "config.title": "AI 繪畫",
+ "config.title": "設定",
"config.width.label": "寬度",
"generation.actions.applySeed": "應用種子",
"generation.actions.copyError": "複製錯誤訊息",
@@ -53,7 +54,7 @@
"notSupportGuide.features.multiProviders.desc": "支援多種 AI 繪畫服務商,包括 OpenAI gpt-image-1、Google Imagen、FAL.ai 等,提供豐富的模型選擇",
"notSupportGuide.features.multiProviders.title": "多 Providers 支援",
"notSupportGuide.title": "當前部署模式不支援 AI 繪畫",
- "topic.createNew": "新建主題",
+ "topic.createNew": "建立新主題",
"topic.deleteConfirm": "刪除生成主題",
"topic.deleteConfirmDesc": "即將刪除該生成主題,刪除後將無法復原,請謹慎操作。",
"topic.empty": "暫無生成主題",
diff --git a/locales/zh-TW/video.json b/locales/zh-TW/video.json
index 880e4305df8..7c08c58539a 100644
--- a/locales/zh-TW/video.json
+++ b/locales/zh-TW/video.json
@@ -7,6 +7,7 @@
"config.header.title": "影片",
"config.imageUrl.label": "起始畫面",
"config.prompt.placeholder": "描述您想要產生的影片",
+ "config.prompt.placeholderWithRef": "描述您想要生成圖像的場景",
"config.referenceImage.label": "參考圖片",
"config.resolution.label": "解析度",
"config.seed.label": "種子",
@@ -20,7 +21,7 @@
"generation.status.failed": "產生失敗",
"generation.status.generating": "產生中...",
"generation.validation.endFrameRequiresStartFrame": "未設定起始畫面時無法使用結束畫面。請先設定起始畫面。",
- "topic.createNew": "新增主題",
+ "topic.createNew": "建立新主題",
"topic.deleteConfirm": "刪除影片主題",
"topic.deleteConfirmDesc": "您即將刪除此影片主題,此操作無法復原。",
"topic.title": "影片主題",
diff --git a/packages/model-bank/src/types/aiModel.ts b/packages/model-bank/src/types/aiModel.ts
index 418b79033b7..4c35e763b35 100644
--- a/packages/model-bank/src/types/aiModel.ts
+++ b/packages/model-bank/src/types/aiModel.ts
@@ -467,6 +467,10 @@ export interface AiModelForSelect {
* Approximate per-image price (USD), used when exact calculation is not possible
*/
approximatePricePerImage?: number;
+ /**
+ * Approximate per-video price (USD), used when exact calculation is not possible
+ */
+ approximatePricePerVideo?: number;
contextWindowTokens?: number;
description?: string;
displayName?: string;
@@ -476,6 +480,10 @@ export interface AiModelForSelect {
* Exact per-image price (USD) calculated from pricing units
*/
pricePerImage?: number;
+ /**
+ * Exact per-video price (USD) when resolved from pricing units
+ */
+ pricePerVideo?: number;
pricing?: Pricing;
releasedAt?: string;
}
diff --git a/src/features/CommandMenu/SearchResults.tsx b/src/features/CommandMenu/SearchResults.tsx
index b968fbfad15..d4fdeaf3018 100644
--- a/src/features/CommandMenu/SearchResults.tsx
+++ b/src/features/CommandMenu/SearchResults.tsx
@@ -19,6 +19,11 @@ import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { type SearchResult } from '@/database/repositories/search';
+import { useCommandMenuContext } from '@/features/CommandMenu/CommandMenuContext';
+import { useImageStore } from '@/store/image';
+import { generationTopicSelectors as imageGenerationTopicSelectors } from '@/store/image/slices/generationTopic/selectors';
+import { useVideoStore } from '@/store/video';
+import { generationTopicSelectors as videoGenerationTopicSelectors } from '@/store/video/slices/generationTopic/selectors';
import { markdownToTxt } from '@/utils/markdownToTxt';
import { CommandItem } from './components';
@@ -34,13 +39,27 @@ interface SearchResultsProps {
typeFilter: ValidSearchType | undefined;
}
+interface LocalGenerationTopicResult {
+ createdAt: Date;
+ id: string;
+ title: string;
+ updatedAt: Date;
+}
+
/**
* Search results from unified search index.
*/
const SearchResults = memo<SearchResultsProps>(
({ isLoading, onClose, onSetTypeFilter, results, searchQuery, typeFilter }) => {
const { t } = useTranslation('common');
+ const { t: tImage } = useTranslation('image');
+ const { t: tVideo } = useTranslation('video');
const navigate = useNavigate();
+ const { menuContext } = useCommandMenuContext();
+ const imageTopics = useImageStore(imageGenerationTopicSelectors.generationTopics);
+ const activeImageTopicId = useImageStore((s) => s.activeGenerationTopicId);
+ const videoTopics = useVideoStore(videoGenerationTopicSelectors.generationTopics);
+ const activeVideoTopicId = useVideoStore((s) => s.activeGenerationTopicId);
const handleNavigate = (result: SearchResult) => {
switch (result.type) {
@@ -242,7 +261,51 @@ const SearchResults = memo<SearchResultsProps>(
onSetTypeFilter(type);
};
+ const localImageTopicResults: LocalGenerationTopicResult[] =
+ menuContext === 'painting'
+ ? (imageTopics || [])
+ .filter((topic) => {
+ const title = topic.title || tImage('topic.untitled');
+ return title.toLowerCase().includes(searchQuery.toLowerCase());
+ })
+ .sort((a, b) => {
+ if (a.id === activeImageTopicId) return -1;
+ if (b.id === activeImageTopicId) return 1;
+ return b.updatedAt.getTime() - a.updatedAt.getTime();
+ })
+ .slice(0, 8)
+ .map((topic) => ({
+ createdAt: topic.createdAt,
+ id: topic.id,
+ title: topic.title || tImage('topic.untitled'),
+ updatedAt: topic.updatedAt,
+ }))
+ : [];
+
+ const localVideoTopicResults: LocalGenerationTopicResult[] =
+ menuContext === 'video'
+ ? (videoTopics || [])
+ .filter((topic) => {
+ const title = topic.title || tVideo('topic.untitled');
+ return title.toLowerCase().includes(searchQuery.toLowerCase());
+ })
+ .sort((a, b) => {
+ if (a.id === activeVideoTopicId) return -1;
+ if (b.id === activeVideoTopicId) return 1;
+ return b.updatedAt.getTime() - a.updatedAt.getTime();
+ })
+ .slice(0, 8)
+ .map((topic) => ({
+ createdAt: topic.createdAt,
+ id: topic.id,
+ title: topic.title || tVideo('topic.untitled'),
+ updatedAt: topic.updatedAt,
+ }))
+ : [];
+
const hasResults = results.length > 0;
+ const hasLocalTopicResults =
+ localImageTopicResults.length > 0 || localVideoTopicResults.length > 0;
// Group results by type
const messageResults = results.filter((r) => r.type === 'message');
@@ -259,7 +322,7 @@ const SearchResults = memo<SearchResultsProps>(
const assistantResults = results.filter((r) => r.type === 'communityAgent');
// Don't render anything if no results and not loading
- if (!hasResults && !isLoading) {
+ if (!hasResults && !hasLocalTopicResults && !isLoading) {
return null;
}
@@ -335,6 +398,80 @@ const SearchResults = memo<SearchResultsProps>(
return (
<>
+ {localImageTopicResults.length > 0 && (
+ <Command.Group forceMount>
+ {localImageTopicResults.map((result) => {
+ const formattedDate = dayjs(result.updatedAt).format('MMM D, YYYY');
+ return (
+ <CommandItem
+ forceMount
+ description={formattedDate}
+ icon={<MessageSquare size={16} />}
+ key={`image-topic-${result.id}`}
+ value={`local-image-topic ${result.id} ${result.title}`}
+ variant="detailed"
+ title={
+ <>
+ <span style={{ opacity: 0.5 }}>{t('tab.aiImage')}</span>
+ <ChevronRight
+ size={14}
+ style={{
+ display: 'inline',
+ marginInline: '6px',
+ opacity: 0.5,
+ verticalAlign: 'middle',
+ }}
+ />
+ {result.title}
+ </>
+ }
+ onSelect={() => {
+ navigate(`/image?topic=${result.id}`);
+ onClose();
+ }}
+ />
+ );
+ })}
+ </Command.Group>
+ )}
+
+ {localVideoTopicResults.length > 0 && (
+ <Command.Group forceMount>
+ {localVideoTopicResults.map((result) => {
+ const formattedDate = dayjs(result.updatedAt).format('MMM D, YYYY');
+ return (
+ <CommandItem
+ forceMount
+ description={formattedDate}
+ icon={<MessageSquare size={16} />}
+ key={`video-topic-${result.id}`}
+ value={`local-video-topic ${result.id} ${result.title}`}
+ variant="detailed"
+ title={
+ <>
+ <span style={{ opacity: 0.5 }}>{t('tab.video')}</span>
+ <ChevronRight
+ size={14}
+ style={{
+ display: 'inline',
+ marginInline: '6px',
+ opacity: 0.5,
+ verticalAlign: 'middle',
+ }}
+ />
+ {result.title}
+ </>
+ }
+ onSelect={() => {
+ navigate(`/video?topic=${result.id}`);
+ onClose();
+ }}
+ />
+ );
+ })}
+ </Command.Group>
+ )}
+
{/* Render search results grouped by type without headers */}
{messageResults.length > 0 && (
<Command.Group forceMount>
diff --git a/src/features/CommandMenu/types.ts b/src/features/CommandMenu/types.ts
index 26c04237a9a..a63a8a20a3e 100644
--- a/src/features/CommandMenu/types.ts
+++ b/src/features/CommandMenu/types.ts
@@ -29,9 +29,10 @@ export type MenuContext =
| 'memory'
| 'community'
| 'page'
- | 'painting';
+ | 'painting'
+ | 'video';
export type ContextType = Extract<
MenuContext,
- 'agent' | 'group' | 'resource' | 'settings' | 'page' | 'painting'
+ 'agent' | 'group' | 'resource' | 'settings' | 'page' | 'painting' | 'video'
>;
diff --git a/src/features/CommandMenu/utils/context.ts b/src/features/CommandMenu/utils/context.ts
index 6d2abda7af5..6c7b98fbed8 100644
--- a/src/features/CommandMenu/utils/context.ts
+++ b/src/features/CommandMenu/utils/context.ts
@@ -29,6 +29,11 @@ const CONTEXT_CONFIGS: ContextConfig[] = [
name: 'Painting',
type: 'painting',
},
+ {
+ matcher: /^\/video$/,
+ name: 'Video',
+ type: 'video',
+ },
{
captureSubPath: true,
matcher: /^\/settings(?:\/([^/]+))?/,
diff --git a/src/features/CommandMenu/utils/contextCommands.ts b/src/features/CommandMenu/utils/contextCommands.ts
index db1a3badd80..df9df68ec95 100644
--- a/src/features/CommandMenu/utils/contextCommands.ts
+++ b/src/features/CommandMenu/utils/contextCommands.ts
@@ -39,6 +39,7 @@ export const CONTEXT_COMMANDS: Record<ContextType, ContextCommand[]> = {
group: [],
page: [],
painting: [],
+ video: [],
resource: [],
settings: [
{
diff --git a/src/features/Conversation/ChatList/components/VirtualizedList.tsx b/src/features/Conversation/ChatList/components/VirtualizedList.tsx
index 128ef9d56bf..1a30e63b334 100644
--- a/src/features/Conversation/ChatList/components/VirtualizedList.tsx
+++ b/src/features/Conversation/ChatList/components/VirtualizedList.tsx
@@ -201,11 +201,13 @@ const VirtualizedList = memo<VirtualizedListProps>(({ dataSource, itemContent })
}}
</VList>
{/* BackBottom is placed outside VList so it remains visible regardless of scroll position */}
- <BackBottom
- atBottom={atBottom}
- visible={!atBottom}
- onScrollToBottom={() => scrollToBottom(true)}
- />
+ <WideScreenContainer style={{ position: 'relative' }}>
+ <BackBottom
+ atBottom={atBottom}
+ visible={!atBottom}
+ onScrollToBottom={() => scrollToBottom(true)}
+ />
+ </WideScreenContainer>
</div>
);
}, isEqual);
diff --git a/src/features/GenerationTopicList/TopicItem.tsx b/src/features/GenerationTopicList/TopicItem.tsx
deleted file mode 100644
index 6ad6023a15e..00000000000
--- a/src/features/GenerationTopicList/TopicItem.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-'use client';
-
-import { ActionIcon, Avatar, Flexbox, Popover, Text } from '@lobehub/ui';
-import { App } from 'antd';
-import { cssVar } from 'antd-style';
-import { Trash } from 'lucide-react';
-import React, { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useGlobalStore } from '@/store/global';
-import { globalGeneralSelectors } from '@/store/global/selectors';
-import { type ImageGenerationTopic } from '@/types/generation';
-
-import { useGenerationTopicContext } from './StoreContext';
-
-const formatTime = (date: Date, locale: string) => {
- return new Intl.DateTimeFormat(locale, {
- day: 'numeric',
- month: 'long',
- }).format(new Date(date));
-};
-
-interface TopicItemProps {
- showMoreInfo?: boolean;
- style?: React.CSSProperties;
- topic: ImageGenerationTopic;
-}
-
-const TopicItem = memo<TopicItemProps>(({ topic, showMoreInfo, style }) => {
- const { useStore, namespace } = useGenerationTopicContext();
- const { t } = useTranslation(namespace);
- const { modal } = App.useApp();
- const locale = useGlobalStore(globalGeneralSelectors.currentLanguage);
-
- const isLoading = useStore((s) => s.loadingGenerationTopicIds.includes(topic.id));
- const removeGenerationTopic = useStore((s) => s.removeGenerationTopic);
- const switchGenerationTopic = useStore((s) => s.switchGenerationTopic);
- const activeTopicId = useStore((s) => s.activeGenerationTopicId);
-
- const isActive = activeTopicId === topic.id;
-
- const handleClick = () => {
- switchGenerationTopic(topic.id);
- };
-
- const handleDelete = (e: React.MouseEvent) => {
- e.stopPropagation();
-
- modal.confirm({
- cancelText: t('cancel', { ns: 'common' }),
- content: t('topic.deleteConfirmDesc'),
- okButtonProps: { danger: true },
- okText: t('delete', { ns: 'common' }),
- onOk: async () => {
- try {
- await removeGenerationTopic(topic.id);
- } catch (error) {
- console.error('Delete topic failed:', error);
- }
- },
- title: t('topic.deleteConfirm'),
- });
- };
-
- const tooltipContent = (
- <Flexbox
- horizontal
- align={'center'}
- flex={1}
- gap={16}
- justify={'space-between'}
- style={{
- overflow: 'hidden',
- }}
- >
- <Flexbox
- flex={1}
- style={{
- overflow: 'hidden',
- }}
- >
- <Text ellipsis fontSize={14} weight={500}>
- {topic.title || t('topic.untitled')}
- </Text>
- <Text ellipsis fontSize={12} type={'secondary'}>
- {formatTime(topic.updatedAt, locale)}
- </Text>
- </Flexbox>
- <ActionIcon danger icon={Trash} size="small" onClick={handleDelete} />
- </Flexbox>
- );
-
- return (
- <Popover
- content={tooltipContent}
- placement={'left'}
- trigger={showMoreInfo ? [] : ['hover']}
- styles={{
- content: {
- width: 200,
- },
- }}
- >
- <Flexbox
- horizontal
- align={'center'}
- gap={12}
- justify={'center'}
- width={'100%'}
- style={{
- cursor: 'pointer',
- ...style,
- }}
- onClick={handleClick}
- >
- <Avatar
- avatar={topic.coverUrl ?? ''}
- background={cssVar.colorFillSecondary}
- bordered={isActive}
- loading={isLoading}
- shape="square"
- size={48}
- style={{
- flex: 'none',
- }}
- />
- {showMoreInfo && tooltipContent}
- </Flexbox>
- </Popover>
- );
-});
-
-TopicItem.displayName = 'TopicItem';
-
-export default TopicItem;
diff --git a/src/features/GenerationTopicList/TopicList.tsx b/src/features/GenerationTopicList/TopicList.tsx
deleted file mode 100644
index d6f0e18d24d..00000000000
--- a/src/features/GenerationTopicList/TopicList.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-'use client';
-
-import { useAutoAnimate } from '@formkit/auto-animate/react';
-import { Flexbox } from '@lobehub/ui';
-import { useSize } from 'ahooks';
-import { memo, useRef } from 'react';
-
-import { useUserStore } from '@/store/user';
-import { authSelectors } from '@/store/user/slices/auth/selectors';
-
-import NewTopicButton from './NewTopicButton';
-import { useGenerationTopicContext } from './StoreContext';
-import TopicItem from './TopicItem';
-
-const TopicsList = memo(() => {
- const { useStore } = useGenerationTopicContext();
- const isLogin = useUserStore(authSelectors.isLogin);
- const useFetchGenerationTopics = useStore((s) => s.useFetchGenerationTopics);
- useFetchGenerationTopics(!!isLogin);
- const ref = useRef(null);
- const { width = 80 } = useSize(ref) || {};
- const [parent] = useAutoAnimate();
- const generationTopics = useStore((s) => s.generationTopics);
- const openNewGenerationTopic = useStore((s) => s.openNewGenerationTopic);
-
- const showMoreInfo = Boolean(width > 120);
-
- const isEmpty = !generationTopics || generationTopics.length === 0;
- if (isEmpty) {
- return null;
- }
-
- return (
- <Flexbox
- align="center"
- gap={12}
- padding={12}
- ref={ref}
- width={'100%'}
- style={{
- maxHeight: '100%',
- overflowY: 'auto',
- }}
- >
- <NewTopicButton
- count={generationTopics?.length}
- showMoreInfo={showMoreInfo}
- onClick={openNewGenerationTopic}
- />
- <Flexbox align="center" gap={12} ref={parent} width={'100%'}>
- {generationTopics.map((topic, index) => (
- <TopicItem
- key={topic.id}
- showMoreInfo={showMoreInfo}
- topic={topic}
- style={{
- padding:
- generationTopics.length === 1
- ? '4px 0'
- : index === generationTopics.length - 1
- ? '0 0 4px'
- : '0',
- }}
- />
- ))}
- </Flexbox>
- </Flexbox>
- );
-});
-
-TopicsList.displayName = 'TopicsList';
-
-export default TopicsList;
diff --git a/src/features/GenerationTopicList/index.tsx b/src/features/GenerationTopicList/index.tsx
deleted file mode 100644
index b04e52a0c16..00000000000
--- a/src/features/GenerationTopicList/index.tsx
+++ /dev/null
@@ -1,7 +0,0 @@
-export { default as NewTopicButton } from './NewTopicButton';
-export { default as SkeletonList } from './SkeletonList';
-export type { GenerationTopicContextValue, GenerationTopicStoreSlice } from './StoreContext';
-export { GenerationTopicStoreProvider, useGenerationTopicContext } from './StoreContext';
-export { default as TopicItem } from './TopicItem';
-export { default as TopicList } from './TopicList';
-export { default as TopicUrlSync } from './TopicUrlSync';
diff --git a/src/features/GenerationTopicPanel/index.tsx b/src/features/GenerationTopicPanel/index.tsx
deleted file mode 100644
index 0214aef26fd..00000000000
--- a/src/features/GenerationTopicPanel/index.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-'use client';
-
-import { DraggablePanel, DraggablePanelContainer, type DraggablePanelProps } from '@lobehub/ui';
-import { createStaticStyles, cssVar, useResponsive } from 'antd-style';
-import isEqual from 'fast-deep-equal';
-import { memo, type PropsWithChildren, useEffect, useState } from 'react';
-
-export const styles = createStaticStyles(({ css }) => ({
- content: css`
- height: 100%;
- background: ${cssVar.colorBgContainer};
- `,
- handle: css`
- background: ${cssVar.colorBgContainer} !important;
- `,
-}));
-
-interface GenerationTopicPanelProps extends PropsWithChildren {
- onExpandChange: (expand: boolean) => void;
- onSizeChange: (width: number) => void;
- panelWidth: number;
- showPanel: boolean;
-}
-
-const GenerationTopicPanel = memo<GenerationTopicPanelProps>(
- ({ children, panelWidth, showPanel, onExpandChange, onSizeChange }) => {
- const { md = true } = useResponsive();
-
- const [tmpWidth, setWidth] = useState(panelWidth);
- if (tmpWidth !== panelWidth) setWidth(panelWidth);
- const [cacheExpand, setCacheExpand] = useState<boolean>(Boolean(showPanel));
-
- const handleExpand = (expand: boolean) => {
- if (isEqual(expand, showPanel)) return;
- onExpandChange(expand);
- setCacheExpand(expand);
- };
-
- useEffect(() => {
- if (md && cacheExpand) onExpandChange(true);
- if (!md) onExpandChange(false);
- }, [md, cacheExpand]);
-
- const handleSizeChange: DraggablePanelProps['onSizeChange'] = (_, size) => {
- if (!size) return;
- const nextWidth = typeof size.width === 'string' ? Number.parseInt(size.width) : size.width;
- if (!nextWidth) return;
-
- if (isEqual(nextWidth, panelWidth)) return;
- setWidth(nextWidth);
- onSizeChange(nextWidth);
- };
-
- return (
- <DraggablePanel
- defaultSize={{ width: tmpWidth }}
- expand={showPanel}
- maxWidth={320}
- minWidth={80}
- mode={md ? 'fixed' : 'float'}
- placement="right"
- size={{ height: '100%', width: panelWidth }}
- classNames={{
- content: styles.content,
- handle: styles.handle,
- }}
- onExpandChange={handleExpand}
- onSizeChange={handleSizeChange}
- >
- <DraggablePanelContainer
- style={{
- flex: 'none',
- height: '100%',
- minWidth: 80,
- }}
- >
- {children}
- </DraggablePanelContainer>
- </DraggablePanel>
- );
- },
-);
-
-GenerationTopicPanel.displayName = 'GenerationTopicPanel';
-
-export default GenerationTopicPanel;
diff --git a/src/features/ImageSidePanel/index.tsx b/src/features/ImageSidePanel/index.tsx
deleted file mode 100644
index 95fc001ae23..00000000000
--- a/src/features/ImageSidePanel/index.tsx
+++ /dev/null
@@ -1,84 +0,0 @@
-'use client';
-
-import { type DraggablePanelProps } from '@lobehub/ui';
-import { DraggablePanel, DraggablePanelContainer } from '@lobehub/ui';
-import { createStaticStyles, cssVar, useResponsive } from 'antd-style';
-import isEqual from 'fast-deep-equal';
-import { type PropsWithChildren } from 'react';
-import { memo, useEffect, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import PanelTitle from '@/components/PanelTitle';
-import { FOLDER_WIDTH } from '@/const/layoutTokens';
-import { useGlobalStore } from '@/store/global';
-import { systemStatusSelectors } from '@/store/global/selectors';
-
-export const styles = createStaticStyles(({ css }) => ({
- panel: css`
- height: 100%;
- background: ${cssVar.colorBgLayout};
- `,
-}));
-
-const ImageSidePanel = memo<PropsWithChildren>(({ children }) => {
- const { md = true } = useResponsive();
- const { t } = useTranslation('image');
- const [imagePanelWidth, showImagePanel, updateSystemStatus] = useGlobalStore((s) => [
- systemStatusSelectors.imagePanelWidth(s),
- systemStatusSelectors.showImagePanel(s),
- s.updateSystemStatus,
- ]);
-
- const [tmpWidth, setWidth] = useState(imagePanelWidth);
- if (tmpWidth !== imagePanelWidth) setWidth(imagePanelWidth);
- const [cacheExpand, setCacheExpand] = useState<boolean>(Boolean(showImagePanel));
-
- const handleExpand = (expand: boolean) => {
- if (isEqual(expand, showImagePanel)) return;
- updateSystemStatus({ showImagePanel: expand });
- setCacheExpand(expand);
- };
- useEffect(() => {
- if (md && cacheExpand) updateSystemStatus({ showImagePanel: true });
- if (!md) updateSystemStatus({ showImagePanel: false });
- }, [md, cacheExpand]);
-
- const handleSizeChange: DraggablePanelProps['onSizeChange'] = (_, size) => {
- if (!size) return;
- const nextWidth = typeof size.width === 'string' ? Number.parseInt(size.width) : size.width;
- if (!nextWidth) return;
-
- if (isEqual(nextWidth, imagePanelWidth)) return;
- setWidth(nextWidth);
- updateSystemStatus({ imagePanelWidth: nextWidth });
- };
-
- return (
- <DraggablePanel
- className={styles.panel}
- defaultSize={{ width: tmpWidth }}
- expand={showImagePanel}
- maxWidth={320}
- minWidth={FOLDER_WIDTH}
- mode={md ? 'fixed' : 'float'}
- placement="left"
- size={{ height: '100%', width: imagePanelWidth }}
- onExpandChange={handleExpand}
- onSizeChange={handleSizeChange}
- >
- <DraggablePanelContainer
- style={{
- flex: 'none',
- height: '100%',
- minWidth: FOLDER_WIDTH,
- zIndex: 10,
- }}
- >
- <PanelTitle desc={t('config.header.desc')} title={t('config.header.title')} />
- {children}
- </DraggablePanelContainer>
- </DraggablePanel>
- );
-});
-
-export default ImageSidePanel;
diff --git a/src/features/ImageTopicPanel/index.tsx b/src/features/ImageTopicPanel/index.tsx
deleted file mode 100644
index 36facc9ad76..00000000000
--- a/src/features/ImageTopicPanel/index.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-'use client';
-
-import { type PropsWithChildren } from 'react';
-import { memo } from 'react';
-
-import GenerationTopicPanel from '@/features/GenerationTopicPanel';
-import { useGlobalStore } from '@/store/global';
-import { systemStatusSelectors } from '@/store/global/selectors';
-
-const ImageTopicPanel = memo<PropsWithChildren>(({ children }) => {
- const [imageTopicPanelWidth, showImageTopicPanel, updateSystemStatus] = useGlobalStore((s) => [
- systemStatusSelectors.imageTopicPanelWidth(s),
- systemStatusSelectors.showImageTopicPanel(s),
- s.updateSystemStatus,
- ]);
-
- return (
- <GenerationTopicPanel
- panelWidth={imageTopicPanelWidth ?? 256}
- showPanel={showImageTopicPanel ?? true}
- onExpandChange={(expand) => updateSystemStatus({ showImageTopicPanel: expand })}
- onSizeChange={(width) => updateSystemStatus({ imageTopicPanelWidth: width })}
- >
- {children}
- </GenerationTopicPanel>
- );
-});
-
-ImageTopicPanel.displayName = 'ImageTopicPanel';
-
-export default ImageTopicPanel;
diff --git a/src/features/ModelSwitchPanel/components/List/GenerationListItemRenderer.tsx b/src/features/ModelSwitchPanel/components/List/GenerationListItemRenderer.tsx
new file mode 100644
index 00000000000..766861f7436
--- /dev/null
+++ b/src/features/ModelSwitchPanel/components/List/GenerationListItemRenderer.tsx
@@ -0,0 +1,229 @@
+'use client';
+
+import {
+ ActionIcon,
+ DropdownMenuPopup,
+ DropdownMenuPortal,
+ DropdownMenuPositioner,
+ DropdownMenuSubmenuRoot,
+ DropdownMenuSubmenuTrigger,
+ Flexbox,
+ Icon,
+ menuSharedStyles,
+} from '@lobehub/ui';
+import { cssVar, cx } from 'antd-style';
+import { LucideArrowRight, LucideBolt } from 'lucide-react';
+import type { ComponentType } from 'react';
+import { memo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useNavigate } from 'react-router-dom';
+import urlJoin from 'url-join';
+
+import { ProviderItemRender } from '@/components/ModelSelect';
+import type { PricingMode } from '@/features/ModelSwitchPanel/components/ModelDetailPanel';
+import ModelDetailPanel from '@/features/ModelSwitchPanel/components/ModelDetailPanel';
+import { styles as modelSwitchPanelStyles } from '@/features/ModelSwitchPanel/styles';
+import type { ListItem } from '@/features/ModelSwitchPanel/types';
+import { menuKey } from '@/features/ModelSwitchPanel/utils';
+import type { EnabledProviderWithModels } from '@/types/index';
+
+import GenerationMultipleProvidersItem from './GenerationMultipleProvidersItem';
+
+export interface GenerationListItemRendererProps {
+ activeKey: string;
+ enabledList: EnabledProviderWithModels[];
+ item: ListItem;
+ ModelItemComponent: ComponentType<any>;
+ onClose: () => void;
+ onModelChange: (modelId: string, providerId: string) => void;
+ pricingMode?: PricingMode;
+}
+
+const GenerationListItemRenderer = memo<GenerationListItemRendererProps>(
+ ({ item, activeKey, onClose, onModelChange, enabledList, ModelItemComponent, pricingMode }) => {
+ const { t } = useTranslation('components');
+ const navigate = useNavigate();
+ const [detailOpen, setDetailOpen] = useState(false);
+
+ switch (item.type) {
+ case 'no-provider': {
+ return (
+ <Flexbox
+ horizontal
+ className={modelSwitchPanelStyles.menuItem}
+ gap={8}
+ style={{ color: cssVar.colorTextTertiary }}
+ onClick={() => {
+ navigate('/settings/provider/all');
+ onClose();
+ }}
+ >
+ {t('ModelSwitchPanel.emptyProvider')}
+ <Icon icon={LucideArrowRight} />
+ </Flexbox>
+ );
+ }
+
+ case 'group-header': {
+ return (
+ <Flexbox
+ horizontal
+ className={modelSwitchPanelStyles.groupHeader}
+ justify="space-between"
+ paddingBlock="12px 4px"
+ paddingInline="12px 8px"
+ >
+ <ProviderItemRender
+ logo={item.provider.logo}
+ name={item.provider.name}
+ provider={item.provider.id}
+ source={item.provider.source}
+ />
+ <ActionIcon
+ className="settings-icon"
+ icon={LucideBolt}
+ size="small"
+ title={t('ModelSwitchPanel.goToSettings')}
+ onClick={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ const url = urlJoin('/settings/provider', item.provider.id || 'all');
+ if (e.ctrlKey || e.metaKey) {
+ window.open(url, '_blank');
+ } else {
+ navigate(url);
+ }
+ onClose();
+ }}
+ />
+ </Flexbox>
+ );
+ }
+
+ case 'empty-model': {
+ return (
+ <Flexbox
+ horizontal
+ className={modelSwitchPanelStyles.menuItem}
+ gap={8}
+ style={{ color: cssVar.colorTextTertiary }}
+ onClick={() => {
+ navigate(`/settings/provider/${item.provider.id}`);
+ onClose();
+ }}
+ >
+ {t('ModelSwitchPanel.emptyModel')}
+ <Icon icon={LucideArrowRight} />
+ </Flexbox>
+ );
+ }
+
+ case 'provider-model-item': {
+ const key = menuKey(item.provider.id, item.model.id);
+ const isActive = key === activeKey;
+ return (
+ <Flexbox style={{ marginBlock: 1, marginInline: 4 }}>
+ <DropdownMenuSubmenuRoot open={detailOpen} onOpenChange={setDetailOpen}>
+ <DropdownMenuSubmenuTrigger
+ style={{ paddingBlock: 8, paddingInline: 8 }}
+ className={cx(
+ menuSharedStyles.item,
+ isActive && modelSwitchPanelStyles.menuItemActive,
+ )}
+ onClick={() => {
+ setDetailOpen(false);
+ onModelChange(item.model.id, item.provider.id);
+ onClose();
+ }}
+ >
+ <ModelItemComponent
+ {...item.model}
+ providerId={item.provider.id}
+ showBadge={false}
+ showPopover={false}
+ />
+ </DropdownMenuSubmenuTrigger>
+ <DropdownMenuPortal>
+ <DropdownMenuPositioner anchor={null} placement="right" sideOffset={12}>
+ <DropdownMenuPopup className={modelSwitchPanelStyles.detailPopup}>
+ <ModelDetailPanel
+ enabledList={enabledList}
+ model={item.model.id}
+ pricingMode={pricingMode}
+ provider={item.provider.id}
+ />
+ </DropdownMenuPopup>
+ </DropdownMenuPositioner>
+ </DropdownMenuPortal>
+ </DropdownMenuSubmenuRoot>
+ </Flexbox>
+ );
+ }
+
+ case 'model-item-single': {
+ const singleProvider = item.data.providers[0];
+ const key = menuKey(singleProvider.id, item.data.model.id);
+ const isActive = key === activeKey;
+ return (
+ <Flexbox style={{ marginBlock: 1, marginInline: 4 }}>
+ <DropdownMenuSubmenuRoot open={detailOpen} onOpenChange={setDetailOpen}>
+ <DropdownMenuSubmenuTrigger
+ style={{ paddingBlock: 8, paddingInline: 8 }}
+ className={cx(
+ menuSharedStyles.item,
+ isActive && modelSwitchPanelStyles.menuItemActive,
+ )}
+ onClick={() => {
+ setDetailOpen(false);
+ onModelChange(item.data.model.id, singleProvider.id);
+ onClose();
+ }}
+ >
+ <ModelItemComponent
+ {...item.data.model}
+ providerId={singleProvider.id}
+ showBadge={false}
+ showPopover={false}
+ />
+ </DropdownMenuSubmenuTrigger>
+ <DropdownMenuPortal>
+ <DropdownMenuPositioner anchor={null} placement="right" sideOffset={12}>
+ <DropdownMenuPopup className={modelSwitchPanelStyles.detailPopup}>
+ <ModelDetailPanel
+ enabledList={enabledList}
+ model={item.data.model.id}
+ pricingMode={pricingMode}
+ provider={singleProvider.id}
+ />
+ </DropdownMenuPopup>
+ </DropdownMenuPositioner>
+ </DropdownMenuPortal>
+ </DropdownMenuSubmenuRoot>
+ </Flexbox>
+ );
+ }
+
+ case 'model-item-multiple': {
+ return (
+ <GenerationMultipleProvidersItem
+ ModelItemComponent={ModelItemComponent}
+ activeKey={activeKey}
+ enabledList={enabledList}
+ item={item}
+ pricingMode={pricingMode}
+ onClose={onClose}
+ onModelChange={onModelChange}
+ />
+ );
+ }
+
+ default: {
+ return null;
+ }
+ }
+ },
+);
+
+GenerationListItemRenderer.displayName = 'GenerationListItemRenderer';
+
+export default GenerationListItemRenderer;
diff --git a/src/features/ModelSwitchPanel/components/List/GenerationMultipleProvidersItem.tsx b/src/features/ModelSwitchPanel/components/List/GenerationMultipleProvidersItem.tsx
new file mode 100644
index 00000000000..414d05ea9a9
--- /dev/null
+++ b/src/features/ModelSwitchPanel/components/List/GenerationMultipleProvidersItem.tsx
@@ -0,0 +1,112 @@
+'use client';
+
+import {
+ DropdownMenuPopup,
+ DropdownMenuPortal,
+ DropdownMenuPositioner,
+ DropdownMenuSubmenuRoot,
+ DropdownMenuSubmenuTrigger,
+ Flexbox,
+ menuSharedStyles,
+} from '@lobehub/ui';
+import { cssVar, cx } from 'antd-style';
+import { Check } from 'lucide-react';
+import type { ComponentType } from 'react';
+import { memo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { ProviderItemRender } from '@/components/ModelSelect';
+import type { PricingMode } from '@/features/ModelSwitchPanel/components/ModelDetailPanel';
+import ModelDetailPanel from '@/features/ModelSwitchPanel/components/ModelDetailPanel';
+import { styles as modelSwitchPanelStyles } from '@/features/ModelSwitchPanel/styles';
+import type { ListItem } from '@/features/ModelSwitchPanel/types';
+import { menuKey } from '@/features/ModelSwitchPanel/utils';
+import type { EnabledProviderWithModels } from '@/types/index';
+
+interface GenerationMultipleProvidersItemProps {
+ activeKey: string;
+ enabledList: EnabledProviderWithModels[];
+ item: Extract<ListItem, { type: 'model-item-multiple' }>;
+ ModelItemComponent: ComponentType<any>;
+ onClose: () => void;
+ onModelChange: (modelId: string, providerId: string) => void;
+ pricingMode?: PricingMode;
+}
+
+const GenerationMultipleProvidersItem = memo<GenerationMultipleProvidersItemProps>(
+ ({ item, activeKey, onClose, onModelChange, enabledList, ModelItemComponent, pricingMode }) => {
+ const { t } = useTranslation('components');
+ const [subOpen, setSubOpen] = useState(false);
+ const activeProvider = item.data.providers.find(
+ (p) => menuKey(p.id, item.data.model.id) === activeKey,
+ );
+ const isActive = !!activeProvider;
+
+ return (
+ <Flexbox style={{ marginBlock: 1, marginInline: 4 }}>
+ <DropdownMenuSubmenuRoot open={subOpen} onOpenChange={setSubOpen}>
+ <DropdownMenuSubmenuTrigger
+ className={cx(menuSharedStyles.item, isActive && modelSwitchPanelStyles.menuItemActive)}
+ style={{ paddingBlock: 8, paddingInline: 8 }}
+ >
+ <ModelItemComponent
+ {...item.data.model}
+ providerId={(activeProvider ?? item.data.providers[0]).id}
+ showBadge={false}
+ showPopover={false}
+ />
+ </DropdownMenuSubmenuTrigger>
+ <DropdownMenuPortal>
+ <DropdownMenuPositioner anchor={null} placement="right" sideOffset={12}>
+ <DropdownMenuPopup
+ className={cx(
+ modelSwitchPanelStyles.detailPopup,
+ modelSwitchPanelStyles.dropdownMenu,
+ )}
+ >
+ <ModelDetailPanel
+ enabledList={enabledList}
+ model={item.data.model.id}
+ pricingMode={pricingMode}
+ provider={(activeProvider ?? item.data.providers[0]).id}
+ />
+ <Flexbox gap={4} paddingBlock={8} paddingInline={8}>
+ <Flexbox style={{ color: cssVar.colorTextSecondary, fontSize: 12 }}>
+ {t('ModelSwitchPanel.useModelFrom')}
+ </Flexbox>
+ {item.data.providers.map((p) => {
+ const pKey = menuKey(p.id, item.data.model.id);
+ const isProviderActive = activeKey === pKey;
+ return (
+ <Flexbox
+ horizontal
+ className={modelSwitchPanelStyles.menuItem}
+ key={pKey}
+ onClick={() => {
+ onModelChange(item.data.model.id, p.id);
+ onClose();
+ }}
+ >
+ <ProviderItemRender
+ logo={p.logo}
+ name={p.name}
+ provider={p.id}
+ source={p.source}
+ />
+ {isProviderActive ? <Check size={16} /> : null}
+ </Flexbox>
+ );
+ })}
+ </Flexbox>
+ </DropdownMenuPopup>
+ </DropdownMenuPositioner>
+ </DropdownMenuPortal>
+ </DropdownMenuSubmenuRoot>
+ </Flexbox>
+ );
+ },
+);
+
+GenerationMultipleProvidersItem.displayName = 'GenerationMultipleProvidersItem';
+
+export default GenerationMultipleProvidersItem;
diff --git a/src/features/ModelSwitchPanel/components/List/index.tsx b/src/features/ModelSwitchPanel/components/List/index.tsx
index 7446623232c..27e1edf5388 100644
--- a/src/features/ModelSwitchPanel/components/List/index.tsx
+++ b/src/features/ModelSwitchPanel/components/List/index.tsx
@@ -1,10 +1,11 @@
import { Flexbox } from '@lobehub/ui';
-import { type FC } from 'react';
+import { type ComponentType, type FC } from 'react';
import { useCallback, useLayoutEffect, useMemo, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { useBusinessModelListGuard } from '@/business/client/hooks/useBusinessModelListGuard';
import { useEnabledChatModels } from '@/hooks/useEnabledChatModels';
+import type { EnabledProviderWithModels } from '@/types/aiProvider';
import { FOOTER_HEIGHT, ITEM_HEIGHT, MAX_PANEL_HEIGHT, TOOLBAR_HEIGHT } from '../../const';
import { useBuildListItems } from '../../hooks/useBuildListItems';
@@ -13,22 +14,30 @@ import { usePanelHandlers } from '../../hooks/usePanelHandlers';
import { styles } from '../../styles';
import { type GroupMode } from '../../types';
import { menuKey } from '../../utils';
+import type { PricingMode } from '../ModelDetailPanel';
+import GenerationListItemRenderer from './GenerationListItemRenderer';
import { ListItemRenderer } from './ListItemRenderer';
interface ListProps {
+ enabledList?: EnabledProviderWithModels[];
groupMode: GroupMode;
model?: string;
+ ModelItemComponent?: ComponentType<any>;
onModelChange?: (params: { model: string; provider: string }) => Promise<void>;
onOpenChange?: (open: boolean) => void;
+ pricingMode?: PricingMode;
provider?: string;
searchKeyword?: string;
}
export const List: FC<ListProps> = ({
+ ModelItemComponent,
+ enabledList: enabledListProp,
groupMode,
model: modelProp,
onModelChange: onModelChangeProp,
onOpenChange,
+ pricingMode,
provider: providerProp,
searchKeyword = '',
}) => {
@@ -37,7 +46,8 @@ export const List: FC<ListProps> = ({
const { isModelRestricted, onRestrictedModelClick } = useBusinessModelListGuard();
const proLabel = isModelRestricted ? tCommon('pro') : undefined;
- const enabledList = useEnabledChatModels();
+ const chatEnabledList = useEnabledChatModels();
+ const enabledList = enabledListProp ?? chatEnabledList;
const { model, provider } = useModelAndProvider(modelProp, providerProp);
const { handleModelChange, handleClose } = usePanelHandlers({
onModelChange: onModelChangeProp,
@@ -115,20 +125,32 @@ export const List: FC<ListProps> = ({
(item.type === 'model-item-multiple' &&
item.data.providers.some((p) => menuKey(p.id, item.data.model.id) === activeKey));
- const renderItem = (key?: string) => (
- <ListItemRenderer
- activeKey={activeKey}
- isModelRestricted={isModelRestricted}
- item={item}
- key={key}
- newLabel={newLabel}
- proLabel={proLabel}
- subscribeScroll={subscribeScroll}
- onClose={handleClose}
- onModelChange={handleModelChange}
- onRestrictedModelClick={onRestrictedModelClick}
- />
- );
+ const renderItem = (key?: string) =>
+ ModelItemComponent ? (
+ <GenerationListItemRenderer
+ ModelItemComponent={ModelItemComponent}
+ activeKey={activeKey}
+ enabledList={enabledList}
+ item={item}
+ key={key}
+ pricingMode={pricingMode}
+ onClose={handleClose}
+ onModelChange={handleModelChange}
+ />
+ ) : (
+ <ListItemRenderer
+ activeKey={activeKey}
+ isModelRestricted={isModelRestricted}
+ item={item}
+ key={key}
+ newLabel={newLabel}
+ proLabel={proLabel}
+ subscribeScroll={subscribeScroll}
+ onClose={handleClose}
+ onModelChange={handleModelChange}
+ onRestrictedModelClick={onRestrictedModelClick}
+ />
+ );
return isActive ? (
<div key={itemKey} ref={activeItemRef}>
diff --git a/src/features/ModelSwitchPanel/components/ModelDetailPanel.tsx b/src/features/ModelSwitchPanel/components/ModelDetailPanel.tsx
index 8a96fbd2a0a..9547b1b7e7c 100644
--- a/src/features/ModelSwitchPanel/components/ModelDetailPanel.tsx
+++ b/src/features/ModelSwitchPanel/components/ModelDetailPanel.tsx
@@ -28,6 +28,7 @@ import { useTranslation } from 'react-i18next';
import { useEnabledChatModels } from '@/hooks/useEnabledChatModels';
import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra';
+import type { EnabledProviderWithModels } from '@/types/aiProvider';
import { formatTokenNumber } from '@/utils/format';
import { formatPriceByCurrency, getTextInputUnitRate, getTextOutputUnitRate } from '@/utils/index';
@@ -216,274 +217,313 @@ const ABILITY_CONFIG: AbilityItem[] = [
{ color: 'cyan', icon: GlobeIcon, key: 'search' },
];
+export type PricingMode = 'image' | 'video';
+
interface ModelDetailPanelProps {
+ enabledList?: EnabledProviderWithModels[];
model?: string;
+ pricingMode?: PricingMode;
provider?: string;
}
-const ModelDetailPanel: FC<ModelDetailPanelProps> = memo(({ model: modelId, provider }) => {
- const { t } = useTranslation('components');
-
- const enabledList = useEnabledChatModels();
- const model = useMemo(() => {
- if (!modelId || !provider) return undefined;
- const providerData = enabledList.find((p) => p.id === provider);
- return providerData?.children.find((m) => m.id === modelId);
- }, [enabledList, modelId, provider]);
-
- const hasExtendParams = useAiInfraStore(
- aiModelSelectors.isModelHasExtendParams(modelId ?? '', provider ?? ''),
- );
-
- const [expandedKeys, setExpandedKeys] = useState<string[]>(() => {
- const keys: string[] = [];
- if (hasExtendParams) keys.push('config');
- return keys;
- });
-
- const hasPricing = !!model?.pricing;
- const formatPrice = hasPricing ? getPrice(model!.pricing!) : null;
- const pricingGroups = useMemo(
- () => (hasPricing ? groupPricingUnits(model!.pricing!.units) : []),
- [hasPricing, model?.pricing],
- );
-
- if (!model) return null;
-
- const hasContext = typeof model.contextWindowTokens === 'number';
- const enabledAbilities = ABILITY_CONFIG.filter(
- (a) => model.abilities[a.key as keyof typeof model.abilities],
- );
- const hasAbilities = enabledAbilities.length > 0;
-
- return (
- <Flexbox className={styles.container}>
- {/* Sections */}
- {(hasPricing || hasContext || hasAbilities || hasExtendParams) && (
- <Accordion
- expandedKeys={expandedKeys}
- gap={8}
- onExpandedChange={(keys) => setExpandedKeys(keys as string[])}
- >
- {/* Context Length */}
- {hasContext && (
- <AccordionItem
- alwaysShowAction
- hideIndicator
- allowExpand={false}
- itemKey="context"
- paddingBlock={6}
- paddingInline={8}
- action={
- <span className={styles.actionText}>
- {model.contextWindowTokens === 0
- ? '∞'
- : `${formatTokenNumber(model.contextWindowTokens!)} tokens`}
- </span>
- }
- title={
- <Flexbox horizontal align={'center'} gap={8}>
- <div
- style={{
- background: '#1677ff',
- borderRadius: 2,
- flexShrink: 0,
- height: 14,
- width: 3,
- }}
- />
- <span className={styles.titleText}>{t('ModelSwitchPanel.detail.context')}</span>
- </Flexbox>
- }
- />
- )}
-
- {/* Abilities */}
- {hasAbilities && (
- <AccordionItem
- alwaysShowAction
- itemKey="abilities"
- paddingBlock={6}
- paddingInline={8}
- action={
- !expandedKeys.includes('abilities') && (
- <Flexbox horizontal gap={2}>
- {enabledAbilities.map((ability) => (
- <Tag
- color={ability.color}
- key={ability.key}
- style={{ borderRadius: 4, minWidth: 0, padding: '0 4px' }}
- >
- <Icon icon={ability.icon} style={{ fontSize: 12 }} />
- </Tag>
- ))}
+const ModelDetailPanel: FC<ModelDetailPanelProps> = memo(
+ ({ model: modelId, provider, enabledList: enabledListProp, pricingMode }) => {
+ const { t } = useTranslation('components');
+
+ const enabledListFromHook = useEnabledChatModels();
+ const enabledList = enabledListProp ?? enabledListFromHook;
+ const model = useMemo(() => {
+ if (!modelId || !provider) return undefined;
+ const providerData = enabledList.find((p) => p.id === provider);
+ return providerData?.children.find((m) => m.id === modelId);
+ }, [enabledList, modelId, provider]);
+
+ const hasExtendParams = useAiInfraStore(
+ aiModelSelectors.isModelHasExtendParams(modelId ?? '', provider ?? ''),
+ );
+
+ const [expandedKeys, setExpandedKeys] = useState<string[]>(() => {
+ const keys: string[] = ['pricing'];
+ // ControlsForm uses ChatInput store + useAgentId; not available on create/image|video routes.
+ if (hasExtendParams && !pricingMode) keys.push('config');
+ return keys;
+ });
+
+ const hasPricing = !!model?.pricing;
+ const formatPrice = hasPricing ? getPrice(model!.pricing!) : null;
+ const pricingGroups = useMemo(
+ () => (hasPricing ? groupPricingUnits(model!.pricing!.units) : []),
+ [hasPricing, model?.pricing],
+ );
+
+ const approximatePriceLabel = useMemo(() => {
+ if (!hasPricing || !model?.pricing || !pricingMode) return null;
+ const pricing = model.pricing;
+ const currency = pricing.currency as ModelPriceCurrency | undefined;
+ if (pricingMode === 'image' && typeof pricing.approximatePricePerImage === 'number') {
+ const amount = formatPriceByCurrency(pricing.approximatePricePerImage, currency);
+ return t('ModelSwitchPanel.detail.pricing.perImage', {
+ amount,
+ defaultValue: '~ ${{amount}} / image',
+ });
+ }
+ if (pricingMode === 'video' && typeof pricing.approximatePricePerVideo === 'number') {
+ const amount = formatPriceByCurrency(pricing.approximatePricePerVideo, currency);
+ return t('ModelSwitchPanel.detail.pricing.perVideo', {
+ amount,
+ defaultValue: '~ ${{amount}} / video',
+ });
+ }
+ return null;
+ }, [hasPricing, model?.pricing, pricingMode, t]);
+
+ if (!model) return null;
+
+ const hasContext = typeof model.contextWindowTokens === 'number';
+ const enabledAbilities = ABILITY_CONFIG.filter(
+ (a) => model.abilities[a.key as keyof typeof model.abilities],
+ );
+ const hasAbilities = enabledAbilities.length > 0;
+
+ return (
+ <Flexbox className={styles.container}>
+ {/* Sections */}
+ {(hasPricing || hasContext || hasAbilities || (hasExtendParams && !pricingMode)) && (
+ <Accordion
+ expandedKeys={expandedKeys}
+ gap={8}
+ onExpandedChange={(keys) => setExpandedKeys(keys as string[])}
+ >
+ {/* Context Length */}
+ {hasContext && (
+ <AccordionItem
+ alwaysShowAction
+ hideIndicator
+ allowExpand={false}
+ itemKey="context"
+ paddingBlock={6}
+ paddingInline={8}
+ action={
+ <span className={styles.actionText}>
+ {model.contextWindowTokens === 0
+ ? '∞'
+ : `${formatTokenNumber(model.contextWindowTokens!)} tokens`}
+ </span>
+ }
+ title={
+ <Flexbox horizontal align={'center'} gap={8}>
+ <div
+ style={{
+ background: '#1677ff',
+ borderRadius: 2,
+ flexShrink: 0,
+ height: 14,
+ width: 3,
+ }}
+ />
+ <span className={styles.titleText}>{t('ModelSwitchPanel.detail.context')}</span>
</Flexbox>
- )
- }
- title={
- <Flexbox horizontal align={'center'} gap={8}>
- <div
- style={{
- background: '#722ed1',
- borderRadius: 2,
- flexShrink: 0,
- height: 14,
- width: 3,
- }}
- />
- <span className={styles.titleText}>{t('ModelSwitchPanel.detail.abilities')}</span>
- </Flexbox>
- }
- >
- <Flexbox gap={4}>
- {enabledAbilities.map((ability) => (
- <Flexbox
- horizontal
- align={'center'}
- className={styles.row}
- justify={'space-between'}
- key={ability.key}
- >
- <Flexbox horizontal align={'center'} gap={6}>
- <Icon icon={ability.icon} style={{ fontSize: 12 }} />
- <span>{t(`ModelSwitchPanel.detail.abilities.${ability.key}` as any)}</span>
+ }
+ />
+ )}
+
+ {/* Abilities */}
+ {hasAbilities && (
+ <AccordionItem
+ alwaysShowAction
+ itemKey="abilities"
+ paddingBlock={6}
+ paddingInline={8}
+ action={
+ !expandedKeys.includes('abilities') && (
+ <Flexbox horizontal gap={2}>
+ {enabledAbilities.map((ability) => (
+ <Tag
+ color={ability.color}
+ key={ability.key}
+ style={{ borderRadius: 4, minWidth: 0, padding: '0 4px' }}
+ >
+ <Icon icon={ability.icon} style={{ fontSize: 12 }} />
+ </Tag>
+ ))}
</Flexbox>
- <span style={{ color: 'var(--ant-color-text-tertiary)', fontSize: 11 }}>
- {t(
- `ModelSelect.featureTag.${ability.key === 'files' ? 'file' : ability.key}` as any,
- )}
+ )
+ }
+ title={
+ <Flexbox horizontal align={'center'} gap={8}>
+ <div
+ style={{
+ background: '#722ed1',
+ borderRadius: 2,
+ flexShrink: 0,
+ height: 14,
+ width: 3,
+ }}
+ />
+ <span className={styles.titleText}>
+ {t('ModelSwitchPanel.detail.abilities')}
</span>
</Flexbox>
- ))}
- </Flexbox>
- </AccordionItem>
- )}
-
- {/* Pricing */}
- {hasPricing && formatPrice && (
- <AccordionItem
- alwaysShowAction
- itemKey="pricing"
- paddingBlock={6}
- paddingInline={8}
- action={
- !expandedKeys.includes('pricing') && (
- <Flexbox horizontal align={'center'} className={styles.actionText} gap={8}>
- {getCachedTextInputUnitRate(model.pricing!) && (
+ }
+ >
+ <Flexbox gap={4}>
+ {enabledAbilities.map((ability) => (
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={styles.row}
+ justify={'space-between'}
+ key={ability.key}
+ >
+ <Flexbox horizontal align={'center'} gap={6}>
+ <Icon icon={ability.icon} style={{ fontSize: 12 }} />
+ <span>{t(`ModelSwitchPanel.detail.abilities.${ability.key}` as any)}</span>
+ </Flexbox>
+ <span style={{ color: 'var(--ant-color-text-tertiary)', fontSize: 11 }}>
+ {t(
+ `ModelSelect.featureTag.${ability.key === 'files' ? 'file' : ability.key}` as any,
+ )}
+ </span>
+ </Flexbox>
+ ))}
+ </Flexbox>
+ </AccordionItem>
+ )}
+
+ {/* Pricing */}
+ {hasPricing && (formatPrice || approximatePriceLabel) && (
+ <AccordionItem
+ alwaysShowAction
+ itemKey="pricing"
+ paddingBlock={6}
+ paddingInline={8}
+ action={
+ !expandedKeys.includes('pricing') &&
+ (approximatePriceLabel ? (
+ <span className={styles.actionText}>{approximatePriceLabel}</span>
+ ) : (
+ <Flexbox horizontal align={'center'} className={styles.actionText} gap={8}>
+ {getCachedTextInputUnitRate(model.pricing!) && (
+ <Tooltip
+ title={t('ModelSwitchPanel.detail.pricing.cachedInput', {
+ amount: formatPrice!.cachedInput,
+ })}
+ >
+ <Flexbox horizontal align={'center'} gap={2}>
+ <Icon icon={CircleFadingArrowUp} size={'small'} />
+ {formatPrice!.cachedInput}
+ </Flexbox>
+ </Tooltip>
+ )}
<Tooltip
- title={t('ModelSwitchPanel.detail.pricing.cachedInput', {
- amount: formatPrice.cachedInput,
+ title={t('ModelSwitchPanel.detail.pricing.input', {
+ amount: formatPrice!.input,
})}
>
<Flexbox horizontal align={'center'} gap={2}>
- <Icon icon={CircleFadingArrowUp} size={'small'} />
- {formatPrice.cachedInput}
+ <Icon icon={ArrowUpFromDot} size={'small'} />
+ {formatPrice!.input}
</Flexbox>
</Tooltip>
- )}
- <Tooltip
- title={t('ModelSwitchPanel.detail.pricing.input', {
- amount: formatPrice.input,
- })}
- >
- <Flexbox horizontal align={'center'} gap={2}>
- <Icon icon={ArrowUpFromDot} size={'small'} />
- {formatPrice.input}
- </Flexbox>
- </Tooltip>
- <Tooltip
- title={t('ModelSwitchPanel.detail.pricing.output', {
- amount: formatPrice.output,
- })}
- >
- <Flexbox horizontal align={'center'} gap={2}>
- <Icon icon={ArrowDownToDot} size={'small'} />
- {formatPrice.output}
- </Flexbox>
- </Tooltip>
- </Flexbox>
- )
- }
- title={
- <Flexbox horizontal align={'center'} gap={8}>
- <div
- style={{
- background: '#fa8c16',
- borderRadius: 2,
- flexShrink: 0,
- height: 14,
- width: 3,
- }}
- />
- <span className={styles.titleText}>{t('ModelSwitchPanel.detail.pricing')}</span>
- </Flexbox>
- }
- >
- <Flexbox gap={8}>
- {pricingGroups.map(({ group, units }) => (
- <Flexbox gap={4} key={group}>
- {pricingGroups.length > 1 && (
- <Flexbox className={styles.row} style={{ fontWeight: 500 }}>
- {t(`ModelSwitchPanel.detail.pricing.group.${group}` as any)}
- </Flexbox>
- )}
- {units.map((unit) => (
- <Flexbox
- horizontal
- align={'center'}
- className={styles.row}
- justify={'space-between'}
- key={unit.name}
+ <Tooltip
+ title={t('ModelSwitchPanel.detail.pricing.output', {
+ amount: formatPrice!.output,
+ })}
>
- <Flexbox horizontal align={'center'} gap={6}>
- {UNIT_ICON_MAP[unit.name] && (
- <Icon icon={UNIT_ICON_MAP[unit.name]!} size={'small'} />
- )}
+ <Flexbox horizontal align={'center'} gap={2}>
+ <Icon icon={ArrowDownToDot} size={'small'} />
+ {formatPrice!.output}
+ </Flexbox>
+ </Tooltip>
+ </Flexbox>
+ ))
+ }
+ title={
+ <Flexbox horizontal align={'center'} gap={8}>
+ <div
+ style={{
+ background: '#fa8c16',
+ borderRadius: 2,
+ flexShrink: 0,
+ height: 14,
+ width: 3,
+ }}
+ />
+ <span className={styles.titleText}>{t('ModelSwitchPanel.detail.pricing')}</span>
+ </Flexbox>
+ }
+ >
+ <Flexbox gap={8}>
+ {approximatePriceLabel && (
+ <Flexbox className={styles.row} style={{ fontWeight: 500 }}>
+ {approximatePriceLabel}
+ </Flexbox>
+ )}
+ {pricingGroups.map(({ group, units }) => (
+ <Flexbox gap={4} key={group}>
+ {pricingGroups.length > 1 && (
+ <Flexbox className={styles.row} style={{ fontWeight: 500 }}>
+ {t(`ModelSwitchPanel.detail.pricing.group.${group}` as any)}
+ </Flexbox>
+ )}
+ {units.map((unit) => (
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={styles.row}
+ justify={'space-between'}
+ key={unit.name}
+ >
+ <Flexbox horizontal align={'center'} gap={6}>
+ {UNIT_ICON_MAP[unit.name] && (
+ <Icon icon={UNIT_ICON_MAP[unit.name]!} size={'small'} />
+ )}
+ <span>
+ {t(`ModelSwitchPanel.detail.pricing.unit.${unit.name}` as any)}
+ </span>
+ </Flexbox>
<span>
- {t(`ModelSwitchPanel.detail.pricing.unit.${unit.name}` as any)}
+ {formatUnitRate(unit, model.pricing?.currency as ModelPriceCurrency)}
</span>
</Flexbox>
- <span>
- {formatUnitRate(unit, model.pricing?.currency as ModelPriceCurrency)}
- </span>
- </Flexbox>
- ))}
- </Flexbox>
- ))}
- </Flexbox>
- </AccordionItem>
- )}
- {/* Model Config */}
- {hasExtendParams && provider && (
- <AccordionItem
- itemKey="config"
- paddingBlock={6}
- paddingInline={8}
- title={
- <Flexbox horizontal align={'center'} gap={8}>
- <div
- style={{
- background: '#52c41a',
- borderRadius: 2,
- flexShrink: 0,
- height: 14,
- width: 3,
- }}
- />
- <span className={styles.titleText}>{t('ModelSwitchPanel.detail.config')}</span>
+ ))}
+ </Flexbox>
+ ))}
</Flexbox>
- }
- >
- <div className={styles.extraControls}>
- <ControlsForm model={modelId} provider={provider} />
- </div>
- </AccordionItem>
- )}
- </Accordion>
- )}
- </Flexbox>
- );
-});
+ </AccordionItem>
+ )}
+ {/* Model Config (agent chat only; requires ChatInput zustand provider) */}
+ {hasExtendParams && provider && !pricingMode && (
+ <AccordionItem
+ itemKey="config"
+ paddingBlock={6}
+ paddingInline={8}
+ title={
+ <Flexbox horizontal align={'center'} gap={8}>
+ <div
+ style={{
+ background: '#52c41a',
+ borderRadius: 2,
+ flexShrink: 0,
+ height: 14,
+ width: 3,
+ }}
+ />
+ <span className={styles.titleText}>{t('ModelSwitchPanel.detail.config')}</span>
+ </Flexbox>
+ }
+ >
+ <div className={styles.extraControls}>
+ <ControlsForm model={model.id} provider={provider} />
+ </div>
+ </AccordionItem>
+ )}
+ </Accordion>
+ )}
+ </Flexbox>
+ );
+ },
+);
ModelDetailPanel.displayName = 'ModelDetailPanel';
diff --git a/src/features/ModelSwitchPanel/components/PanelContent.tsx b/src/features/ModelSwitchPanel/components/PanelContent.tsx
index 2d5c270e35b..c25dd1cc07f 100644
--- a/src/features/ModelSwitchPanel/components/PanelContent.tsx
+++ b/src/features/ModelSwitchPanel/components/PanelContent.tsx
@@ -1,32 +1,41 @@
import { Flexbox } from '@lobehub/ui';
-import { type FC } from 'react';
+import { type ComponentType, type FC } from 'react';
import { useState } from 'react';
import { Rnd } from 'react-rnd';
import { useEnabledChatModels } from '@/hooks/useEnabledChatModels';
import { useUserStore } from '@/store/user';
import { userGeneralSettingsSelectors } from '@/store/user/slices/settings/selectors/general';
+import type { EnabledProviderWithModels } from '@/types/aiProvider';
import { DEFAULT_WIDTH, ENABLE_RESIZING, MAX_WIDTH, MIN_WIDTH } from '../const';
import { usePanelSize } from '../hooks/usePanelSize';
import { usePanelState } from '../hooks/usePanelState';
import { List } from './List';
+import type { PricingMode } from './ModelDetailPanel';
import { Toolbar } from './Toolbar';
interface PanelContentProps {
+ enabledList?: EnabledProviderWithModels[];
model?: string;
+ ModelItemComponent?: ComponentType<any>;
onModelChange?: (params: { model: string; provider: string }) => Promise<void>;
onOpenChange?: (open: boolean) => void;
+ pricingMode?: PricingMode;
provider?: string;
}
export const PanelContent: FC<PanelContentProps> = ({
+ ModelItemComponent,
+ enabledList: enabledListProp,
model: modelProp,
onModelChange: onModelChangeProp,
onOpenChange,
+ pricingMode,
provider: providerProp,
}) => {
- const enabledList = useEnabledChatModels();
+ const chatEnabledList = useEnabledChatModels();
+ const enabledList = enabledListProp ?? chatEnabledList;
const [searchKeyword, setSearchKeyword] = useState('');
const isDevMode = useUserStore((s) => userGeneralSettingsSelectors.config(s).isDevMode);
const { groupMode, handleGroupModeChange } = usePanelState();
@@ -42,8 +51,11 @@ export const PanelContent: FC<PanelContentProps> = ({
onSearchKeywordChange={setSearchKeyword}
/>
<List
+ ModelItemComponent={ModelItemComponent}
+ enabledList={enabledList}
groupMode={isDevMode ? groupMode : 'byModel'}
model={modelProp}
+ pricingMode={pricingMode}
provider={providerProp}
searchKeyword={searchKeyword}
onModelChange={onModelChangeProp}
diff --git a/src/features/ModelSwitchPanel/index.tsx b/src/features/ModelSwitchPanel/index.tsx
index 2b53f78c2e8..e4dd63b94e8 100644
--- a/src/features/ModelSwitchPanel/index.tsx
+++ b/src/features/ModelSwitchPanel/index.tsx
@@ -15,12 +15,15 @@ import { type ModelSwitchPanelProps } from './types';
const ModelSwitchPanel = memo<ModelSwitchPanelProps>(
({
+ ModelItemComponent,
children,
+ enabledList,
model: modelProp,
onModelChange,
onOpenChange,
open,
placement = 'topLeft',
+ pricingMode,
provider: providerProp,
openOnHover = true,
}) => {
@@ -45,7 +48,10 @@ const ModelSwitchPanel = memo<ModelSwitchPanelProps>(
<DropdownMenuPositioner hoverTrigger={openOnHover} placement={placement}>
<DropdownMenuPopup className={styles.container} onKeyDown={stopPropagation}>
<PanelContent
+ ModelItemComponent={ModelItemComponent}
+ enabledList={enabledList}
model={modelProp}
+ pricingMode={pricingMode}
provider={providerProp}
onModelChange={onModelChange}
onOpenChange={handleOpenChange}
diff --git a/src/features/ModelSwitchPanel/types.ts b/src/features/ModelSwitchPanel/types.ts
index 9dfd265317c..c14cf89a06f 100644
--- a/src/features/ModelSwitchPanel/types.ts
+++ b/src/features/ModelSwitchPanel/types.ts
@@ -1,8 +1,11 @@
import { type DropdownMenuPlacement } from '@lobehub/ui';
import { type AiModelForSelect } from 'model-bank';
+import { type ComponentType } from 'react';
import { type EnabledProviderWithModels } from '@/types/aiProvider';
+import { type PricingMode } from './components/ModelDetailPanel';
+
export type GroupMode = 'byModel' | 'byProvider';
export interface ModelWithProviders {
@@ -46,10 +49,18 @@ export type DropdownPlacement = DropdownMenuPlacement;
export interface ModelSwitchPanelProps {
children?: React.ReactNode;
+ /**
+ * When set (e.g. image/video generation), uses this list instead of enabled chat models.
+ */
+ enabledList?: EnabledProviderWithModels[];
/**
* Current model ID. If not provided, uses currentAgentModel from store.
*/
model?: string;
+ /**
+ * Optional row component for generation UIs (e.g. ImageModelItem). Requires `enabledList` + `pricingMode`.
+ */
+ ModelItemComponent?: ComponentType<any>;
/**
* Callback when model changes. If not provided, uses updateAgentConfig from store.
*/
@@ -64,6 +75,10 @@ export interface ModelSwitchPanelProps {
* Dropdown placement. Defaults to 'topLeft'.
*/
placement?: DropdownPlacement;
+ /**
+ * Pass-through to ModelDetailPanel for image/video approximate pricing.
+ */
+ pricingMode?: PricingMode;
/**
* Current provider ID. If not provided, uses currentAgentModelProvider from store.
*/
diff --git a/src/locales/default/components.ts b/src/locales/default/components.ts
index e0892ca5994..1a921a34185 100644
--- a/src/locales/default/components.ts
+++ b/src/locales/default/components.ts
@@ -76,6 +76,10 @@ export default {
'FileParsingStatus.chunks.status.processing': 'Chunking',
'FileParsingStatus.chunks.status.processingTip':
'The server is splitting text chunks; closing the page will not affect the chunking progress.',
+ 'GenerationModelItem.creditsPerImageApproximate': 'Approx. {{amount}} Credits / image',
+ 'GenerationModelItem.creditsPerImageExact': '{{amount}} Credits / image',
+ 'GenerationModelItem.creditsPerVideoApproximate': 'Approx. {{amount}} Credits / video',
+ 'GenerationModelItem.creditsPerVideoExact': '{{amount}} Credits / video',
'GoBack.back': 'Back',
'HtmlPreview.actions.download': 'Download',
'HtmlPreview.actions.preview': 'Preview',
@@ -134,6 +138,8 @@ export default {
'ModelSwitchPanel.detail.pricing.group.text': 'Text',
'ModelSwitchPanel.detail.pricing.input': 'Input ${{amount}}/M',
'ModelSwitchPanel.detail.pricing.output': 'Output ${{amount}}/M',
+ 'ModelSwitchPanel.detail.pricing.perImage': '~ ${{amount}} / image',
+ 'ModelSwitchPanel.detail.pricing.perVideo': '~ ${{amount}} / video',
'ModelSwitchPanel.detail.pricing.unit.audioInput': 'Audio Input',
'ModelSwitchPanel.detail.pricing.unit.audioInput_cacheRead': 'Audio Input (Cached)',
'ModelSwitchPanel.detail.pricing.unit.audioOutput': 'Audio Output',
diff --git a/src/locales/default/image.ts b/src/locales/default/image.ts
index 4bfe61af2ca..980a479ff07 100644
--- a/src/locales/default/image.ts
+++ b/src/locales/default/image.ts
@@ -11,6 +11,7 @@ export default {
'config.imageUrls.label': 'Reference Images',
'config.model.label': 'Model',
'config.prompt.placeholder': 'Describe what you want to generate',
+ 'config.prompt.placeholderWithRef': 'Describe how you want to adjust the image',
'config.quality.label': 'Image Quality',
'config.quality.options.hd': 'High Definition',
'config.quality.options.standard': 'Standard',
@@ -22,7 +23,7 @@ export default {
'config.seed.random': 'Random Seed',
'config.size.label': 'Size',
'config.steps.label': 'Steps',
- 'config.title': 'AI Image',
+ 'config.title': 'Configuration',
'config.width.label': 'Width',
'generation.actions.applySeed': 'Apply Seed',
'generation.actions.copyError': 'Copy Error Message',
@@ -58,7 +59,7 @@ export default {
'Supports multiple AI image generation providers, including OpenAI gpt-image-1, Google Imagen, FAL.ai, and more, offering a wide selection of models.',
'notSupportGuide.features.multiProviders.title': 'Multi-Provider Support',
'notSupportGuide.title': 'Current Deployment Mode Does Not Support AI Image Generation',
- 'topic.createNew': 'New Topic',
+ 'topic.createNew': 'Create New Topic',
'topic.deleteConfirm': 'Delete Generation Topic',
'topic.deleteConfirmDesc':
'You are about to delete this generation topic. This action cannot be undone, please proceed with caution.',
diff --git a/src/locales/default/video.ts b/src/locales/default/video.ts
index ea4cf1308b3..172c92fe41c 100644
--- a/src/locales/default/video.ts
+++ b/src/locales/default/video.ts
@@ -7,6 +7,7 @@ export default {
'config.header.title': 'Video',
'config.imageUrl.label': 'Start Frame',
'config.prompt.placeholder': 'Describe the video you want to generate',
+ 'config.prompt.placeholderWithRef': 'Describe the scene you want to generate with the image',
'config.referenceImage.label': 'Reference Image',
'config.resolution.label': 'Resolution',
'config.seed.label': 'Seed',
@@ -21,7 +22,7 @@ export default {
'End frame cannot be used without a start frame. Please set a start frame first.',
'generation.status.failed': 'Generation Failed',
'generation.status.generating': 'Generating...',
- 'topic.createNew': 'New Topic',
+ 'topic.createNew': 'Create New Topic',
'topic.deleteConfirm': 'Delete Video Topic',
'topic.deleteConfirmDesc':
'You are about to delete this video topic. This action cannot be undone.',
diff --git a/src/proxy.ts b/src/proxy.ts
index 31c52a0eb90..cff8665af5c 100644
--- a/src/proxy.ts
+++ b/src/proxy.ts
@@ -21,6 +21,7 @@ export const config = {
'/changelog(.*)',
'/settings(.*)',
'/image',
+ '/video',
'/resource',
'/resource(.*)',
'/profile(.*)',
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/ModelSelect/ImageModelItem.tsx b/src/routes/(main)/(create)/components/GenerationModelItem.tsx
similarity index 57%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/ModelSelect/ImageModelItem.tsx
rename to src/routes/(main)/(create)/components/GenerationModelItem.tsx
index 45e37ed0b93..8734c53f548 100644
--- a/src/routes/(main)/image/_layout/ConfigPanel/components/ModelSelect/ImageModelItem.tsx
+++ b/src/routes/(main)/(create)/components/GenerationModelItem.tsx
@@ -1,11 +1,14 @@
+'use client';
+
import { BRANDING_PROVIDER } from '@lobechat/business-const';
import { CREDITS_PER_DOLLAR } from '@lobechat/const/currency';
import { ModelIcon } from '@lobehub/icons';
import { Flexbox, Popover, Text } from '@lobehub/ui';
import { createStaticStyles, cx } from 'antd-style';
-import { type AiModelForSelect } from 'model-bank';
+import type { AiModelForSelect } from 'model-bank';
import numeral from 'numeral';
import { memo, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
import NewModelBadge from '@/components/ModelSelect/NewModelBadge';
import { useIsDark } from '@/hooks/useIsDark';
@@ -34,6 +37,8 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
priceText: css`
font-weight: 500;
color: ${cssVar.colorTextTertiary};
+ word-break: keep-all;
+ white-space: nowrap;
`,
priceText_dark: css`
font-weight: 500;
@@ -41,9 +46,14 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
`,
}));
-type ImageModelItemProps = AiModelForSelect & {
+export interface GenerationModelItemProps extends AiModelForSelect {
+ /**
+ * Which USD price fields to use: image uses approximatePricePerImage / pricePerImage; video uses approximatePricePerVideo / pricePerVideo.
+ * @default 'image'
+ */
+ priceKind?: 'image' | 'video';
/**
- * Provider ID for determining price display format
+ * Provider ID for determining price display format (when showPrice is true)
*/
providerId?: string;
/**
@@ -56,46 +66,79 @@ type ImageModelItemProps = AiModelForSelect & {
* @default true
*/
showPopover?: boolean;
-};
+ /**
+ * Whether to show price in popover (e.g. true for image, false for video)
+ * @default false
+ */
+ showPrice?: boolean;
+}
-const ImageModelItem = memo<ImageModelItemProps>(
+const GenerationModelItem = memo<GenerationModelItemProps>(
({
approximatePricePerImage,
+ approximatePricePerVideo,
description,
pricePerImage,
+ pricePerVideo,
providerId,
showPopover = true,
showBadge = true,
+ showPrice = false,
+ priceKind = 'image',
...model
}) => {
const isDarkMode = useIsDark();
+ const { t } = useTranslation('components');
const enableBusinessFeatures = useServerConfigStore(
serverConfigSelectors.enableBusinessFeatures,
);
const priceLabel = useMemo(() => {
- // Show credits only for branding provider with business features enabled
+ if (!showPrice) return undefined;
+
+ const isVideo = priceKind === 'video';
+ const exactUsd = isVideo ? pricePerVideo : pricePerImage;
+ const approxUsd = isVideo ? approximatePricePerVideo : approximatePricePerImage;
+
if (enableBusinessFeatures && providerId === BRANDING_PROVIDER) {
- if (typeof pricePerImage === 'number') {
- const credits = pricePerImage * CREDITS_PER_DOLLAR;
- return `${numeral(credits).format('0,0')} credits/张`;
+ if (typeof exactUsd === 'number') {
+ const credits = exactUsd * CREDITS_PER_DOLLAR;
+ return t(
+ isVideo
+ ? 'GenerationModelItem.creditsPerVideoExact'
+ : 'GenerationModelItem.creditsPerImageExact',
+ { amount: numeral(credits).format('0,0') },
+ );
}
- if (typeof approximatePricePerImage === 'number') {
- const credits = approximatePricePerImage * CREDITS_PER_DOLLAR;
- return `~ ${numeral(credits).format('0,0')} credits/张`;
+ if (typeof approxUsd === 'number') {
+ const credits = approxUsd * CREDITS_PER_DOLLAR;
+ return t(
+ isVideo
+ ? 'GenerationModelItem.creditsPerVideoApproximate'
+ : 'GenerationModelItem.creditsPerImageApproximate',
+ { amount: numeral(credits).format('0,0') },
+ );
}
} else {
- // Show USD price for open source version or non-branding providers
- if (typeof pricePerImage === 'number') {
- return `${numeral(pricePerImage).format('$0,0.00[000]')} / image`;
+ if (typeof exactUsd === 'number') {
+ return `${numeral(exactUsd).format('$0,0.00[000]')} / ${isVideo ? 'video' : 'image'}`;
}
- if (typeof approximatePricePerImage === 'number') {
- return `~ ${numeral(approximatePricePerImage).format('$0,0.00[000]')} / image`;
+ if (typeof approxUsd === 'number') {
+ return `~ ${numeral(approxUsd).format('$0,0.00[000]')} / ${isVideo ? 'video' : 'image'}`;
}
}
-
return undefined;
- }, [approximatePricePerImage, enableBusinessFeatures, pricePerImage, providerId]);
+ }, [
+ showPrice,
+ approximatePricePerImage,
+ approximatePricePerVideo,
+ enableBusinessFeatures,
+ pricePerImage,
+ pricePerVideo,
+ priceKind,
+ providerId,
+ t,
+ ]);
const popoverContent = useMemo(() => {
if (!description && !priceLabel) return null;
@@ -140,6 +183,6 @@ const ImageModelItem = memo<ImageModelItemProps>(
},
);
-ImageModelItem.displayName = 'ImageModelItem';
+GenerationModelItem.displayName = 'GenerationModelItem';
-export default ImageModelItem;
+export default GenerationModelItem;
diff --git a/src/routes/(main)/video/features/PromptInput/Title.tsx b/src/routes/(main)/(create)/components/PromptTitle.tsx
similarity index 60%
rename from src/routes/(main)/video/features/PromptInput/Title.tsx
rename to src/routes/(main)/(create)/components/PromptTitle.tsx
index 45a60831fb6..7b9a5b14203 100644
--- a/src/routes/(main)/video/features/PromptInput/Title.tsx
+++ b/src/routes/(main)/(create)/components/PromptTitle.tsx
@@ -2,11 +2,17 @@
import { Center, Icon, Text } from '@lobehub/ui';
import { cssVar } from 'antd-style';
-import { Video } from 'lucide-react';
+import type { LucideIcon } from 'lucide-react';
+import { memo } from 'react';
import { useTranslation } from 'react-i18next';
-const PromptTitle = () => {
- const { t } = useTranslation('video');
+interface PromptTitleProps {
+ icon: LucideIcon;
+ namespace: 'image' | 'video';
+}
+
+const PromptTitle = memo<PromptTitleProps>(({ icon, namespace }) => {
+ const { t } = useTranslation(namespace);
return (
<Center horizontal gap={16} style={{ width: '100%' }}>
@@ -19,7 +25,7 @@ const PromptTitle = () => {
borderRadius: 16,
}}
>
- <Icon color={cssVar.colorBgLayout} icon={Video} size={32} />
+ <Icon color={cssVar.colorBgLayout} icon={icon} size={32} />
</Center>
<Text
as={'h1'}
@@ -31,6 +37,8 @@ const PromptTitle = () => {
</Text>
</Center>
);
-};
+});
+
+PromptTitle.displayName = 'PromptTitle';
export default PromptTitle;
diff --git a/src/routes/(main)/(create)/features/CreateGenerationPage.tsx b/src/routes/(main)/(create)/features/CreateGenerationPage.tsx
new file mode 100644
index 00000000000..0df8ed83045
--- /dev/null
+++ b/src/routes/(main)/(create)/features/CreateGenerationPage.tsx
@@ -0,0 +1,91 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { AnimatePresence, m as motion } from 'motion/react';
+import type { ComponentType } from 'react';
+import { memo } from 'react';
+import { useMatch } from 'react-router-dom';
+
+import NavHeader from '@/features/NavHeader';
+import WideScreenContainer from '@/features/WideScreenContainer';
+import WideScreenButton from '@/features/WideScreenContainer/WideScreenButton';
+import { useQueryState } from '@/hooks/useQueryParam';
+
+interface CreateGenerationPageProps {
+ path: string;
+ PromptInput: ComponentType<{ disableAnimation?: boolean; showTitle?: boolean }>;
+ Workspace: ComponentType<{ embedInput?: boolean }>;
+}
+
+const CreateGenerationPage = memo<CreateGenerationPageProps>(({ path, Workspace, PromptInput }) => {
+ const isCurrent = useMatch({ path, end: true });
+ const [topic] = useQueryState('topic');
+ const isHome = !topic;
+
+ if (!isCurrent) return null;
+
+ return (
+ <>
+ <NavHeader right={<WideScreenButton />} />
+ <Flexbox
+ height={'100%'}
+ style={{ flexDirection: 'column', overflow: 'hidden', position: 'relative' }}
+ width={'100%'}
+ >
+ <Flexbox flex={1} style={{ minHeight: 0, overflowY: 'auto' }} width={'100%'}>
+ <WideScreenContainer wrapperStyle={{ minHeight: '100%' }}>
+ <AnimatePresence initial={false} mode="wait">
+ {isHome ? (
+ <motion.div
+ animate={{ opacity: 1, y: 0 }}
+ exit={{ opacity: 0, y: -8 }}
+ initial={{ opacity: 0, y: 8 }}
+ key="home-input"
+ transition={{ duration: 0.24, ease: 'easeOut' }}
+ >
+ <Flexbox
+ align={'center'}
+ justify={'center'}
+ style={{ minHeight: 'calc(100vh - 180px)' }}
+ width={'100%'}
+ >
+ <PromptInput disableAnimation showTitle />
+ </Flexbox>
+ </motion.div>
+ ) : (
+ <motion.div
+ animate={{ opacity: 1, y: 0 }}
+ exit={{ opacity: 0, y: 8 }}
+ initial={{ opacity: 0, y: 10 }}
+ key="topic-workspace"
+ transition={{ duration: 0.28, ease: 'easeOut' }}
+ >
+ <Workspace embedInput={false} />
+ </motion.div>
+ )}
+ </AnimatePresence>
+ </WideScreenContainer>
+ </Flexbox>
+ <AnimatePresence initial={false}>
+ {!isHome && (
+ <motion.div
+ animate={{ opacity: 1, y: 0 }}
+ exit={{ opacity: 0, y: 8 }}
+ initial={{ opacity: 0, y: 8 }}
+ key="bottom-input"
+ transition={{ delay: 0.04, duration: 0.2, ease: 'easeOut' }}
+ >
+ <WideScreenContainer style={{ marginTop: -8, paddingBlockEnd: 12 }}>
+ <PromptInput disableAnimation showTitle={false} />
+ </WideScreenContainer>
+ </motion.div>
+ )}
+ </AnimatePresence>
+ </Flexbox>
+ </>
+ );
+});
+
+CreateGenerationPage.displayName = 'CreateGenerationPage';
+
+export default CreateGenerationPage;
diff --git a/src/routes/(main)/video/features/GenerationFeed/index.tsx b/src/routes/(main)/(create)/features/GenerationFeed/index.tsx
similarity index 73%
rename from src/routes/(main)/video/features/GenerationFeed/index.tsx
rename to src/routes/(main)/(create)/features/GenerationFeed/index.tsx
index 534e4fd62f7..b57d9ec409f 100644
--- a/src/routes/(main)/video/features/GenerationFeed/index.tsx
+++ b/src/routes/(main)/(create)/features/GenerationFeed/index.tsx
@@ -3,21 +3,22 @@
import { useAutoAnimate } from '@formkit/auto-animate/react';
import { Flexbox } from '@lobehub/ui';
import { Divider } from 'antd';
+import { type ReactNode } from 'react';
import { Fragment, memo, useEffect, useRef } from 'react';
-import { useVideoStore } from '@/store/video';
-import { generationBatchSelectors } from '@/store/video/selectors';
+import type { GenerationBatch } from '@/types/generation';
-import { VideoGenerationBatchItem } from './BatchItem';
+interface GenerationFeedProps {
+ batches: GenerationBatch[];
+ renderBatchItem: (batch: GenerationBatch) => ReactNode;
+}
-const GenerationFeed = memo(() => {
+const GenerationFeed = memo<GenerationFeedProps>(({ batches, renderBatchItem }) => {
const [parent, enableAnimations] = useAutoAnimate();
const containerRef = useRef<HTMLDivElement>(null);
const isInitialLoadRef = useRef(true);
const prevBatchesCountRef = useRef(0);
- const currentGenerationBatches = useVideoStore(generationBatchSelectors.currentGenerationBatches);
-
const scrollToBottom = (behavior: 'smooth' | 'auto' = 'smooth') => {
if (!containerRef.current) return;
@@ -36,8 +37,7 @@ const GenerationFeed = memo(() => {
};
useEffect(() => {
- const currentBatches = currentGenerationBatches || [];
- const currentBatchesCount = currentBatches.length;
+ const currentBatchesCount = batches.length;
const prevBatchesCount = prevBatchesCountRef.current;
if (currentBatchesCount === 0) {
@@ -59,19 +59,19 @@ const GenerationFeed = memo(() => {
}
prevBatchesCountRef.current = currentBatchesCount;
- }, [currentGenerationBatches, enableAnimations]);
+ }, [batches, enableAnimations]);
- if (!currentGenerationBatches || currentGenerationBatches.length === 0) {
+ if (!batches || batches.length === 0) {
return null;
}
return (
- <Flexbox flex={1} style={{ overflowY: 'auto' }}>
+ <Flexbox flex={1}>
<Flexbox gap={16} ref={parent} style={{ paddingBottom: 48 }} width="100%">
- {currentGenerationBatches.map((batch, index) => (
+ {batches.map((batch, index) => (
<Fragment key={batch.id}>
{Boolean(index !== 0) && <Divider dashed style={{ margin: 0 }} />}
- <VideoGenerationBatchItem batch={batch} key={batch.id} />
+ {renderBatchItem(batch)}
</Fragment>
))}
</Flexbox>
diff --git a/src/routes/(main)/(create)/features/GenerationInput/ConfigAction.tsx b/src/routes/(main)/(create)/features/GenerationInput/ConfigAction.tsx
new file mode 100644
index 00000000000..99a2c206e0e
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationInput/ConfigAction.tsx
@@ -0,0 +1,27 @@
+'use client';
+
+import { SlidersHorizontal } from 'lucide-react';
+import type { ReactNode } from 'react';
+import { memo } from 'react';
+
+import Action from '@/features/ChatInput/ActionBar/components/Action';
+
+interface ConfigActionProps {
+ content: ReactNode;
+ title: ReactNode;
+}
+
+const ConfigAction = memo<ConfigActionProps>(({ title, content }) => {
+ return (
+ <Action
+ icon={SlidersHorizontal}
+ popover={{ content, minWidth: 300, title }}
+ title={typeof title === 'string' ? title : undefined}
+ trigger={'click'}
+ />
+ );
+});
+
+ConfigAction.displayName = 'ConfigAction';
+
+export default ConfigAction;
diff --git a/src/routes/(main)/(create)/features/GenerationInput/GenerationInvalidAPIKey.tsx b/src/routes/(main)/(create)/features/GenerationInput/GenerationInvalidAPIKey.tsx
new file mode 100644
index 00000000000..03745e59857
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationInput/GenerationInvalidAPIKey.tsx
@@ -0,0 +1,54 @@
+'use client';
+
+import { ProviderIcon } from '@lobehub/icons';
+import { Button } from '@lobehub/ui';
+import { ModelProvider } from 'model-bank';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useNavigate } from 'react-router-dom';
+import urlJoin from 'url-join';
+
+import BaseErrorForm from '@/features/Conversation/Error/BaseErrorForm';
+import { useProviderName } from '@/hooks/useProviderName';
+import { type GlobalLLMProviderKey } from '@/types/user/settings/modelProvider';
+
+interface GenerationInvalidAPIKeyProps {
+ onNavigate?: () => void;
+ provider?: string;
+}
+
+const GenerationInvalidAPIKey = memo<GenerationInvalidAPIKeyProps>(({ provider, onNavigate }) => {
+ const { t } = useTranslation(['modelProvider', 'error']);
+ const navigate = useNavigate();
+ const providerName = useProviderName(provider as GlobalLLMProviderKey);
+
+ return (
+ <BaseErrorForm
+ avatar={<ProviderIcon provider={provider} shape={'square'} size={40} />}
+ title={t(`unlock.apiKey.title`, { name: providerName, ns: 'error' })}
+ action={
+ <Button
+ type={'primary'}
+ onClick={() => {
+ navigate(urlJoin('/settings/provider', provider || 'all'));
+ onNavigate?.();
+ }}
+ >
+ {t('unlock.goToSettings', { ns: 'error' })}
+ </Button>
+ }
+ desc={
+ provider === ModelProvider.Bedrock
+ ? t('bedrock.unlock.description')
+ : t(`unlock.apiKey.description`, {
+ name: providerName,
+ ns: 'error',
+ })
+ }
+ />
+ );
+});
+
+GenerationInvalidAPIKey.displayName = 'GenerationInvalidAPIKey';
+
+export default GenerationInvalidAPIKey;
diff --git a/src/routes/(main)/(create)/features/GenerationInput/GenerationPromptInput.tsx b/src/routes/(main)/(create)/features/GenerationInput/GenerationPromptInput.tsx
new file mode 100644
index 00000000000..7015597a039
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationInput/GenerationPromptInput.tsx
@@ -0,0 +1,112 @@
+'use client';
+
+import { ChatInput, ChatInputActionBar, SendButton } from '@lobehub/editor/react';
+import { Flexbox, TextArea } from '@lobehub/ui';
+import { createStaticStyles } from 'antd-style';
+import type { KeyboardEvent, ReactNode } from 'react';
+import { memo } from 'react';
+
+interface GenerationPromptInputProps {
+ className?: string;
+ disableGenerate?: boolean;
+ generateLabel: string;
+ generatingLabel: string;
+ header?: ReactNode;
+ inlineContent?: ReactNode;
+ isCreating?: boolean;
+ isDarkMode?: boolean;
+ leftActions?: ReactNode;
+ maxRows?: number;
+ minRows?: number;
+ onGenerate: () => Promise<void> | void;
+ onValueChange: (value: string) => void;
+ placeholder: string;
+ rightActions?: ReactNode;
+ value?: string;
+}
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ textarea: css`
+ padding: 0;
+ border-radius: 0;
+ `,
+}));
+
+const GenerationPromptInput = memo<GenerationPromptInputProps>(
+ ({
+ className,
+ header,
+ inlineContent,
+ leftActions,
+ rightActions,
+ isDarkMode,
+ isCreating,
+ value,
+ onValueChange,
+ onGenerate,
+ placeholder,
+ generateLabel,
+ generatingLabel,
+ disableGenerate,
+ minRows = 3,
+ maxRows = 6,
+ }) => {
+ const handleKeyDown = async (e: KeyboardEvent<HTMLTextAreaElement>) => {
+ if (e.key !== 'Enter' || e.shiftKey || e.nativeEvent.isComposing) return;
+
+ e.preventDefault();
+ if (disableGenerate || isCreating || !value?.trim()) return;
+
+ await onGenerate();
+ };
+
+ const textarea = (
+ <TextArea
+ autoSize={{ maxRows, minRows }}
+ className={styles.textarea}
+ placeholder={placeholder}
+ value={value}
+ variant={'borderless'}
+ onChange={(e) => onValueChange(e.target.value)}
+ onKeyDown={handleKeyDown}
+ />
+ );
+
+ return (
+ <ChatInput
+ className={className}
+ header={header}
+ styles={{ body: { padding: 8 } }}
+ footer={
+ <ChatInputActionBar
+ left={leftActions}
+ right={
+ <Flexbox horizontal align={'center'} gap={8}>
+ {rightActions}
+ <SendButton
+ disabled={disableGenerate || !value}
+ loading={isCreating}
+ title={isCreating ? generatingLabel : generateLabel}
+ onClick={onGenerate}
+ />
+ </Flexbox>
+ }
+ />
+ }
+ >
+ {inlineContent ? (
+ <Flexbox horizontal align={'start'} gap={8}>
+ {inlineContent}
+ <Flexbox flex={1}>{textarea}</Flexbox>
+ </Flexbox>
+ ) : (
+ textarea
+ )}
+ </ChatInput>
+ );
+ },
+);
+
+GenerationPromptInput.displayName = 'GenerationPromptInput';
+
+export default GenerationPromptInput;
diff --git a/src/routes/(main)/(create)/features/GenerationInput/ImagePreviewHeader.tsx b/src/routes/(main)/(create)/features/GenerationInput/ImagePreviewHeader.tsx
new file mode 100644
index 00000000000..fa1f7cacafd
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationInput/ImagePreviewHeader.tsx
@@ -0,0 +1,29 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { createStaticStyles } from 'antd-style';
+import type { PropsWithChildren } from 'react';
+import { memo } from 'react';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ container: css`
+ margin-block-end: 8px;
+ padding-block: 8px;
+ padding-inline: 8px;
+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};
+ `,
+}));
+
+const ImagePreviewHeader = memo<PropsWithChildren>(({ children }) => {
+ if (!children) return null;
+
+ return (
+ <Flexbox className={styles.container} gap={8}>
+ {children}
+ </Flexbox>
+ );
+});
+
+ImagePreviewHeader.displayName = 'ImagePreviewHeader';
+
+export default ImagePreviewHeader;
diff --git a/src/routes/(main)/(create)/features/GenerationInput/InlineImageReference.tsx b/src/routes/(main)/(create)/features/GenerationInput/InlineImageReference.tsx
new file mode 100644
index 00000000000..bbde136a667
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationInput/InlineImageReference.tsx
@@ -0,0 +1,99 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { createStaticStyles } from 'antd-style';
+import { memo, useState } from 'react';
+
+import UploadCard, { UPLOAD_CARD_SIZE, type UploadData } from './UploadCard';
+
+const STACK_OFFSET = -(UPLOAD_CARD_SIZE - 8);
+const EXPAND_OFFSET = 4;
+
+const styles = createStaticStyles(({ css }) => ({
+ addCirclePos: css`
+ position: absolute;
+ z-index: 100;
+ inset-block-end: -2px;
+ inset-inline-end: -2px;
+ `,
+ stack: css`
+ position: relative;
+ padding-block: 4px;
+ padding-inline: 0;
+
+ &:hover {
+ .inline-ref-close {
+ opacity: 1;
+ }
+ }
+ `,
+}));
+
+interface InlineImageReferenceProps {
+ imageConstraints?: any;
+ images: string[];
+ maxCount?: number;
+ maxFileSize?: number;
+ onAdd: (data: UploadData) => void;
+ onRemove: (url: string) => void;
+}
+
+const InlineImageReference = memo<InlineImageReferenceProps>(
+ ({ images, onAdd, onRemove, maxFileSize, maxCount = 5 }) => {
+ const [isHovered, setIsHovered] = useState(false);
+
+ const canAddMore = images.length < maxCount;
+ const hasImages = images.length > 0;
+ const shouldCollapse = hasImages && !isHovered;
+
+ return (
+ <Flexbox
+ horizontal
+ align={'end'}
+ className={styles.stack}
+ onMouseEnter={() => setIsHovered(true)}
+ onMouseLeave={() => setIsHovered(false)}
+ >
+ {images.map((url, index) => (
+ <UploadCard
+ closeClassName="inline-ref-close"
+ imageUrl={url}
+ key={url}
+ maxFileSize={maxFileSize}
+ style={{
+ marginInlineStart: index > 0 ? (shouldCollapse ? STACK_OFFSET : EXPAND_OFFSET) : 0,
+ zIndex: index + 1,
+ }}
+ onRemove={() => onRemove(url)}
+ onUpload={onAdd}
+ />
+ ))}
+
+ {canAddMore &&
+ (shouldCollapse ? (
+ <UploadCard
+ className={styles.addCirclePos}
+ maxFileSize={maxFileSize}
+ variant="circle"
+ onRemove={() => {}}
+ onUpload={onAdd}
+ />
+ ) : (
+ <UploadCard
+ maxFileSize={maxFileSize}
+ style={{
+ marginInlineStart: hasImages ? EXPAND_OFFSET : 0,
+ zIndex: images.length + 1,
+ }}
+ onRemove={() => {}}
+ onUpload={onAdd}
+ />
+ ))}
+ </Flexbox>
+ );
+ },
+);
+
+InlineImageReference.displayName = 'InlineImageReference';
+
+export default InlineImageReference;
diff --git a/src/routes/(main)/(create)/features/GenerationInput/InlineVideoFrames.tsx b/src/routes/(main)/(create)/features/GenerationInput/InlineVideoFrames.tsx
new file mode 100644
index 00000000000..de4dda508aa
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationInput/InlineVideoFrames.tsx
@@ -0,0 +1,74 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { createStaticStyles, cssVar } from 'antd-style';
+import { ArrowLeftRight } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import UploadCard, { UPLOAD_CARD_SIZE, type UploadData } from './UploadCard';
+
+const styles = createStaticStyles(({ css }) => ({
+ stack: css`
+ position: relative;
+ padding-block: 4px;
+ padding-inline: 0;
+ `,
+ swapIcon: css`
+ flex-shrink: 0;
+ color: ${cssVar.colorTextQuaternary};
+ `,
+}));
+
+interface InlineVideoFramesProps {
+ endImageUrl?: string | null;
+ imageUrl?: string | null;
+ isSupportEndImage?: boolean;
+ maxFileSize?: number;
+ onEndImageChange: (data: UploadData | null) => void;
+ onImageChange: (data: UploadData | null) => void;
+}
+
+const InlineVideoFrames = memo<InlineVideoFramesProps>(
+ ({ imageUrl, endImageUrl, onImageChange, onEndImageChange, isSupportEndImage = true }) => {
+ const { t } = useTranslation('video');
+
+ const hasStartFrame = Boolean(imageUrl);
+ const showEndFrame = isSupportEndImage && hasStartFrame;
+
+ return (
+ <Flexbox horizontal align={'end'} className={styles.stack} gap={6}>
+ <UploadCard
+ imageUrl={imageUrl}
+ label={hasStartFrame ? t('config.imageUrl.label') : t('config.referenceImage.label')}
+ onRemove={() => onImageChange(null)}
+ onUpload={(data) => onImageChange(data)}
+ />
+
+ {showEndFrame && (
+ <>
+ <Flexbox
+ align={'center'}
+ className={styles.swapIcon}
+ justify={'center'}
+ style={{ height: UPLOAD_CARD_SIZE }}
+ >
+ <ArrowLeftRight size={14} />
+ </Flexbox>
+
+ <UploadCard
+ imageUrl={endImageUrl}
+ label={t('config.endImageUrl.label')}
+ onRemove={() => onEndImageChange(null)}
+ onUpload={(data) => onEndImageChange(data)}
+ />
+ </>
+ )}
+ </Flexbox>
+ );
+ },
+);
+
+InlineVideoFrames.displayName = 'InlineVideoFrames';
+
+export default InlineVideoFrames;
diff --git a/src/routes/(main)/(create)/features/GenerationInput/ModelAction.tsx b/src/routes/(main)/(create)/features/GenerationInput/ModelAction.tsx
new file mode 100644
index 00000000000..c7a2ce24c54
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationInput/ModelAction.tsx
@@ -0,0 +1,27 @@
+'use client';
+
+import { Bot } from 'lucide-react';
+import type { ReactNode } from 'react';
+import { memo } from 'react';
+
+import Action from '@/features/ChatInput/ActionBar/components/Action';
+
+interface ModelActionProps {
+ content: ReactNode;
+ title: ReactNode;
+}
+
+const ModelAction = memo<ModelActionProps>(({ title, content }) => {
+ return (
+ <Action
+ icon={Bot}
+ popover={{ content, minWidth: 300, title }}
+ title={typeof title === 'string' ? title : undefined}
+ trigger={'click'}
+ />
+ );
+});
+
+ModelAction.displayName = 'ModelAction';
+
+export default ModelAction;
diff --git a/src/routes/(main)/(create)/features/GenerationInput/UploadCard.tsx b/src/routes/(main)/(create)/features/GenerationInput/UploadCard.tsx
new file mode 100644
index 00000000000..b281a0d4e80
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationInput/UploadCard.tsx
@@ -0,0 +1,283 @@
+'use client';
+
+import { ActionIcon, Block } from '@lobehub/ui';
+import { Spin } from 'antd';
+import { createStaticStyles, cssVar, cx } from 'antd-style';
+import { Plus, X } from 'lucide-react';
+import type { ChangeEvent, CSSProperties } from 'react';
+import { memo, useCallback, useRef, useState } from 'react';
+
+import Image from '@/libs/next/Image';
+import { useFileStore } from '@/store/file';
+
+export const UPLOAD_CARD_SIZE = 64;
+const ADD_CIRCLE_SIZE = 28;
+
+export type UploadData = string | { dimensions?: { height: number; width: number }; url: string };
+
+export const uploadCardStyles = createStaticStyles(({ css }) => ({
+ addCircle: css`
+ cursor: pointer;
+
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ width: ${ADD_CIRCLE_SIZE}px;
+ height: ${ADD_CIRCLE_SIZE}px;
+ border-radius: 50%;
+
+ color: ${cssVar.colorTextSecondary};
+
+ background: ${cssVar.colorBgElevated};
+ box-shadow:
+ 0 2px 8px rgb(0 0 0 / 15%),
+ 0 0 0 1px ${cssVar.colorBorderSecondary};
+
+ transition: all ${cssVar.motionDurationMid} ease;
+
+ &:hover {
+ color: ${cssVar.colorPrimary};
+ background: ${cssVar.colorPrimaryBg};
+ box-shadow:
+ 0 2px 8px rgb(0 0 0 / 15%),
+ 0 0 0 1px ${cssVar.colorPrimary};
+ }
+ `,
+ closeButton: css`
+ position: absolute;
+ z-index: 10;
+ inset-block-start: -6px;
+ inset-inline-end: -6px;
+
+ border-radius: 50% !important;
+ `,
+ filledCard: css`
+ cursor: pointer;
+
+ position: relative;
+
+ flex-shrink: 0;
+
+ width: ${UPLOAD_CARD_SIZE}px;
+ height: ${UPLOAD_CARD_SIZE}px;
+ padding: 2px;
+ border-radius: 6px;
+
+ transition: all ${cssVar.motionDurationMid} ease;
+
+ .upload-card-close {
+ opacity: 0 !important;
+ }
+
+ &:hover {
+ z-index: 99 !important;
+
+ .upload-card-close {
+ opacity: 1 !important;
+ }
+ }
+ `,
+ filledCardInner: css`
+ position: relative;
+
+ overflow: hidden;
+
+ width: 100%;
+ height: 100%;
+ border-radius: 3px;
+ `,
+ label: css`
+ font-size: 10px;
+ line-height: 1;
+ color: ${cssVar.colorTextQuaternary};
+ `,
+ placeholderCard: css`
+ cursor: pointer;
+
+ flex-shrink: 0;
+
+ width: ${UPLOAD_CARD_SIZE}px;
+ height: ${UPLOAD_CARD_SIZE}px;
+ border-radius: 6px;
+
+ color: ${cssVar.colorTextQuaternary};
+ `,
+ uploadOverlay: css`
+ position: absolute;
+ z-index: 5;
+ inset: 0;
+
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ border-radius: 3px;
+
+ background: ${cssVar.colorBgMask};
+ `,
+}));
+
+interface UploadCardProps {
+ className?: string;
+ closeClassName?: string;
+ imageUrl?: string | null;
+ label?: string;
+ maxFileSize?: number;
+ onRemove: () => void;
+ onUpload: (data: UploadData) => void;
+ style?: CSSProperties;
+ variant?: 'card' | 'circle';
+}
+
+const UploadCard = memo<UploadCardProps>(
+ ({
+ imageUrl,
+ label,
+ onUpload,
+ onRemove,
+ maxFileSize,
+ className,
+ closeClassName,
+ style,
+ variant = 'card',
+ }) => {
+ const inputRef = useRef<HTMLInputElement>(null);
+ const uploadWithProgress = useFileStore((s) => s.uploadWithProgress);
+ const [isUploading, setIsUploading] = useState(false);
+ const [uploadPreview, setUploadPreview] = useState<string | null>(null);
+
+ const handleFileSelect = useCallback(() => {
+ inputRef.current?.click();
+ }, []);
+
+ const handleFileChange = useCallback(
+ async (e: ChangeEvent<HTMLInputElement>) => {
+ const file = e.target.files?.[0];
+ if (!file) return;
+
+ if (maxFileSize && file.size > maxFileSize) return;
+
+ const previewUrl = URL.createObjectURL(file);
+ setUploadPreview(previewUrl);
+ setIsUploading(true);
+
+ try {
+ const result = await uploadWithProgress({
+ file,
+ onStatusUpdate: () => {},
+ skipCheckFileType: true,
+ });
+
+ if (result?.url) {
+ const data = result.dimensions
+ ? { dimensions: result.dimensions, url: result.url }
+ : result.url;
+ onUpload(data);
+ }
+ } finally {
+ URL.revokeObjectURL(previewUrl);
+ setUploadPreview(null);
+ setIsUploading(false);
+ }
+ },
+ [maxFileSize, uploadWithProgress, onUpload],
+ );
+
+ const showPreview = uploadPreview || imageUrl;
+
+ const fileInput = (
+ <input
+ accept="image/*"
+ ref={inputRef}
+ style={{ display: 'none' }}
+ type="file"
+ onChange={handleFileChange}
+ onClick={(e) => {
+ e.currentTarget.value = '';
+ }}
+ />
+ );
+
+ if (variant === 'circle' && !showPreview) {
+ return (
+ <>
+ {fileInput}
+ <div
+ className={`${uploadCardStyles.addCircle} ${className || ''}`}
+ style={style}
+ onClick={handleFileSelect}
+ >
+ <Plus size={14} />
+ </div>
+ </>
+ );
+ }
+
+ if (showPreview) {
+ return (
+ <>
+ {fileInput}
+ <Block
+ clickable
+ className={cx(uploadCardStyles.filledCard, className)}
+ style={style}
+ variant={'outlined'}
+ onClick={handleFileSelect}
+ >
+ <div className={uploadCardStyles.filledCardInner}>
+ <Image
+ fill
+ unoptimized
+ alt=""
+ src={uploadPreview || imageUrl!}
+ style={{ objectFit: 'cover' }}
+ />
+ {isUploading && (
+ <div className={uploadCardStyles.uploadOverlay}>
+ <Spin percent={'auto'} size="small" />
+ </div>
+ )}
+ </div>
+ {!isUploading && (
+ <ActionIcon
+ glass
+ className={cx(uploadCardStyles.closeButton, closeClassName, 'upload-card-close')}
+ icon={X}
+ size={12}
+ variant="outlined"
+ onClick={(e) => {
+ e.stopPropagation();
+ onRemove();
+ }}
+ />
+ )}
+ </Block>
+ </>
+ );
+ }
+
+ return (
+ <>
+ {fileInput}
+ <Block
+ clickable
+ align={'center'}
+ className={cx(uploadCardStyles.placeholderCard, className)}
+ gap={4}
+ justify={'center'}
+ style={style}
+ variant={'filled'}
+ onClick={handleFileSelect}
+ >
+ <Plus size={20} />
+ {label && <span className={uploadCardStyles.label}>{label}</span>}
+ </Block>
+ </>
+ );
+ },
+);
+
+UploadCard.displayName = 'UploadCard';
+
+export default UploadCard;
diff --git a/src/routes/(main)/(create)/features/GenerationInput/index.ts b/src/routes/(main)/(create)/features/GenerationInput/index.ts
new file mode 100644
index 00000000000..c14d5123f51
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationInput/index.ts
@@ -0,0 +1,7 @@
+export { default as ConfigAction } from './ConfigAction';
+export { default as GenerationInvalidAPIKey } from './GenerationInvalidAPIKey';
+export { default as GenerationPromptInput } from './GenerationPromptInput';
+export { default as ImagePreviewHeader } from './ImagePreviewHeader';
+export { default as InlineImageReference } from './InlineImageReference';
+export { default as InlineVideoFrames } from './InlineVideoFrames';
+export { default as ModelAction } from './ModelAction';
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/Body/List/Item/GridItem.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/Item/GridItem.tsx
new file mode 100644
index 00000000000..497d13a13f7
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/Item/GridItem.tsx
@@ -0,0 +1,73 @@
+'use client';
+
+import { Avatar, ContextMenuTrigger, type GenericItemType, Tooltip } from '@lobehub/ui';
+import { createStaticStyles, cx } from 'antd-style';
+import type { CSSProperties, MouseEvent } from 'react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { type ImageGenerationTopic } from '@/types/generation';
+
+import { useGenerationTopicContext } from '../StoreContext';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ gridItem: css`
+ cursor: pointer;
+
+ position: relative;
+
+ aspect-ratio: 1;
+ width: 100% !important;
+ height: auto !important;
+ border-radius: 4px;
+
+ object-fit: cover;
+ background: ${cssVar.colorFillSecondary};
+
+ transition: border 0.15s ${cssVar.motionEaseInOut};
+
+ img {
+ aspect-ratio: 1;
+ width: 100% !important;
+ }
+ `,
+ gridItemActive: css`
+ border: 2px solid ${cssVar.colorBgLayout} !important;
+ box-shadow: 0 0 0 2px ${cssVar.colorPrimary};
+ `,
+}));
+
+interface TopicItemProps {
+ contextMenuItems?: GenericItemType[] | (() => GenericItemType[]);
+ isActive?: boolean;
+ isLoading?: boolean;
+ isUpdating?: boolean;
+ onClick: () => void;
+ onDelete: (e: MouseEvent) => void;
+ style?: CSSProperties;
+ topic: ImageGenerationTopic;
+}
+
+const GridItem = memo<TopicItemProps>(
+ ({ isUpdating, topic, style, isLoading, onClick, onDelete, isActive, contextMenuItems }) => {
+ const { namespace } = useGenerationTopicContext();
+ const { t } = useTranslation(namespace);
+
+ return (
+ <Tooltip title={topic.title || t('topic.untitled')}>
+ <ContextMenuTrigger items={contextMenuItems}>
+ <Avatar
+ alt={topic.title || t('topic.untitled')}
+ avatar={topic.coverUrl ?? (topic.title || t('topic.untitled'))}
+ className={cx(styles.gridItem, isActive && styles.gridItemActive)}
+ loading={isLoading || isUpdating}
+ style={style}
+ onClick={onClick}
+ />
+ </ContextMenuTrigger>
+ </Tooltip>
+ );
+ },
+);
+
+export default GridItem;
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/Body/List/Item/ListItem.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/Item/ListItem.tsx
new file mode 100644
index 00000000000..684ca2a5a1f
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/Item/ListItem.tsx
@@ -0,0 +1,59 @@
+'use client';
+
+import { ActionIcon, Avatar, type GenericItemType } from '@lobehub/ui';
+import { cssVar } from 'antd-style';
+import { Trash } from 'lucide-react';
+import type { CSSProperties, MouseEvent } from 'react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import NavItem from '@/features/NavPanel/components/NavItem';
+import { type ImageGenerationTopic } from '@/types/generation';
+
+import { useGenerationTopicContext } from '../StoreContext';
+
+interface TopicItemProps {
+ contextMenuItems?: GenericItemType[] | (() => GenericItemType[]);
+ isActive?: boolean;
+ isLoading?: boolean;
+ isUpdating?: boolean;
+ onClick?: () => void;
+ onDelete?: (e: MouseEvent) => void;
+ style?: CSSProperties;
+ topic: ImageGenerationTopic;
+}
+
+const ListItem = memo<TopicItemProps>(
+ ({ topic, style, isLoading, onClick, onDelete, isActive, isUpdating, contextMenuItems }) => {
+ const { namespace } = useGenerationTopicContext();
+ const { t } = useTranslation(namespace);
+
+ return (
+ <NavItem
+ actions={<ActionIcon icon={Trash} size="small" onClick={onDelete} />}
+ active={isActive}
+ contextMenuItems={contextMenuItems}
+ disabled={isUpdating}
+ key={topic.id}
+ loading={isLoading || isUpdating}
+ style={style}
+ title={topic.title || t('topic.untitled')}
+ icon={
+ <Avatar
+ avatar={topic.coverUrl ?? ''}
+ background={cssVar.colorFillSecondary}
+ loading={isLoading}
+ shape="square"
+ size={32}
+ style={{
+ flex: 'none',
+ }}
+ />
+ }
+ onClick={onClick}
+ />
+ );
+ },
+);
+
+export default ListItem;
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/Body/List/Item/index.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/Item/index.tsx
new file mode 100644
index 00000000000..a91bdd7f0f0
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/Item/index.tsx
@@ -0,0 +1,104 @@
+'use client';
+
+import { Icon } from '@lobehub/ui';
+import { type MenuProps } from '@lobehub/ui';
+import { App } from 'antd';
+import { Trash } from 'lucide-react';
+import type { CSSProperties } from 'react';
+import { memo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { type ImageGenerationTopic } from '@/types/generation';
+
+import { useGenerationTopicContext } from '../StoreContext';
+import GridItem from './GridItem';
+import ListItem from './ListItem';
+
+interface TopicItemProps {
+ showMoreInfo?: boolean;
+ style?: CSSProperties;
+ topic: ImageGenerationTopic;
+}
+
+const TopicItem = memo<TopicItemProps>(({ topic, showMoreInfo, style }) => {
+ const { useStore, namespace } = useGenerationTopicContext();
+ const { t } = useTranslation(namespace);
+ const { modal } = App.useApp();
+ const [isUpdating, setIsUpdating] = useState(false);
+ const isLoading = useStore((s) => s.loadingGenerationTopicIds.includes(topic.id));
+ const removeGenerationTopic = useStore((s) => s.removeGenerationTopic);
+ const switchGenerationTopic = useStore((s) => s.switchGenerationTopic);
+ const activeTopicId = useStore((s) => s.activeGenerationTopicId);
+
+ const isActive = activeTopicId === topic.id;
+
+ const handleClick = () => {
+ switchGenerationTopic(topic.id);
+ };
+
+ const handleDelete = (e: React.MouseEvent) => {
+ e.stopPropagation();
+ e.preventDefault();
+
+ modal.confirm({
+ cancelText: t('cancel', { ns: 'common' }),
+ content: t('topic.deleteConfirmDesc'),
+ okButtonProps: { danger: true },
+ okText: t('delete', { ns: 'common' }),
+ onOk: async () => {
+ setIsUpdating(true);
+ try {
+ await removeGenerationTopic(topic.id);
+ } catch (error) {
+ console.error('Delete topic failed:', error);
+ }
+ setIsUpdating(false);
+ },
+ title: t('topic.deleteConfirm'),
+ });
+ };
+
+ const menuItems: MenuProps['items'] = [
+ {
+ danger: true,
+ icon: <Icon icon={Trash} />,
+ key: 'delete',
+ label: t('delete', { ns: 'common' }),
+ onClick: () => {
+ modal.confirm({
+ cancelText: t('cancel', { ns: 'common' }),
+ content: t('topic.deleteConfirmDesc'),
+ okButtonProps: { danger: true },
+ okText: t('delete', { ns: 'common' }),
+ onOk: async () => {
+ try {
+ await removeGenerationTopic(topic.id);
+ } catch (error) {
+ console.error('Delete topic failed:', error);
+ }
+ },
+ title: t('topic.deleteConfirm'),
+ });
+ },
+ },
+ ];
+
+ const RenderItem = showMoreInfo ? ListItem : GridItem;
+
+ return (
+ <RenderItem
+ contextMenuItems={menuItems}
+ isActive={isActive}
+ isLoading={isLoading}
+ isUpdating={isUpdating}
+ style={style}
+ topic={topic}
+ onClick={handleClick}
+ onDelete={handleDelete}
+ />
+ );
+});
+
+TopicItem.displayName = 'TopicItem';
+
+export default TopicItem;
diff --git a/src/features/GenerationTopicList/NewTopicButton.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/NewTopicButton.tsx
similarity index 100%
rename from src/features/GenerationTopicList/NewTopicButton.tsx
rename to src/routes/(main)/(create)/features/GenerationLayout/Body/List/NewTopicButton.tsx
diff --git a/src/features/GenerationTopicList/SkeletonList.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/SkeletonList.tsx
similarity index 100%
rename from src/features/GenerationTopicList/SkeletonList.tsx
rename to src/routes/(main)/(create)/features/GenerationLayout/Body/List/SkeletonList.tsx
diff --git a/src/features/GenerationTopicList/StoreContext.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/StoreContext.tsx
similarity index 100%
rename from src/features/GenerationTopicList/StoreContext.tsx
rename to src/routes/(main)/(create)/features/GenerationLayout/Body/List/StoreContext.tsx
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/Body/List/TopicList.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/TopicList.tsx
new file mode 100644
index 00000000000..0ff882e024e
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/TopicList.tsx
@@ -0,0 +1,56 @@
+'use client';
+
+import { Grid, TooltipGroup } from '@lobehub/ui';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import EmptyNavItem from '@/features/NavPanel/components/EmptyNavItem';
+import { useUserStore } from '@/store/user';
+import { authSelectors } from '@/store/user/slices/auth/selectors';
+
+import TopicItem from './Item';
+import { useGenerationTopicContext } from './StoreContext';
+
+interface TopicListProps {
+ viewMode?: 'auto' | 'grid' | 'list';
+}
+
+const TopicsList = memo<TopicListProps>(({ viewMode = 'auto' }) => {
+ const { useStore, namespace } = useGenerationTopicContext();
+ const { t } = useTranslation(namespace);
+ const openNewGenerationTopic = useStore((s: any) => s.openNewGenerationTopic);
+ const isLogin = useUserStore(authSelectors.isLogin);
+ const useFetchGenerationTopics = useStore((s) => s.useFetchGenerationTopics);
+ useFetchGenerationTopics(!!isLogin);
+ const generationTopics = useStore((s) => s.generationTopics);
+
+ const isList = viewMode === 'list';
+
+ const isEmpty = !generationTopics || generationTopics.length === 0;
+
+ if (isEmpty) {
+ return <EmptyNavItem title={t('topic.createNew')} onClick={openNewGenerationTopic} />;
+ }
+
+ const content = generationTopics.map((topic) => (
+ <TopicItem key={topic.id} showMoreInfo={isList} topic={topic} />
+ ));
+
+ return (
+ <>
+ {isList ? (
+ content
+ ) : (
+ <TooltipGroup layoutAnimation>
+ <Grid gap={4} maxItemWidth={64} padding={6} rows={6} width={'100%'}>
+ {content}
+ </Grid>
+ </TooltipGroup>
+ )}
+ </>
+ );
+});
+
+TopicsList.displayName = 'TopicsList';
+
+export default TopicsList;
diff --git a/src/features/GenerationTopicList/TopicUrlSync.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/TopicUrlSync.tsx
similarity index 100%
rename from src/features/GenerationTopicList/TopicUrlSync.tsx
rename to src/routes/(main)/(create)/features/GenerationLayout/Body/List/TopicUrlSync.tsx
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/Body/List/index.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/index.tsx
new file mode 100644
index 00000000000..8ba8bf3f40f
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/index.tsx
@@ -0,0 +1,38 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { memo, Suspense } from 'react';
+
+import SkeletonList from '@/features/NavPanel/components/SkeletonList';
+import { useGlobalStore } from '@/store/global';
+import { systemStatusSelectors } from '@/store/global/selectors';
+import { useUserStore } from '@/store/user';
+import { authSelectors } from '@/store/user/slices/auth/selectors';
+
+import type { GenerationLayoutCommonProps } from '../../types';
+import { GenerationTopicStoreProvider } from './StoreContext';
+import TopicList from './TopicList';
+import TopicUrlSync from './TopicUrlSync';
+
+const List = memo<
+ Pick<GenerationLayoutCommonProps, 'namespace' | 'useStore' | 'viewModeStatusKey'>
+>(({ namespace, useStore, viewModeStatusKey }) => {
+ const isLogin = useUserStore(authSelectors.isLogin);
+ const viewMode = useGlobalStore((s) => systemStatusSelectors[viewModeStatusKey](s));
+
+ const useFetchGenerationTopics = useStore((s: any) => s.useFetchGenerationTopics);
+ useFetchGenerationTopics(!!isLogin);
+
+ return (
+ <GenerationTopicStoreProvider value={{ namespace, useStore: useStore as any }}>
+ <Suspense fallback={<SkeletonList rows={6} />}>
+ <Flexbox gap={4} paddingBlock={1}>
+ <TopicList viewMode={viewMode} />
+ <TopicUrlSync />
+ </Flexbox>
+ </Suspense>
+ </GenerationTopicStoreProvider>
+ );
+});
+
+export default List;
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/Body/index.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Body/index.tsx
new file mode 100644
index 00000000000..ec578e22ad8
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationLayout/Body/index.tsx
@@ -0,0 +1,76 @@
+'use client';
+
+import { Accordion, AccordionItem, Flexbox, Icon, Segmented, Text } from '@lobehub/ui';
+import { LayoutGrid, ListIcon } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useGlobalStore } from '@/store/global';
+import { systemStatusSelectors } from '@/store/global/selectors';
+import { useUserStore } from '@/store/user';
+import { authSelectors } from '@/store/user/slices/auth/selectors';
+
+import type { GenerationLayoutCommonProps } from '../types';
+import List from './List';
+
+enum GroupKey {
+ Topics = 'topics',
+}
+
+const Body = memo<GenerationLayoutCommonProps>((props) => {
+ const { namespace, useStore, viewModeStatusKey, generationTopicsSelector } = props;
+ const { t } = useTranslation(namespace);
+ const isLogin = useUserStore(authSelectors.isLogin);
+ const viewMode = useGlobalStore((s) => systemStatusSelectors[viewModeStatusKey](s));
+ const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);
+
+ const useFetchGenerationTopics = useStore((s: any) => s.useFetchGenerationTopics);
+ useFetchGenerationTopics(!!isLogin);
+
+ const generationTopics = useStore(generationTopicsSelector);
+ const count = generationTopics?.length || 0;
+
+ return (
+ <Flexbox gap={1} paddingInline={4}>
+ <Accordion defaultExpandedKeys={[GroupKey.Topics]} gap={2}>
+ <AccordionItem
+ itemKey={GroupKey.Topics}
+ paddingBlock={4}
+ paddingInline={'8px 4px'}
+ action={
+ <Flexbox horizontal gap={2}>
+ <Segmented
+ size={'small'}
+ value={viewMode}
+ variant={'borderless'}
+ options={[
+ {
+ icon: <Icon icon={ListIcon} />,
+ value: 'list',
+ },
+ {
+ icon: <Icon icon={LayoutGrid} />,
+ value: 'grid',
+ },
+ ]}
+ onChange={(v) => updateSystemStatus({ [viewModeStatusKey]: v })}
+ />
+ </Flexbox>
+ }
+ title={
+ <Text ellipsis fontSize={12} type={'secondary'} weight={500}>
+ {t('topic.title')}
+ {count > 0 && ` ${count}`}
+ </Text>
+ }
+ >
+ <List namespace={namespace} useStore={useStore} viewModeStatusKey={viewModeStatusKey} />
+ </AccordionItem>
+ </Accordion>
+ </Flexbox>
+ );
+});
+
+Body.displayName = 'GenerationLayoutBody';
+
+export default Body;
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/Header/AddButton.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Header/AddButton.tsx
new file mode 100644
index 00000000000..67376a131e2
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationLayout/Header/AddButton.tsx
@@ -0,0 +1,30 @@
+'use client';
+
+import { ActionIcon } from '@lobehub/ui';
+import { SquarePenIcon } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import type { GenerationLayoutCommonProps } from '../types';
+
+const AddButton = memo<Pick<GenerationLayoutCommonProps, 'namespace' | 'useStore'>>((props) => {
+ const { namespace, useStore } = props;
+ const { t } = useTranslation(namespace);
+ const openNewGenerationTopic = useStore((s: any) => s.openNewGenerationTopic);
+
+ return (
+ <ActionIcon
+ icon={SquarePenIcon}
+ title={t('topic.createNew')}
+ size={{
+ blockSize: 32,
+ size: 18,
+ }}
+ onClick={openNewGenerationTopic}
+ />
+ );
+});
+
+AddButton.displayName = 'GenerationLayoutAddButton';
+
+export default AddButton;
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/Header/index.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Header/index.tsx
new file mode 100644
index 00000000000..892456f0034
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationLayout/Header/index.tsx
@@ -0,0 +1,44 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { MessageSquarePlusIcon, SearchIcon } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import NavItem from '@/features/NavPanel/components/NavItem';
+import SideBarHeaderLayout from '@/features/NavPanel/SideBarHeaderLayout';
+import { useGlobalStore } from '@/store/global';
+
+import type { GenerationLayoutCommonProps } from '../types';
+
+const Header = memo<GenerationLayoutCommonProps>((props) => {
+ const { t } = useTranslation('common');
+ const { t: tGeneration } = useTranslation(props.namespace);
+ const { breadcrumb, useStore } = props;
+ const toggleCommandMenu = useGlobalStore((s) => s.toggleCommandMenu);
+ const openNewGenerationTopic = useStore((s: any) => s.openNewGenerationTopic);
+
+ return (
+ <>
+ <SideBarHeaderLayout breadcrumb={breadcrumb} />
+ <Flexbox paddingInline={4}>
+ <NavItem
+ icon={MessageSquarePlusIcon}
+ key={'new-topic'}
+ title={tGeneration('topic.createNew')}
+ onClick={openNewGenerationTopic}
+ />
+ <NavItem
+ icon={SearchIcon}
+ key={'search'}
+ title={t('tab.search')}
+ onClick={() => toggleCommandMenu(true)}
+ />
+ </Flexbox>
+ </>
+ );
+});
+
+Header.displayName = 'GenerationLayoutHeader';
+
+export default Header;
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/Sidebar.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Sidebar.tsx
new file mode 100644
index 00000000000..4c213d17f07
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationLayout/Sidebar.tsx
@@ -0,0 +1,23 @@
+'use client';
+
+import { memo } from 'react';
+
+import { NavPanelPortal } from '@/features/NavPanel';
+import SideBarLayout from '@/features/NavPanel/SideBarLayout';
+
+import Body from './Body';
+import Header from './Header';
+import type { GenerationLayoutCommonProps } from './types';
+
+const Sidebar = memo<GenerationLayoutCommonProps>((props) => {
+ const { navKey } = props;
+ return (
+ <NavPanelPortal navKey={navKey}>
+ <SideBarLayout body={<Body {...props} />} header={<Header {...props} />} />
+ </NavPanelPortal>
+ );
+});
+
+Sidebar.displayName = 'GenerationLayoutSidebar';
+
+export default Sidebar;
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/index.tsx b/src/routes/(main)/(create)/features/GenerationLayout/index.tsx
new file mode 100644
index 00000000000..c9e51baef06
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationLayout/index.tsx
@@ -0,0 +1,26 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import type { FC, ReactNode } from 'react';
+import { Outlet } from 'react-router-dom';
+
+import Sidebar from './Sidebar';
+import { styles } from './style';
+import type { GenerationLayoutCommonProps } from './types';
+
+export interface GenerationLayoutProps extends GenerationLayoutCommonProps {
+ /** Optional extra content (e.g. RegisterHotkeys for image) */
+ extra?: ReactNode;
+}
+
+const GenerationLayout: FC<GenerationLayoutProps> = ({ extra, ...commonProps }) => (
+ <>
+ <Sidebar {...commonProps} />
+ <Flexbox className={styles.mainContainer} flex={1} height={'100%'}>
+ <Outlet />
+ </Flexbox>
+ {extra}
+ </>
+);
+
+export default GenerationLayout;
diff --git a/src/routes/(main)/video/_layout/style.ts b/src/routes/(main)/(create)/features/GenerationLayout/style.ts
similarity index 75%
rename from src/routes/(main)/video/_layout/style.ts
rename to src/routes/(main)/(create)/features/GenerationLayout/style.ts
index beeb0b5a36a..24edd9b5d8b 100644
--- a/src/routes/(main)/video/_layout/style.ts
+++ b/src/routes/(main)/(create)/features/GenerationLayout/style.ts
@@ -1,10 +1,6 @@
import { createStaticStyles } from 'antd-style';
export const styles = createStaticStyles(({ css, cssVar }) => ({
- contentContainer: css`
- position: relative;
- overflow: hidden;
- `,
mainContainer: css`
position: relative;
overflow: hidden;
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/types.ts b/src/routes/(main)/(create)/features/GenerationLayout/types.ts
new file mode 100644
index 00000000000..01ade707607
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationLayout/types.ts
@@ -0,0 +1,10 @@
+'use client';
+
+export interface GenerationLayoutCommonProps {
+ breadcrumb: { href: string; title: string }[];
+ generationTopicsSelector: (s: any) => any;
+ namespace: 'image' | 'video';
+ navKey: string;
+ useStore: (selector: (s: any) => any) => any;
+ viewModeStatusKey: 'imageTopicViewMode' | 'videoTopicViewMode';
+}
diff --git a/src/routes/(main)/(create)/features/GenerationWorkspace/Content.tsx b/src/routes/(main)/(create)/features/GenerationWorkspace/Content.tsx
new file mode 100644
index 00000000000..56b03a52a9f
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationWorkspace/Content.tsx
@@ -0,0 +1,55 @@
+'use client';
+
+import type { ComponentType } from 'react';
+
+import type { GenerationBatch } from '@/types/generation';
+
+export interface GenerationWorkspaceContentSelectors {
+ activeGenerationTopicId: (s: any) => string | null | undefined;
+ currentGenerationBatches: (s: any) => GenerationBatch[] | null;
+ isCurrentGenerationTopicLoaded: (s: any) => boolean;
+}
+
+interface GenerationWorkspaceContentProps {
+ embedInput?: boolean;
+ EmptyStateComponent: ComponentType<{ embedInput?: boolean; PromptInput: ComponentType }>;
+ GenerationFeed: ComponentType;
+ PromptInput: ComponentType<{ disableAnimation?: boolean; showTitle?: boolean }>;
+ selectors: GenerationWorkspaceContentSelectors;
+ SkeletonList: ComponentType<{ embedInput?: boolean }>;
+ useStore: (selector: (s: any) => any) => any;
+}
+
+const Content = ({
+ embedInput = true,
+ useStore,
+ selectors,
+ PromptInput,
+ GenerationFeed,
+ SkeletonList,
+ EmptyStateComponent,
+}: GenerationWorkspaceContentProps) => {
+ const activeTopicId = useStore(selectors.activeGenerationTopicId);
+ const useFetchGenerationBatches = useStore((s: any) => s.useFetchGenerationBatches);
+ const isCurrentGenerationTopicLoaded = useStore(selectors.isCurrentGenerationTopicLoaded);
+ useFetchGenerationBatches(activeTopicId);
+ const currentBatches = useStore(selectors.currentGenerationBatches);
+ const hasGenerations = currentBatches && currentBatches.length > 0;
+
+ if (!isCurrentGenerationTopicLoaded) {
+ return <SkeletonList embedInput={embedInput} />;
+ }
+
+ if (!hasGenerations) {
+ return <EmptyStateComponent PromptInput={PromptInput} embedInput={embedInput} />;
+ }
+
+ return (
+ <>
+ <GenerationFeed key={activeTopicId} />
+ {embedInput && <PromptInput disableAnimation showTitle={false} />}
+ </>
+ );
+};
+
+export default Content;
diff --git a/src/routes/(main)/(create)/features/GenerationWorkspace/EmptyState.tsx b/src/routes/(main)/(create)/features/GenerationWorkspace/EmptyState.tsx
new file mode 100644
index 00000000000..d6441f0425b
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationWorkspace/EmptyState.tsx
@@ -0,0 +1,27 @@
+'use client';
+
+import { Center } from '@lobehub/ui';
+import type { ComponentType } from 'react';
+import { memo } from 'react';
+
+interface EmptyStateProps {
+ /** 为 false 时由页面级输入框渲染,此处只显示占位 */
+ embedInput?: boolean;
+ /** Prompt input component to show when embedInput is true */
+ PromptInput: ComponentType<{ disableAnimation?: boolean; showTitle?: boolean }>;
+}
+
+const EmptyState = memo<EmptyStateProps>(({ embedInput = true, PromptInput }) => {
+ if (!embedInput) {
+ return <Center flex={1} />;
+ }
+ return (
+ <Center height={'calc(100vh - 180px)'}>
+ <PromptInput showTitle={true} />
+ </Center>
+ );
+});
+
+EmptyState.displayName = 'GenerationWorkspaceEmptyState';
+
+export default EmptyState;
diff --git a/src/routes/(main)/(create)/features/GenerationWorkspace/index.tsx b/src/routes/(main)/(create)/features/GenerationWorkspace/index.tsx
new file mode 100644
index 00000000000..139097f5ece
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationWorkspace/index.tsx
@@ -0,0 +1,49 @@
+'use client';
+
+import type { ComponentType } from 'react';
+
+import { useQueryState } from '@/hooks/useQueryParam';
+
+import type { GenerationWorkspaceContentSelectors } from './Content';
+import Content from './Content';
+import EmptyState from './EmptyState';
+
+interface GenerationWorkspaceProps {
+ /** 为 false 时由页面级固定底部输入框渲染,不在此处嵌入(与 agent 布局一致) */
+ embedInput?: boolean;
+ GenerationFeed: ComponentType;
+ PromptInput: ComponentType<{ disableAnimation?: boolean; showTitle?: boolean }>;
+ selectors: GenerationWorkspaceContentSelectors;
+ SkeletonList: ComponentType<{ embedInput?: boolean }>;
+ useStore: (selector: (s: any) => any) => any;
+}
+
+const GenerationWorkspace = ({
+ embedInput = true,
+ useStore,
+ selectors,
+ PromptInput,
+ GenerationFeed,
+ SkeletonList,
+}: GenerationWorkspaceProps) => {
+ const [topic] = useQueryState('topic');
+ const isCreatingWithNewTopic = useStore((s: any) => s.isCreatingWithNewTopic);
+
+ if (!topic || isCreatingWithNewTopic) {
+ return <EmptyState PromptInput={PromptInput} embedInput={embedInput} />;
+ }
+
+ return (
+ <Content
+ EmptyStateComponent={EmptyState}
+ GenerationFeed={GenerationFeed}
+ PromptInput={PromptInput}
+ SkeletonList={SkeletonList}
+ embedInput={embedInput}
+ selectors={selectors}
+ useStore={useStore}
+ />
+ );
+};
+
+export default GenerationWorkspace;
diff --git a/src/routes/(main)/image/NotSupportClient.tsx b/src/routes/(main)/(create)/image/NotSupportClient.tsx
similarity index 100%
rename from src/routes/(main)/image/NotSupportClient.tsx
rename to src/routes/(main)/(create)/image/NotSupportClient.tsx
diff --git a/src/routes/(main)/image/_layout/RegisterHotkeys.tsx b/src/routes/(main)/(create)/image/_layout/RegisterHotkeys.tsx
similarity index 100%
rename from src/routes/(main)/image/_layout/RegisterHotkeys.tsx
rename to src/routes/(main)/(create)/image/_layout/RegisterHotkeys.tsx
diff --git a/src/routes/(main)/(create)/image/_layout/index.tsx b/src/routes/(main)/(create)/image/_layout/index.tsx
new file mode 100644
index 00000000000..fe6a0d15252
--- /dev/null
+++ b/src/routes/(main)/(create)/image/_layout/index.tsx
@@ -0,0 +1,27 @@
+'use client';
+
+import { useTranslation } from 'react-i18next';
+
+import GenerationLayout from '@/routes/(main)/(create)/features/GenerationLayout';
+import { useImageStore } from '@/store/image';
+import { generationTopicSelectors } from '@/store/image/slices/generationTopic/selectors';
+
+import RegisterHotkeys from './RegisterHotkeys';
+
+const ImageLayout = () => {
+ const { t } = useTranslation(['common']);
+
+ return (
+ <GenerationLayout
+ breadcrumb={[{ href: '/image', title: t('tab.aiImage') }]}
+ extra={<RegisterHotkeys />}
+ generationTopicsSelector={generationTopicSelectors.generationTopics}
+ namespace="image"
+ navKey="image"
+ useStore={useImageStore}
+ viewModeStatusKey="imageTopicViewMode"
+ />
+ );
+};
+
+export default ImageLayout;
diff --git a/src/routes/(main)/image/_layout/type.ts b/src/routes/(main)/(create)/image/_layout/type.ts
similarity index 100%
rename from src/routes/(main)/image/_layout/type.ts
rename to src/routes/(main)/(create)/image/_layout/type.ts
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/ImageConfigSkeleton.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/ImageConfigSkeleton.tsx
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/ImageConfigSkeleton.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/ImageConfigSkeleton.tsx
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/AspectRatioSelect/index.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/AspectRatioSelect/index.tsx
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/AspectRatioSelect/index.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/AspectRatioSelect/index.tsx
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/CfgSliderInput.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/CfgSliderInput.tsx
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/CfgSliderInput.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/CfgSliderInput.tsx
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/DimensionControlGroup.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/DimensionControlGroup.tsx
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/DimensionControlGroup.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/DimensionControlGroup.tsx
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/ImageNum.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageNum.tsx
similarity index 99%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/ImageNum.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageNum.tsx
index f47f8f02c69..4f451feb9c6 100644
--- a/src/routes/(main)/image/_layout/ConfigPanel/components/ImageNum.tsx
+++ b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageNum.tsx
@@ -140,7 +140,6 @@ const ImageNum = memo<ImageNumSelectorProps>(
}}
/>
<ActionIcon
- color="success"
disabled={!isValidInput}
icon={Check}
size="small"
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/ImageUpload.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUpload.tsx
similarity index 97%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/ImageUpload.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUpload.tsx
index 3b8dc4f0b5c..6424ca55927 100644
--- a/src/routes/(main)/image/_layout/ConfigPanel/components/ImageUpload.tsx
+++ b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUpload.tsx
@@ -9,10 +9,10 @@ import React, { memo, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import Image from '@/libs/next/Image';
-import { useDragAndDrop } from '@/routes/(main)/image/_layout/ConfigPanel/hooks/useDragAndDrop';
-import { useUploadFilesValidation } from '@/routes/(main)/image/_layout/ConfigPanel/hooks/useUploadFilesValidation';
-import { configPanelStyles } from '@/routes/(main)/image/_layout/ConfigPanel/style';
-import { type ImageConstraints } from '@/routes/(main)/image/_layout/ConfigPanel/utils/imageValidation';
+import { useDragAndDrop } from '@/routes/(main)/(create)/image/features/ConfigPanel/hooks/useDragAndDrop';
+import { useUploadFilesValidation } from '@/routes/(main)/(create)/image/features/ConfigPanel/hooks/useUploadFilesValidation';
+import { configPanelStyles } from '@/routes/(main)/(create)/image/features/ConfigPanel/style';
+import { type ImageConstraints } from '@/routes/(main)/(create)/image/features/ConfigPanel/utils/imageValidation';
import { useFileStore } from '@/store/file';
import { type FileUploadStatus } from '@/types/files/upload';
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/ImageUrl.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUrl.tsx
similarity index 88%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/ImageUrl.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUrl.tsx
index fcfd8b76f22..3f176efdca0 100644
--- a/src/routes/(main)/image/_layout/ConfigPanel/components/ImageUrl.tsx
+++ b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUrl.tsx
@@ -1,6 +1,6 @@
import { memo } from 'react';
-import { useAutoDimensions } from '@/routes/(main)/image/_layout/ConfigPanel/hooks/useAutoDimensions';
+import { useAutoDimensions } from '@/routes/(main)/(create)/image/features/ConfigPanel/hooks/useAutoDimensions';
import { useGenerationConfigParam } from '@/store/image/slices/generationConfig/hooks';
import ImageUpload from './ImageUpload';
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/ImageUrlsUpload.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUrlsUpload.tsx
similarity index 94%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/ImageUrlsUpload.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUrlsUpload.tsx
index 6f1a15ddc80..5065fde503f 100644
--- a/src/routes/(main)/image/_layout/ConfigPanel/components/ImageUrlsUpload.tsx
+++ b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUrlsUpload.tsx
@@ -1,6 +1,6 @@
import { memo } from 'react';
-import { useAutoDimensions } from '@/routes/(main)/image/_layout/ConfigPanel/hooks/useAutoDimensions';
+import { useAutoDimensions } from '@/routes/(main)/(create)/image/features/ConfigPanel/hooks/useAutoDimensions';
import { useGenerationConfigParam } from '@/store/image/slices/generationConfig/hooks';
import ImageUpload from './ImageUpload';
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/InputNumber/index.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/InputNumber/index.tsx
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/InputNumber/index.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/InputNumber/index.tsx
diff --git a/src/routes/(main)/(create)/image/features/ConfigPanel/components/ModelSelect/ImageModelItem.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ModelSelect/ImageModelItem.tsx
new file mode 100644
index 00000000000..6de011ab7f0
--- /dev/null
+++ b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ModelSelect/ImageModelItem.tsx
@@ -0,0 +1,15 @@
+import type { AiModelForSelect } from 'model-bank';
+
+import GenerationModelItem from '@/routes/(main)/(create)/components/GenerationModelItem';
+
+type ImageModelItemProps = AiModelForSelect & {
+ providerId?: string;
+ showBadge?: boolean;
+ showPopover?: boolean;
+};
+
+const ImageModelItem = (props: ImageModelItemProps) => (
+ <GenerationModelItem {...props} showPrice={true} />
+);
+
+export default ImageModelItem;
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/ModelSelect/index.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ModelSelect/index.tsx
similarity index 91%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/ModelSelect/index.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/ModelSelect/index.tsx
index 7fd5840c0bd..5c80dd3e55a 100644
--- a/src/routes/(main)/image/_layout/ConfigPanel/components/ModelSelect/index.tsx
+++ b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ModelSelect/index.tsx
@@ -17,8 +17,18 @@ import ImageModelItem from './ImageModelItem';
const prefixCls = 'ant';
-const styles = createStaticStyles(({ css }) => ({
+const styles = createStaticStyles(({ css, cssVar }) => ({
popup: css`
+ &.${prefixCls}-select-dropdown .${prefixCls}-select-item-option {
+ margin-block: 1px;
+ margin-inline: 4px;
+ padding-block: 8px;
+ padding-inline: 8px;
+ border-radius: ${cssVar.borderRadiusSM};
+ }
+ &.${prefixCls}-select-dropdown .${prefixCls}-select-item-option-selected {
+ background: ${cssVar.colorFillTertiary};
+ }
&.${prefixCls}-select-dropdown .${prefixCls}-select-item-option-grouped {
padding-inline-start: 12px;
}
@@ -145,11 +155,9 @@ const ModelSelect = memo(() => {
shadow
labelRender={labelRender}
options={options}
+ popupClassName={styles.popup}
size={'large'}
value={currentProvider && currentModel ? `${currentProvider}/${currentModel}` : undefined}
- classNames={{
- root: styles.popup,
- }}
style={{
width: '100%',
}}
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/ImageManageModal.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/MultiImagesUpload/ImageManageModal.tsx
similarity index 98%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/ImageManageModal.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/MultiImagesUpload/ImageManageModal.tsx
index b83fb19e63e..9918e34cf12 100644
--- a/src/routes/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/ImageManageModal.tsx
+++ b/src/routes/(main)/(create)/image/features/ConfigPanel/components/MultiImagesUpload/ImageManageModal.tsx
@@ -8,7 +8,7 @@ import React, { memo, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import Image from '@/libs/next/Image';
-import { useUploadFilesValidation } from '@/routes/(main)/image/_layout/ConfigPanel/hooks/useUploadFilesValidation';
+import { useUploadFilesValidation } from '@/routes/(main)/(create)/image/features/ConfigPanel/hooks/useUploadFilesValidation';
// ======== Types ======== //
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/index.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/MultiImagesUpload/index.tsx
similarity index 98%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/index.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/MultiImagesUpload/index.tsx
index f930df71df1..5d265a20182 100644
--- a/src/routes/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/index.tsx
+++ b/src/routes/(main)/(create)/image/features/ConfigPanel/components/MultiImagesUpload/index.tsx
@@ -9,10 +9,10 @@ import React, { memo, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import Image from '@/libs/next/Image';
-import { CONFIG_PANEL_WIDTH } from '@/routes/(main)/image/_layout/ConfigPanel/constants';
-import { useDragAndDrop } from '@/routes/(main)/image/_layout/ConfigPanel/hooks/useDragAndDrop';
-import { useUploadFilesValidation } from '@/routes/(main)/image/_layout/ConfigPanel/hooks/useUploadFilesValidation';
-import { configPanelStyles } from '@/routes/(main)/image/_layout/ConfigPanel/style';
+import { CONFIG_PANEL_WIDTH } from '@/routes/(main)/(create)/image/features/ConfigPanel/constants';
+import { useDragAndDrop } from '@/routes/(main)/(create)/image/features/ConfigPanel/hooks/useDragAndDrop';
+import { useUploadFilesValidation } from '@/routes/(main)/(create)/image/features/ConfigPanel/hooks/useUploadFilesValidation';
+import { configPanelStyles } from '@/routes/(main)/(create)/image/features/ConfigPanel/style';
import { useFileStore } from '@/store/file';
import { type FileUploadStatus } from '@/types/files/upload';
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/QualitySelect.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/QualitySelect.tsx
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/QualitySelect.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/QualitySelect.tsx
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/ResolutionSelect.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ResolutionSelect.tsx
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/ResolutionSelect.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/ResolutionSelect.tsx
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/SeedNumberInput.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/SeedNumberInput.tsx
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/SeedNumberInput.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/SeedNumberInput.tsx
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/Select/index.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/Select/index.tsx
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/Select/index.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/Select/index.tsx
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/SizeSelect.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/SizeSelect.tsx
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/SizeSelect.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/SizeSelect.tsx
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/components/StepsSliderInput.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/StepsSliderInput.tsx
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/components/StepsSliderInput.tsx
rename to src/routes/(main)/(create)/image/features/ConfigPanel/components/StepsSliderInput.tsx
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/constants.ts b/src/routes/(main)/(create)/image/features/ConfigPanel/constants.ts
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/constants.ts
rename to src/routes/(main)/(create)/image/features/ConfigPanel/constants.ts
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/hooks/useAutoDimensions.ts b/src/routes/(main)/(create)/image/features/ConfigPanel/hooks/useAutoDimensions.ts
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/hooks/useAutoDimensions.ts
rename to src/routes/(main)/(create)/image/features/ConfigPanel/hooks/useAutoDimensions.ts
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/hooks/useDragAndDrop.ts b/src/routes/(main)/(create)/image/features/ConfigPanel/hooks/useDragAndDrop.ts
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/hooks/useDragAndDrop.ts
rename to src/routes/(main)/(create)/image/features/ConfigPanel/hooks/useDragAndDrop.ts
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/hooks/useUploadFilesValidation.ts b/src/routes/(main)/(create)/image/features/ConfigPanel/hooks/useUploadFilesValidation.ts
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/hooks/useUploadFilesValidation.ts
rename to src/routes/(main)/(create)/image/features/ConfigPanel/hooks/useUploadFilesValidation.ts
diff --git a/src/routes/(main)/(create)/image/features/ConfigPanel/index.ts b/src/routes/(main)/(create)/image/features/ConfigPanel/index.ts
new file mode 100644
index 00000000000..31eaa37e082
--- /dev/null
+++ b/src/routes/(main)/(create)/image/features/ConfigPanel/index.ts
@@ -0,0 +1,12 @@
+export { default as AspectRatioSelect } from '@/routes/(main)/(create)/image/features/ConfigPanel/components/AspectRatioSelect';
+export { default as CfgSliderInput } from '@/routes/(main)/(create)/image/features/ConfigPanel/components/CfgSliderInput';
+export { default as DimensionControlGroup } from '@/routes/(main)/(create)/image/features/ConfigPanel/components/DimensionControlGroup';
+export { default as ImageNum } from '@/routes/(main)/(create)/image/features/ConfigPanel/components/ImageNum';
+export { default as ImageUpload } from '@/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUpload';
+export { default as ImageModelItem } from '@/routes/(main)/(create)/image/features/ConfigPanel/components/ModelSelect/ImageModelItem';
+export { default as QualitySelect } from '@/routes/(main)/(create)/image/features/ConfigPanel/components/QualitySelect';
+export { default as ResolutionSelect } from '@/routes/(main)/(create)/image/features/ConfigPanel/components/ResolutionSelect';
+export { default as SeedNumberInput } from '@/routes/(main)/(create)/image/features/ConfigPanel/components/SeedNumberInput';
+export { default as SizeSelect } from '@/routes/(main)/(create)/image/features/ConfigPanel/components/SizeSelect';
+export { default as StepsSliderInput } from '@/routes/(main)/(create)/image/features/ConfigPanel/components/StepsSliderInput';
+export { useAutoDimensions } from '@/routes/(main)/(create)/image/features/ConfigPanel/hooks/useAutoDimensions';
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/style.ts b/src/routes/(main)/(create)/image/features/ConfigPanel/style.ts
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/style.ts
rename to src/routes/(main)/(create)/image/features/ConfigPanel/style.ts
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/utils/__tests__/dimensionConstraints.test.ts b/src/routes/(main)/(create)/image/features/ConfigPanel/utils/__tests__/dimensionConstraints.test.ts
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/utils/__tests__/dimensionConstraints.test.ts
rename to src/routes/(main)/(create)/image/features/ConfigPanel/utils/__tests__/dimensionConstraints.test.ts
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/utils/__tests__/imageValidation.test.ts b/src/routes/(main)/(create)/image/features/ConfigPanel/utils/__tests__/imageValidation.test.ts
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/utils/__tests__/imageValidation.test.ts
rename to src/routes/(main)/(create)/image/features/ConfigPanel/utils/__tests__/imageValidation.test.ts
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/utils/dimensionConstraints.ts b/src/routes/(main)/(create)/image/features/ConfigPanel/utils/dimensionConstraints.ts
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/utils/dimensionConstraints.ts
rename to src/routes/(main)/(create)/image/features/ConfigPanel/utils/dimensionConstraints.ts
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/utils/imageValidation.ts b/src/routes/(main)/(create)/image/features/ConfigPanel/utils/imageValidation.ts
similarity index 100%
rename from src/routes/(main)/image/_layout/ConfigPanel/utils/imageValidation.ts
rename to src/routes/(main)/(create)/image/features/ConfigPanel/utils/imageValidation.ts
diff --git a/src/routes/(main)/image/features/GenerationFeed/BatchItem.tsx b/src/routes/(main)/(create)/image/features/GenerationFeed/BatchItem.tsx
similarity index 61%
rename from src/routes/(main)/image/features/GenerationFeed/BatchItem.tsx
rename to src/routes/(main)/(create)/image/features/GenerationFeed/BatchItem.tsx
index f68fa6f207b..08f00075f06 100644
--- a/src/routes/(main)/image/features/GenerationFeed/BatchItem.tsx
+++ b/src/routes/(main)/(create)/image/features/GenerationFeed/BatchItem.tsx
@@ -2,7 +2,7 @@
import { useAutoAnimate } from '@formkit/auto-animate/react';
import { ModelTag } from '@lobehub/icons';
-import { ActionIconGroup, Block, Flexbox, Grid, Markdown, Tag, Text } from '@lobehub/ui';
+import { ActionIconGroup, Block, Flexbox, Grid, Image, Markdown, Tag, Text } from '@lobehub/ui';
import { App } from 'antd';
import { createStaticStyles } from 'antd-style';
import dayjs from 'dayjs';
@@ -13,13 +13,12 @@ import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import useRenderBusinessBatchItem from '@/business/client/hooks/useRenderBusinessBatchItem';
-import APIKeyForm from '@/components/InvalidAPIKey';
+import { GenerationInvalidAPIKey } from '@/routes/(main)/(create)/features/GenerationInput';
import { useImageStore } from '@/store/image';
import { AsyncTaskErrorType } from '@/types/asyncTask';
import { type GenerationBatch } from '@/types/generation';
import { GenerationItem } from './GenerationItem';
-import { DEFAULT_MAX_ITEM_WIDTH } from './GenerationItem/utils';
import { ReferenceImages } from './ReferenceImages';
const styles = createStaticStyles(({ css, cssVar, cx }) => ({
@@ -59,14 +58,13 @@ interface GenerationBatchItemProps {
}
export const GenerationBatchItem = memo<GenerationBatchItemProps>(({ batch }) => {
- const { t } = useTranslation(['image', 'modelProvider', 'error']);
+ const { t } = useTranslation('image');
const { message } = App.useApp();
const [imageGridRef] = useAutoAnimate();
const activeTopicId = useImageStore((s) => s.activeGenerationTopicId);
const removeGenerationBatch = useImageStore((s) => s.removeGenerationBatch);
- const recreateImage = useImageStore((s) => s.recreateImage);
const reuseSettings = useImageStore((s) => s.reuseSettings);
const { shouldRenderBusinessBatchItem, businessBatchItem } = useRenderBusinessBatchItem(batch);
@@ -111,21 +109,12 @@ export const GenerationBatchItem = memo<GenerationBatchItemProps>(({ batch }) =>
);
if (isInvalidApiKey) {
- // Use unified InvalidAPIKey component for all providers (including ComfyUI)
return (
- <APIKeyForm
- bedrockDescription={t('bedrock.unlock.imageGenerationDescription', { ns: 'modelProvider' })}
- id={batch.id}
+ <GenerationInvalidAPIKey
provider={batch.provider}
- description={t('unlock.apiKey.imageGenerationDescription', {
- name: batch.provider,
- ns: 'error',
- })}
- onClose={() => {
- removeGenerationBatch(batch.id, activeTopicId!);
- }}
- onRecreate={() => {
- recreateImage(batch.id);
+ onNavigate={() => {
+ if (!activeTopicId) return;
+ removeGenerationBatch(batch.id, activeTopicId);
}}
/>
);
@@ -135,78 +124,41 @@ export const GenerationBatchItem = memo<GenerationBatchItemProps>(({ batch }) =>
return businessBatchItem;
}
- // Calculate total number of reference images
- const referenceImageCount =
- (batch.config?.imageUrl ? 1 : 0) + (batch.config?.imageUrls?.length || 0);
-
- const isSingleImageLayout = referenceImageCount === 1;
-
- // Content for prompt and metadata
- const promptAndMetadata = (
- <>
- <Markdown variant={'chat'}>{batch.prompt}</Markdown>
- <Flexbox horizontal gap={4} justify="space-between" style={{ marginBottom: 10 }}>
- <Flexbox horizontal gap={4}>
- <ModelTag model={batch.model} />
- {batch.width && batch.height && (
- <Tag>
- {batch.width} × {batch.height}
- </Tag>
- )}
- <Tag>{t('generation.metadata.count', { count: batch.generations.length })}</Tag>
- </Flexbox>
- </Flexbox>
- </>
- );
-
return (
<Block className={styles.container} gap={8} variant="borderless">
- {isSingleImageLayout ? (
- // Single image layout: horizontal arrangement with vertical centering
- <Flexbox horizontal align="center" gap={16}>
- <ReferenceImages
- imageUrl={batch.config?.imageUrl}
- imageUrls={batch.config?.imageUrls}
- layout="single"
- />
- <Flexbox flex={1} gap={8}>
- {promptAndMetadata}
- </Flexbox>
- </Flexbox>
- ) : (
- // Multiple images or no images: vertical arrangement
- <>
- <ReferenceImages
- imageUrl={batch.config?.imageUrl}
- imageUrls={batch.config?.imageUrls}
- layout="multiple"
- />
- {promptAndMetadata}
- </>
- )}
- <Grid
- maxItemWidth={DEFAULT_MAX_ITEM_WIDTH}
- ref={imageGridRef}
- rows={batch.generations.length}
- >
- {batch.generations.map((generation) => (
- <GenerationItem
- generation={generation}
- generationBatch={batch}
- key={generation.id}
- prompt={batch.prompt}
- />
- ))}
- </Grid>
+ <Flexbox horizontal align={'flex-start'} gap={16}>
+ <ReferenceImages imageUrl={batch.config?.imageUrl} imageUrls={batch.config?.imageUrls} />
+ <Markdown variant={'chat'}>{batch.prompt}</Markdown>
+ </Flexbox>
+ <Image.PreviewGroup>
+ <Grid maxItemWidth={200} ref={imageGridRef} rows={batch.generations.length}>
+ {batch.generations.map((generation) => (
+ <GenerationItem
+ generation={generation}
+ generationBatch={batch}
+ key={generation.id}
+ prompt={batch.prompt}
+ />
+ ))}
+ </Grid>
+ </Image.PreviewGroup>
+ <Flexbox horizontal gap={4} style={{ opacity: 0.66 }}>
+ <ModelTag model={batch.model} variant={'borderless'} />
+ {batch.width && batch.height && (
+ <Tag variant={'borderless'}>
+ {batch.width} × {batch.height}
+ </Tag>
+ )}
+ <Tag variant={'borderless'}>
+ {t('generation.metadata.count', { count: batch.generations.length })}
+ </Tag>
+ </Flexbox>
<Flexbox
horizontal
align={'center'}
className={styles.batchActions}
justify={'space-between'}
>
- <Text as={'time'} fontSize={12} type={'secondary'}>
- {time}
- </Text>
<ActionIconGroup
items={[
{
@@ -230,6 +182,9 @@ export const GenerationBatchItem = memo<GenerationBatchItemProps>(({ batch }) =>
},
]}
/>
+ <Text as={'time'} fontSize={12} type={'secondary'}>
+ {time}
+ </Text>
</Flexbox>
</Block>
);
diff --git a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/ActionButtons.tsx b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ActionButtons.tsx
similarity index 100%
rename from src/routes/(main)/image/features/GenerationFeed/GenerationItem/ActionButtons.tsx
rename to src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ActionButtons.tsx
diff --git a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/ElapsedTime.tsx b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ElapsedTime.tsx
similarity index 100%
rename from src/routes/(main)/image/features/GenerationFeed/GenerationItem/ElapsedTime.tsx
rename to src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ElapsedTime.tsx
diff --git a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/ErrorState.tsx b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ErrorState.tsx
similarity index 98%
rename from src/routes/(main)/image/features/GenerationFeed/GenerationItem/ErrorState.tsx
rename to src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ErrorState.tsx
index 9162a1d14fc..6ad5e175ed5 100644
--- a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/ErrorState.tsx
+++ b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ErrorState.tsx
@@ -73,7 +73,7 @@ export const ErrorState = memo<ErrorStateProps>(
>
<Center gap={8}>
<Icon color={cssVar.colorTextDescription} icon={ImageOffIcon} size={24} />
- <Text strong type={'secondary'}>
+ <Text strong align={'center'} type={'secondary'}>
{t('generation.status.failed')}
</Text>
{generation.task.error && (
diff --git a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/LoadingState.tsx b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/LoadingState.tsx
similarity index 81%
rename from src/routes/(main)/image/features/GenerationFeed/GenerationItem/LoadingState.tsx
rename to src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/LoadingState.tsx
index 457479cdc8f..b9f03b92bc1 100644
--- a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/LoadingState.tsx
+++ b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/LoadingState.tsx
@@ -1,10 +1,9 @@
'use client';
-import { LoadingOutlined } from '@ant-design/icons';
import { Block, Center } from '@lobehub/ui';
-import { Spin } from 'antd';
-import { memo } from 'react';
+import React, { memo } from 'react';
+import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
import { AsyncTaskStatus } from '@/types/asyncTask';
import { ActionButtons } from './ActionButtons';
@@ -31,8 +30,9 @@ export const LoadingState = memo<LoadingStateProps>(
maxWidth: getThumbnailMaxWidth(generation, generationBatch),
}}
>
- <Center gap={8}>
- <Spin indicator={<LoadingOutlined spin />} />
+ <div className={styles.placeholderContainer} />
+ <Center gap={8} style={{ zIndex: 2 }}>
+ <NeuralNetworkLoading size={48} />
<ElapsedTime generationId={generation.id} isActive={isGenerating} />
</Center>
<ActionButtons onDelete={onDelete} />
diff --git a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/SuccessState.tsx b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/SuccessState.tsx
similarity index 100%
rename from src/routes/(main)/image/features/GenerationFeed/GenerationItem/SuccessState.tsx
rename to src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/SuccessState.tsx
diff --git a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/index.tsx b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/index.tsx
similarity index 100%
rename from src/routes/(main)/image/features/GenerationFeed/GenerationItem/index.tsx
rename to src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/index.tsx
diff --git a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/styles.ts b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/styles.ts
similarity index 66%
rename from src/routes/(main)/image/features/GenerationFeed/GenerationItem/styles.ts
rename to src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/styles.ts
index 5f68e389ff3..3529e65c9c2 100644
--- a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/styles.ts
+++ b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/styles.ts
@@ -1,4 +1,16 @@
-import { createStaticStyles, cx } from 'antd-style';
+import { createStaticStyles, cx, keyframes } from 'antd-style';
+
+const shimmer = keyframes`
+ 0% {
+ opacity: 1;
+ }
+ 50% {
+ opacity: 0;
+ }
+ 100% {
+ opacity: 1;
+ }
+`;
export const styles = createStaticStyles(({ css, cssVar }) => ({
// Common styles for image action buttons
@@ -25,21 +37,24 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
opacity: 1;
}
`,
- loadingContent: css`
- display: flex;
- flex-direction: column;
- gap: 8px;
- align-items: center;
- justify-content: center;
-
- font-size: 12px;
- color: ${cssVar.colorTextTertiary};
- `,
+
placeholderContainer: css`
position: relative;
overflow: hidden;
width: 100%;
+ &::before {
+ content: '';
+
+ position: absolute;
+ z-index: 1;
+ inset: 0;
+
+ background: ${cssVar.colorFillSecondary};
+
+ animation: ${shimmer} 2s linear infinite;
+ }
+
&:hover .generation-actions {
opacity: 1;
}
diff --git a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/types.ts b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/types.ts
similarity index 100%
rename from src/routes/(main)/image/features/GenerationFeed/GenerationItem/types.ts
rename to src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/types.ts
diff --git a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/utils.test.ts b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/utils.test.ts
similarity index 98%
rename from src/routes/(main)/image/features/GenerationFeed/GenerationItem/utils.test.ts
rename to src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/utils.test.ts
index e5a3ae3fa15..bcf1783e5bd 100644
--- a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/utils.test.ts
+++ b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/utils.test.ts
@@ -475,7 +475,7 @@ describe('getThumbnailMaxWidth (isolated unit testing)', () => {
it('should return DEFAULT_MAX_ITEM_WIDTH when no dimensions available', () => {
const result = getThumbnailMaxWidth(mockGeneration, mockGenerationBatch);
- expect(result).toBe(DEFAULT_MAX_ITEM_WIDTH);
+ expect(result).toBe(DEFAULT_MAX_ITEM_WIDTH * 2);
});
it('should return DEFAULT_MAX_ITEM_WIDTH when width is missing', () => {
@@ -484,7 +484,7 @@ describe('getThumbnailMaxWidth (isolated unit testing)', () => {
// No asset with width/height, should fall back to default
};
const result = getThumbnailMaxWidth(mockGen);
- expect(result).toBe(DEFAULT_MAX_ITEM_WIDTH);
+ expect(result).toBe(DEFAULT_MAX_ITEM_WIDTH * 2);
});
it('should return DEFAULT_MAX_ITEM_WIDTH when height is missing', () => {
@@ -493,7 +493,7 @@ describe('getThumbnailMaxWidth (isolated unit testing)', () => {
// No asset with valid dimensions
};
const result = getThumbnailMaxWidth(mockGen);
- expect(result).toBe(DEFAULT_MAX_ITEM_WIDTH);
+ expect(result).toBe(DEFAULT_MAX_ITEM_WIDTH * 2);
});
it('should calculate width based on screen height constraint', () => {
@@ -512,7 +512,7 @@ describe('getThumbnailMaxWidth (isolated unit testing)', () => {
// maxReasonableWidth = 200 * 2 = 400
// min(600, 400) = 400
const result = getThumbnailMaxWidth(mockGen);
- expect(result).toBe(400);
+ expect(result).toBe(512);
});
it('should apply maxReasonableWidth limit', () => {
@@ -531,7 +531,7 @@ describe('getThumbnailMaxWidth (isolated unit testing)', () => {
// maxReasonableWidth = 200 * 2 = 400
// min(1200, 400) = 400
const result = getThumbnailMaxWidth(mockGen);
- expect(result).toBe(400);
+ expect(result).toBe(512);
});
it('should use screen height constraint when smaller', () => {
@@ -576,7 +576,7 @@ describe('getThumbnailMaxWidth (isolated unit testing)', () => {
// maxReasonableWidth = 200 * 2 = 400
// min(600, 400) = 400
const result = getThumbnailMaxWidth(mockGen);
- expect(result).toBe(400);
+ expect(result).toBe(512);
});
it('should round calculated width correctly', () => {
diff --git a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/utils.ts b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/utils.ts
similarity index 97%
rename from src/routes/(main)/image/features/GenerationFeed/GenerationItem/utils.ts
rename to src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/utils.ts
index 74569ecb37a..823d2b14482 100644
--- a/src/routes/(main)/image/features/GenerationFeed/GenerationItem/utils.ts
+++ b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/utils.ts
@@ -1,7 +1,7 @@
import { type Generation, type GenerationBatch } from '@/types/generation';
// Default maximum width for image items
-export const DEFAULT_MAX_ITEM_WIDTH = 200;
+export const DEFAULT_MAX_ITEM_WIDTH = 256;
/**
* Get image dimensions from various sources
@@ -113,7 +113,7 @@ export const getThumbnailMaxWidth = (
// Return default width if no dimension information is available
if (!dimensions.aspectRatio) {
- return DEFAULT_MAX_ITEM_WIDTH;
+ return DEFAULT_MAX_ITEM_WIDTH * 2;
}
// Parse aspect ratio string (format: "16 / 9")
diff --git a/src/routes/(main)/(create)/image/features/GenerationFeed/ReferenceImages.tsx b/src/routes/(main)/(create)/image/features/GenerationFeed/ReferenceImages.tsx
new file mode 100644
index 00000000000..efe199155c5
--- /dev/null
+++ b/src/routes/(main)/(create)/image/features/GenerationFeed/ReferenceImages.tsx
@@ -0,0 +1,85 @@
+'use client';
+
+import { ActionIcon, Flexbox, Image } from '@lobehub/ui';
+import { createStaticStyles } from 'antd-style';
+import { QuoteIcon } from 'lucide-react';
+import { memo } from 'react';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ container: css`
+ flex-shrink: 0;
+ width: 48px;
+ height: 48px;
+ margin-inline-start: -16px;
+ `,
+ image: css`
+ padding: 2px;
+ box-shadow: ${cssVar.boxShadowTertiary};
+
+ img {
+ border-radius: 6px;
+ }
+ `,
+ icon: css`
+ pointer-events: none;
+
+ z-index: 10;
+
+ border-radius: 50% !important;
+
+ color: ${cssVar.colorBgLayout};
+
+ background: ${cssVar.colorFill};
+ box-shadow: ${cssVar.boxShadowTertiary};
+ `,
+}));
+
+interface ReferenceImagesProps {
+ imageUrl?: string | null;
+ imageUrls?: string[];
+}
+
+export const ReferenceImages = memo<ReferenceImagesProps>(({ imageUrl, imageUrls }) => {
+ // Collect all images
+ const allImages: string[] = [];
+ if (imageUrl) {
+ allImages.push(imageUrl);
+ }
+ if (imageUrls && imageUrls.length > 0) {
+ allImages.push(...imageUrls);
+ }
+
+ // Don't render if no images
+ if (allImages.length === 0) {
+ return null;
+ }
+
+ return (
+ <Image.PreviewGroup>
+ <Flexbox horizontal align={'flex-end'} flex={'none'} wrap="wrap">
+ <ActionIcon
+ glass
+ className={styles.icon}
+ icon={QuoteIcon}
+ size={'small'}
+ variant={'filled'}
+ />
+ {allImages.map((url, index) => (
+ <div className={styles.container} key={`${url}-${index}`}>
+ <Image
+ alt={`Reference image ${index + 1}`}
+ className={styles.image}
+ height={'100%'}
+ src={url}
+ style={{ height: '100%', width: '100%' }}
+ variant={'outlined'}
+ width={'100%'}
+ />
+ </div>
+ ))}
+ </Flexbox>
+ </Image.PreviewGroup>
+ );
+});
+
+ReferenceImages.displayName = 'ReferenceImages';
diff --git a/src/routes/(main)/(create)/image/features/GenerationFeed/index.tsx b/src/routes/(main)/(create)/image/features/GenerationFeed/index.tsx
new file mode 100644
index 00000000000..963b2568f68
--- /dev/null
+++ b/src/routes/(main)/(create)/image/features/GenerationFeed/index.tsx
@@ -0,0 +1,24 @@
+'use client';
+
+import { memo } from 'react';
+
+import GenerationFeed from '@/routes/(main)/(create)/features/GenerationFeed';
+import { useImageStore } from '@/store/image';
+import { generationBatchSelectors } from '@/store/image/selectors';
+
+import { GenerationBatchItem } from './BatchItem';
+
+const ImageGenerationFeed = memo(() => {
+ const currentGenerationBatches = useImageStore(generationBatchSelectors.currentGenerationBatches);
+
+ return (
+ <GenerationFeed
+ batches={currentGenerationBatches ?? []}
+ renderBatchItem={(batch) => <GenerationBatchItem batch={batch} key={batch.id} />}
+ />
+ );
+});
+
+ImageGenerationFeed.displayName = 'ImageGenerationFeed';
+
+export default ImageGenerationFeed;
diff --git a/src/routes/(main)/image/features/ImageWorkspace/SkeletonList.tsx b/src/routes/(main)/(create)/image/features/ImageWorkspace/SkeletonList.tsx
similarity index 67%
rename from src/routes/(main)/image/features/ImageWorkspace/SkeletonList.tsx
rename to src/routes/(main)/(create)/image/features/ImageWorkspace/SkeletonList.tsx
index 1c0f5ceb52a..2313cd7dacc 100644
--- a/src/routes/(main)/image/features/ImageWorkspace/SkeletonList.tsx
+++ b/src/routes/(main)/(create)/image/features/ImageWorkspace/SkeletonList.tsx
@@ -3,9 +3,14 @@
import { Block, Center, Flexbox, Grid, Skeleton } from '@lobehub/ui';
import { memo } from 'react';
-import PromptInput from '@/routes/(main)/image/features/PromptInput';
+import PromptInput from '@/routes/(main)/(create)/image/features/PromptInput';
-const SkeletonList = memo(() => {
+interface SkeletonListProps {
+ /** 为 false 时由页面级输入框渲染,此处不渲染输入框(避免切换 topic 时双输入框闪现) */
+ embedInput?: boolean;
+}
+
+const SkeletonList = memo<SkeletonListProps>(({ embedInput = true }) => {
return (
<Flexbox style={{ minHeight: 'calc(100vh - 44px)' }}>
<Block variant={'borderless'}>
@@ -30,15 +35,17 @@ const SkeletonList = memo(() => {
</Flexbox>
</Block>
<div style={{ flex: 1 }} />
- <Center
- style={{
- bottom: 24,
- position: 'sticky',
- width: '100%',
- }}
- >
- <PromptInput disableAnimation={true} showTitle={false} />
- </Center>
+ {embedInput && (
+ <Center
+ style={{
+ bottom: 24,
+ position: 'sticky',
+ width: '100%',
+ }}
+ >
+ <PromptInput disableAnimation={true} showTitle={false} />
+ </Center>
+ )}
</Flexbox>
);
});
diff --git a/src/routes/(main)/(create)/image/features/ImageWorkspace/index.tsx b/src/routes/(main)/(create)/image/features/ImageWorkspace/index.tsx
new file mode 100644
index 00000000000..b0a87b4512d
--- /dev/null
+++ b/src/routes/(main)/(create)/image/features/ImageWorkspace/index.tsx
@@ -0,0 +1,31 @@
+'use client';
+
+import GenerationWorkspace from '@/routes/(main)/(create)/features/GenerationWorkspace';
+import { useImageStore } from '@/store/image';
+import { generationBatchSelectors, generationTopicSelectors } from '@/store/image/selectors';
+
+import GenerationFeed from '../GenerationFeed';
+import PromptInput from '../PromptInput';
+import SkeletonList from './SkeletonList';
+
+interface ImageWorkspaceProps {
+ /** 为 false 时由页面级固定底部输入框渲染,不在此处嵌入(与 agent 布局一致) */
+ embedInput?: boolean;
+}
+
+const ImageWorkspace = ({ embedInput = true }: ImageWorkspaceProps) => (
+ <GenerationWorkspace
+ GenerationFeed={GenerationFeed}
+ PromptInput={PromptInput}
+ SkeletonList={SkeletonList}
+ embedInput={embedInput}
+ useStore={useImageStore}
+ selectors={{
+ activeGenerationTopicId: generationTopicSelectors.activeGenerationTopicId,
+ currentGenerationBatches: generationBatchSelectors.currentGenerationBatches,
+ isCurrentGenerationTopicLoaded: generationBatchSelectors.isCurrentGenerationTopicLoaded,
+ }}
+ />
+);
+
+export default ImageWorkspace;
diff --git a/src/routes/(main)/(create)/image/features/PromptInput/Title.tsx b/src/routes/(main)/(create)/image/features/PromptInput/Title.tsx
new file mode 100644
index 00000000000..23f54953130
--- /dev/null
+++ b/src/routes/(main)/(create)/image/features/PromptInput/Title.tsx
@@ -0,0 +1,9 @@
+'use client';
+
+import { Palette } from 'lucide-react';
+
+import PromptTitle from '@/routes/(main)/(create)/components/PromptTitle';
+
+const ImagePromptTitle = () => <PromptTitle icon={Palette} namespace="image" />;
+
+export default ImagePromptTitle;
diff --git a/src/routes/(main)/(create)/image/features/PromptInput/index.tsx b/src/routes/(main)/(create)/image/features/PromptInput/index.tsx
new file mode 100644
index 00000000000..2c28ca07389
--- /dev/null
+++ b/src/routes/(main)/(create)/image/features/PromptInput/index.tsx
@@ -0,0 +1,314 @@
+'use client';
+
+import { ModelIcon } from '@lobehub/icons';
+import { Center, Flexbox, Text } from '@lobehub/ui';
+import { createStaticStyles, cx } from 'antd-style';
+import { Images } from 'lucide-react';
+import { useCallback, useEffect, useMemo, useRef } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { loginRequired } from '@/components/Error/loginRequiredNotification';
+import Action from '@/features/ChatInput/ActionBar/components/Action';
+import ModelSwitchPanel from '@/features/ModelSwitchPanel';
+import { useFetchAiImageConfig } from '@/hooks/useFetchAiImageConfig';
+import { useIsDark } from '@/hooks/useIsDark';
+import { useQueryState } from '@/hooks/useQueryParam';
+import {
+ ConfigAction,
+ GenerationPromptInput,
+ InlineImageReference,
+} from '@/routes/(main)/(create)/features/GenerationInput';
+import {
+ CfgSliderInput,
+ DimensionControlGroup,
+ ImageNum,
+ QualitySelect,
+ ResolutionSelect,
+ SeedNumberInput,
+ SizeSelect,
+ StepsSliderInput,
+ useAutoDimensions,
+} from '@/routes/(main)/(create)/image/features/ConfigPanel';
+import ImageModelItem from '@/routes/(main)/(create)/image/features/ConfigPanel/components/ModelSelect/ImageModelItem';
+import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
+import { useImageStore } from '@/store/image';
+import { createImageSelectors, imageGenerationConfigSelectors } from '@/store/image/selectors';
+import {
+ useDimensionControl,
+ useGenerationConfigParam,
+} from '@/store/image/slices/generationConfig/hooks';
+import { useUserStore } from '@/store/user';
+import { authSelectors } from '@/store/user/slices/auth/selectors';
+
+import PromptTitle from './Title';
+
+const triggerStyles = createStaticStyles(({ css, cssVar }) => ({
+ icon: cx(
+ 'model-switch',
+ css`
+ transition: scale 400ms cubic-bezier(0.215, 0.61, 0.355, 1);
+ `,
+ ),
+ model: css`
+ cursor: pointer;
+ border-radius: 24px;
+
+ :hover {
+ background: ${cssVar.colorFillSecondary};
+ }
+
+ :active {
+ .model-switch {
+ scale: 0.8;
+ }
+ }
+ `,
+}));
+
+interface PromptInputProps {
+ disableAnimation?: boolean;
+ showTitle?: boolean;
+}
+
+const isSupportedParamSelector = imageGenerationConfigSelectors.isSupportedParam;
+
+const PromptInput = ({ showTitle = false }: PromptInputProps) => {
+ const isDarkMode = useIsDark();
+ const { t } = useTranslation('image');
+ const { value, setValue } = useGenerationConfigParam('prompt');
+ const { value: imageUrl, setValue: setImageUrl } = useGenerationConfigParam('imageUrl');
+ const {
+ value: imageUrls,
+ setValue: setImageUrls,
+ maxCount: imageUrlsMaxCount,
+ maxFileSize: imageUrlsMaxFileSize,
+ } = useGenerationConfigParam('imageUrls');
+ const { maxFileSize: imageUrlMaxFileSize } = useGenerationConfigParam('imageUrl');
+ const isCreating = useImageStore(createImageSelectors.isCreating);
+ const createImage = useImageStore((s) => s.createImage);
+ const setModelAndProviderOnSelect = useImageStore((s) => s.setModelAndProviderOnSelect);
+ const currentModel = useImageStore(imageGenerationConfigSelectors.model);
+ const currentProvider = useImageStore(imageGenerationConfigSelectors.provider);
+ const isInit = useImageStore((s) => s.isInit);
+ const isSupportImageUrl = useImageStore(isSupportedParamSelector('imageUrl'));
+ const isSupportImageUrls = useImageStore(isSupportedParamSelector('imageUrls'));
+ const isSupportQuality = useImageStore(isSupportedParamSelector('quality'));
+ const isSupportResolution = useImageStore(isSupportedParamSelector('resolution'));
+ const isSupportSize = useImageStore(isSupportedParamSelector('size'));
+ const isSupportSeed = useImageStore(isSupportedParamSelector('seed'));
+ const isSupportSteps = useImageStore(isSupportedParamSelector('steps'));
+ const isSupportCfg = useImageStore(isSupportedParamSelector('cfg'));
+ const isLogin = useUserStore(authSelectors.isLogin);
+ const enabledImageModelList = useAiInfraStore(aiProviderSelectors.enabledImageModelList);
+ const { showDimensionControl } = useDimensionControl();
+ const { autoSetDimensions, extractUrlAndDimensions } = useAutoDimensions();
+
+ useFetchAiImageConfig();
+
+ const [promptParam, setPromptParam] = useQueryState('prompt');
+ const [modelParam, setModelParam] = useQueryState('model');
+ const hasProcessedPrompt = useRef(false);
+ const hasProcessedModel = useRef(false);
+
+ const handleGenerate = async () => {
+ if (!isLogin) {
+ loginRequired.redirect({ timeout: 2000 });
+ return;
+ }
+
+ await createImage();
+ };
+
+ useEffect(() => {
+ if (modelParam && !hasProcessedModel.current && isInit) {
+ const targetModel = modelParam;
+
+ for (const providerGroup of enabledImageModelList) {
+ const found = providerGroup.children.some((m) => m.id === targetModel);
+ if (found) {
+ setModelAndProviderOnSelect(targetModel, providerGroup.id);
+ break;
+ }
+ }
+
+ hasProcessedModel.current = true;
+ setModelParam(null);
+ }
+ }, [modelParam, isInit, enabledImageModelList, setModelAndProviderOnSelect, setModelParam]);
+
+ useEffect(() => {
+ if (promptParam && !hasProcessedPrompt.current && isLogin) {
+ const decodedPrompt = decodeURIComponent(promptParam);
+ setValue(decodedPrompt);
+ hasProcessedPrompt.current = true;
+ setPromptParam(null);
+
+ setTimeout(async () => {
+ await createImage();
+ }, 100);
+ }
+ }, [promptParam, isLogin, setValue, setPromptParam, createImage]);
+
+ const imagePreviewUrls = useMemo(
+ () => [imageUrl, ...(imageUrls ?? [])].filter(Boolean) as string[],
+ [imageUrl, imageUrls],
+ );
+
+ const handleAddImage = useCallback(
+ (data: string | { dimensions?: { height: number; width: number }; url: string }) => {
+ const { url, dimensions } = extractUrlAndDimensions(data);
+ if (!url) return;
+
+ if (dimensions) {
+ autoSetDimensions(dimensions);
+ }
+
+ if (isSupportImageUrl && !imageUrl) {
+ setImageUrl(url);
+ } else if (isSupportImageUrls) {
+ setImageUrls([...(imageUrls ?? []), url] as any);
+ } else if (isSupportImageUrl) {
+ setImageUrl(url);
+ }
+ },
+ [
+ isSupportImageUrl,
+ isSupportImageUrls,
+ imageUrl,
+ imageUrls,
+ setImageUrl,
+ setImageUrls,
+ autoSetDimensions,
+ extractUrlAndDimensions,
+ ],
+ );
+
+ const handleRemoveImage = useCallback(
+ (url: string) => {
+ if (url === imageUrl) {
+ setImageUrl(null);
+ } else {
+ setImageUrls((imageUrls ?? []).filter((item) => item !== url) as any);
+ }
+ },
+ [imageUrl, imageUrls, setImageUrl, setImageUrls],
+ );
+
+ const showInlineRef = isSupportImageUrl || isSupportImageUrls;
+ const hasRefImages = imagePreviewUrls.length > 0;
+
+ const maxCount = useMemo(() => {
+ let count = 0;
+ if (isSupportImageUrl) count += 1;
+ if (isSupportImageUrls) count += imageUrlsMaxCount ?? 4;
+ return count;
+ }, [isSupportImageUrl, isSupportImageUrls, imageUrlsMaxCount]);
+
+ return (
+ <Flexbox gap={32} width={'100%'}>
+ {showTitle && <PromptTitle />}
+ <GenerationPromptInput
+ disableGenerate={!isInit}
+ generateLabel={t('generation.actions.generate')}
+ generatingLabel={t('generation.status.generating')}
+ isCreating={isCreating}
+ isDarkMode={isDarkMode}
+ value={value}
+ inlineContent={
+ showInlineRef ? (
+ <InlineImageReference
+ images={imagePreviewUrls}
+ maxCount={maxCount}
+ maxFileSize={imageUrlsMaxFileSize ?? imageUrlMaxFileSize}
+ onAdd={handleAddImage}
+ onRemove={handleRemoveImage}
+ />
+ ) : undefined
+ }
+ leftActions={
+ <Flexbox horizontal align={'center'} gap={4}>
+ <ModelSwitchPanel
+ ModelItemComponent={ImageModelItem}
+ enabledList={enabledImageModelList}
+ model={currentModel ?? undefined}
+ openOnHover={false}
+ placement="topLeft"
+ pricingMode="image"
+ provider={currentProvider ?? undefined}
+ onModelChange={async ({ model, provider }) => {
+ setModelAndProviderOnSelect(model, provider);
+ }}
+ >
+ <Center className={triggerStyles.model} height={36} width={36}>
+ <div className={triggerStyles.icon}>
+ <ModelIcon model={currentModel ?? ''} size={22} />
+ </div>
+ </Center>
+ </ModelSwitchPanel>
+ <ConfigAction
+ title={t('config.title', { defaultValue: 'Config' })}
+ content={
+ <Flexbox gap={12}>
+ {isSupportQuality && (
+ <Flexbox gap={6}>
+ <Text fontSize={12}>{t('config.quality.label')}</Text>
+ <QualitySelect />
+ </Flexbox>
+ )}
+ {isSupportResolution && (
+ <Flexbox gap={6}>
+ <Text fontSize={12}>{t('config.resolution.label')}</Text>
+ <ResolutionSelect />
+ </Flexbox>
+ )}
+ {isSupportSize && (
+ <Flexbox gap={6}>
+ <Text fontSize={12}>{t('config.size.label')}</Text>
+ <SizeSelect />
+ </Flexbox>
+ )}
+ {showDimensionControl && <DimensionControlGroup />}
+ {isSupportSteps && (
+ <Flexbox gap={6}>
+ <Text fontSize={12}>{t('config.steps.label')}</Text>
+ <StepsSliderInput />
+ </Flexbox>
+ )}
+ {isSupportCfg && (
+ <Flexbox gap={6}>
+ <Text fontSize={12}>{t('config.cfg.label')}</Text>
+ <CfgSliderInput />
+ </Flexbox>
+ )}
+ {isSupportSeed && (
+ <Flexbox gap={6}>
+ <Text fontSize={12}>{t('config.seed.label')}</Text>
+ <SeedNumberInput />
+ </Flexbox>
+ )}
+ </Flexbox>
+ }
+ />
+ <Action
+ icon={Images}
+ title={t('config.imageNum.label')}
+ trigger={'click'}
+ popover={{
+ content: <ImageNum />,
+ minWidth: 220,
+ title: t('config.imageNum.label'),
+ }}
+ />
+ </Flexbox>
+ }
+ placeholder={
+ hasRefImages ? t('config.prompt.placeholderWithRef') : t('config.prompt.placeholder')
+ }
+ onGenerate={handleGenerate}
+ onValueChange={setValue}
+ />
+ </Flexbox>
+ );
+};
+
+export default PromptInput;
diff --git a/src/routes/(main)/(create)/image/index.tsx b/src/routes/(main)/(create)/image/index.tsx
new file mode 100644
index 00000000000..7b7b55dc80e
--- /dev/null
+++ b/src/routes/(main)/(create)/image/index.tsx
@@ -0,0 +1,16 @@
+'use client';
+
+import { memo } from 'react';
+
+import CreateGenerationPage from '@/routes/(main)/(create)/features/CreateGenerationPage';
+
+import ImageWorkspace from './features/ImageWorkspace';
+import PromptInput from './features/PromptInput';
+
+const DesktopImagePage = memo(() => (
+ <CreateGenerationPage PromptInput={PromptInput} Workspace={ImageWorkspace} path="/image" />
+));
+
+DesktopImagePage.displayName = 'DesktopImagePage';
+
+export default DesktopImagePage;
diff --git a/src/routes/(main)/image/loading.tsx b/src/routes/(main)/(create)/image/loading.tsx
similarity index 100%
rename from src/routes/(main)/image/loading.tsx
rename to src/routes/(main)/(create)/image/loading.tsx
diff --git a/src/routes/(main)/(create)/video/_layout/index.tsx b/src/routes/(main)/(create)/video/_layout/index.tsx
new file mode 100644
index 00000000000..d9b338f06bd
--- /dev/null
+++ b/src/routes/(main)/(create)/video/_layout/index.tsx
@@ -0,0 +1,24 @@
+'use client';
+
+import { useTranslation } from 'react-i18next';
+
+import GenerationLayout from '@/routes/(main)/(create)/features/GenerationLayout';
+import { useVideoStore } from '@/store/video';
+import { generationTopicSelectors } from '@/store/video/slices/generationTopic/selectors';
+
+const VideoLayout = () => {
+ const { t } = useTranslation(['common']);
+
+ return (
+ <GenerationLayout
+ breadcrumb={[{ href: '/video', title: t('tab.video') }]}
+ generationTopicsSelector={generationTopicSelectors.generationTopics}
+ namespace="video"
+ navKey="video"
+ useStore={useVideoStore}
+ viewModeStatusKey="videoTopicViewMode"
+ />
+ );
+};
+
+export default VideoLayout;
diff --git a/src/routes/(main)/video/_layout/ConfigPanel/VideoConfigSkeleton.tsx b/src/routes/(main)/(create)/video/features/ConfigPanel/VideoConfigSkeleton.tsx
similarity index 100%
rename from src/routes/(main)/video/_layout/ConfigPanel/VideoConfigSkeleton.tsx
rename to src/routes/(main)/(create)/video/features/ConfigPanel/VideoConfigSkeleton.tsx
diff --git a/src/routes/(main)/video/_layout/ConfigPanel/components/FrameUpload.tsx b/src/routes/(main)/(create)/video/features/ConfigPanel/components/FrameUpload.tsx
similarity index 89%
rename from src/routes/(main)/video/_layout/ConfigPanel/components/FrameUpload.tsx
rename to src/routes/(main)/(create)/video/features/ConfigPanel/components/FrameUpload.tsx
index c07686eb1a7..d016a2476fb 100644
--- a/src/routes/(main)/video/_layout/ConfigPanel/components/FrameUpload.tsx
+++ b/src/routes/(main)/(create)/video/features/ConfigPanel/components/FrameUpload.tsx
@@ -1,6 +1,6 @@
import { memo } from 'react';
-import ImageUpload from '@/routes/(main)/image/_layout/ConfigPanel/components/ImageUpload';
+import { ImageUpload } from '@/routes/(main)/(create)/image/features/ConfigPanel';
import { useVideoGenerationConfigParam } from '@/store/video/slices/generationConfig/hooks';
interface FrameUploadProps {
diff --git a/src/routes/(main)/(create)/video/features/ConfigPanel/components/ModelSelect/VideoModelItem.tsx b/src/routes/(main)/(create)/video/features/ConfigPanel/components/ModelSelect/VideoModelItem.tsx
new file mode 100644
index 00000000000..46c05ad1292
--- /dev/null
+++ b/src/routes/(main)/(create)/video/features/ConfigPanel/components/ModelSelect/VideoModelItem.tsx
@@ -0,0 +1,15 @@
+import type { AiModelForSelect } from 'model-bank';
+
+import GenerationModelItem from '@/routes/(main)/(create)/components/GenerationModelItem';
+
+type VideoModelItemProps = AiModelForSelect & {
+ providerId?: string;
+ showBadge?: boolean;
+ showPopover?: boolean;
+};
+
+const VideoModelItem = (props: VideoModelItemProps) => (
+ <GenerationModelItem {...props} priceKind="video" showPrice={true} />
+);
+
+export default VideoModelItem;
diff --git a/src/routes/(main)/video/_layout/ConfigPanel/components/ModelSelect/index.tsx b/src/routes/(main)/(create)/video/features/ConfigPanel/components/ModelSelect/index.tsx
similarity index 91%
rename from src/routes/(main)/video/_layout/ConfigPanel/components/ModelSelect/index.tsx
rename to src/routes/(main)/(create)/video/features/ConfigPanel/components/ModelSelect/index.tsx
index 457a4c8e493..21bf88d0187 100644
--- a/src/routes/(main)/video/_layout/ConfigPanel/components/ModelSelect/index.tsx
+++ b/src/routes/(main)/(create)/video/features/ConfigPanel/components/ModelSelect/index.tsx
@@ -17,8 +17,18 @@ import VideoModelItem from './VideoModelItem';
const prefixCls = 'ant';
-const styles = createStaticStyles(({ css }) => ({
+const styles = createStaticStyles(({ css, cssVar }) => ({
popup: css`
+ &.${prefixCls}-select-dropdown .${prefixCls}-select-item-option {
+ margin-block: 1px;
+ margin-inline: 4px;
+ padding-block: 8px;
+ padding-inline: 8px;
+ border-radius: ${cssVar.borderRadiusSM};
+ }
+ &.${prefixCls}-select-dropdown .${prefixCls}-select-item-option-selected {
+ background: ${cssVar.colorFillTertiary};
+ }
&.${prefixCls}-select-dropdown .${prefixCls}-select-item-option-grouped {
padding-inline-start: 12px;
}
@@ -143,11 +153,9 @@ const ModelSelect = memo(() => {
shadow
labelRender={labelRender}
options={options}
+ popupClassName={styles.popup}
size={'large'}
value={currentProvider && currentModel ? `${currentProvider}/${currentModel}` : undefined}
- classNames={{
- root: styles.popup,
- }}
style={{
width: '100%',
}}
diff --git a/src/routes/(main)/(create)/video/features/ConfigPanel/index.ts b/src/routes/(main)/(create)/video/features/ConfigPanel/index.ts
new file mode 100644
index 00000000000..e7a745a354f
--- /dev/null
+++ b/src/routes/(main)/(create)/video/features/ConfigPanel/index.ts
@@ -0,0 +1,2 @@
+export { default as FrameUpload } from '@/routes/(main)/(create)/video/features/ConfigPanel/components/FrameUpload';
+export { default as VideoModelItem } from '@/routes/(main)/(create)/video/features/ConfigPanel/components/ModelSelect/VideoModelItem';
diff --git a/src/routes/(main)/video/features/GenerationFeed/BatchItem.tsx b/src/routes/(main)/(create)/video/features/GenerationFeed/BatchItem.tsx
similarity index 54%
rename from src/routes/(main)/video/features/GenerationFeed/BatchItem.tsx
rename to src/routes/(main)/(create)/video/features/GenerationFeed/BatchItem.tsx
index cd5fc88a844..97636bb0700 100644
--- a/src/routes/(main)/video/features/GenerationFeed/BatchItem.tsx
+++ b/src/routes/(main)/(create)/video/features/GenerationFeed/BatchItem.tsx
@@ -1,15 +1,19 @@
'use client';
import { ModelTag } from '@lobehub/icons';
-import { Block, Flexbox, Markdown, Tag, Text } from '@lobehub/ui';
+import { ActionIconGroup, Block, Flexbox, Markdown, Tag, Text } from '@lobehub/ui';
import { App } from 'antd';
+import { createStaticStyles } from 'antd-style';
import dayjs from 'dayjs';
+import { CopyIcon, RotateCcwSquareIcon, Trash2 } from 'lucide-react';
+import { type RuntimeVideoGenParamsKeys, type RuntimeVideoGenParamsValue } from 'model-bank';
import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import useRenderBusinessVideoBatchItem from '@/business/client/hooks/useRenderBusinessVideoBatchItem';
+import { GenerationInvalidAPIKey } from '@/routes/(main)/(create)/features/GenerationInput';
import { useVideoStore } from '@/store/video';
-import { AsyncTaskStatus } from '@/types/asyncTask';
+import { AsyncTaskErrorType, AsyncTaskStatus } from '@/types/asyncTask';
import type { GenerationBatch } from '@/types/generation';
import { downloadFile } from '@/utils/client/downloadFile';
@@ -18,15 +22,35 @@ import VideoLoadingItem from './VideoLoadingItem';
import VideoReferenceFrames from './VideoReferenceFrames';
import VideoSuccessItem from './VideoSuccessItem';
+const styles = createStaticStyles(({ css, cssVar, cx }) => ({
+ batchActions: cx(
+ 'batch-actions',
+ css`
+ opacity: 0;
+ transition: opacity 0.1s ${cssVar.motionEaseInOut};
+ `,
+ ),
+ container: css`
+ &:hover {
+ .batch-actions {
+ opacity: 1;
+ }
+ }
+ `,
+}));
+
interface VideoGenerationBatchItemProps {
batch: GenerationBatch;
}
export const VideoGenerationBatchItem = memo<VideoGenerationBatchItemProps>(({ batch }) => {
const { message } = App.useApp();
- const { t } = useTranslation('video');
+ const { t } = useTranslation(['video', 'image']);
const useCheckGenerationStatus = useVideoStore((s) => s.useCheckGenerationStatus);
const removeGeneration = useVideoStore((s) => s.removeGeneration);
+ const removeGenerationBatch = useVideoStore((s) => s.removeGenerationBatch);
+ const setModelAndProviderOnSelect = useVideoStore((s) => s.setModelAndProviderOnSelect);
+ const setParamOnInput = useVideoStore((s) => s.setParamOnInput);
const activeTopicId = useVideoStore((s) => s.activeGenerationTopicId);
const { shouldRenderBusinessBatchItem, businessBatchItem } =
useRenderBusinessVideoBatchItem(batch);
@@ -49,7 +73,8 @@ export const VideoGenerationBatchItem = memo<VideoGenerationBatchItemProps>(({ b
);
const handleDelete = useCallback(async () => {
- if (!generation) return;
+ if (!generation?.id) return;
+
try {
await removeGeneration(generation.id);
} catch (error) {
@@ -57,6 +82,38 @@ export const VideoGenerationBatchItem = memo<VideoGenerationBatchItemProps>(({ b
}
}, [removeGeneration, generation?.id]);
+ const handleCopyPrompt = useCallback(async () => {
+ try {
+ await navigator.clipboard.writeText(batch.prompt);
+ message.success(t('generation.actions.promptCopied', { ns: 'image' }));
+ } catch (error) {
+ console.error('Failed to copy prompt:', error);
+ message.error(t('generation.actions.promptCopyFailed', { ns: 'image' }));
+ }
+ }, [batch.prompt, message, t]);
+
+ const handleReuseSettings = useCallback(() => {
+ setModelAndProviderOnSelect(batch.model, batch.provider);
+
+ if (!batch.config) return;
+
+ for (const [paramName, value] of Object.entries(batch.config)) {
+ if (value === undefined) continue;
+
+ setParamOnInput(paramName as RuntimeVideoGenParamsKeys, value as RuntimeVideoGenParamsValue);
+ }
+ }, [batch.config, batch.model, batch.provider, setModelAndProviderOnSelect, setParamOnInput]);
+
+ const handleDeleteBatch = useCallback(async () => {
+ if (!activeTopicId) return;
+
+ try {
+ await removeGenerationBatch(batch.id, activeTopicId);
+ } catch (error) {
+ console.error('Failed to delete batch:', error);
+ }
+ }, [activeTopicId, batch.id, removeGenerationBatch]);
+
const handleDownload = useCallback(async () => {
if (!generation?.asset?.url) return;
@@ -112,6 +169,20 @@ export const VideoGenerationBatchItem = memo<VideoGenerationBatchItemProps>(({ b
return businessBatchItem;
}
+ const isInvalidApiKey = generation.task.error?.name === AsyncTaskErrorType.InvalidProviderAPIKey;
+
+ if (isInvalidApiKey) {
+ return (
+ <GenerationInvalidAPIKey
+ provider={batch.provider}
+ onNavigate={() => {
+ if (!activeTopicId) return;
+ removeGenerationBatch(batch.id, activeTopicId);
+ }}
+ />
+ );
+ }
+
const renderContent = () => {
if (generation.task.status === AsyncTaskStatus.Success && generation.asset?.url) {
return (
@@ -126,7 +197,7 @@ export const VideoGenerationBatchItem = memo<VideoGenerationBatchItemProps>(({ b
if (generation.task.status === AsyncTaskStatus.Error) {
return (
<VideoErrorItem
- aspectRatio={batch.config?.aspectRatio}
+ aspectRatio={displayAspectRatio}
generation={generation}
onCopyError={handleCopyError}
onDelete={handleDelete}
@@ -136,7 +207,7 @@ export const VideoGenerationBatchItem = memo<VideoGenerationBatchItemProps>(({ b
return (
<VideoLoadingItem
- aspectRatio={batch.config?.aspectRatio}
+ aspectRatio={displayAspectRatio}
avgLatencyMs={batch.avgLatencyMs}
generation={generation}
/>
@@ -145,36 +216,55 @@ export const VideoGenerationBatchItem = memo<VideoGenerationBatchItemProps>(({ b
const hasReferenceFrames = batch.config?.imageUrl || batch.config?.endImageUrl;
- const promptAndMetadata = (
- <>
- <Markdown variant={'chat'}>{batch.prompt}</Markdown>
- <Flexbox horizontal gap={4} style={{ marginBottom: 10 }}>
- <ModelTag model={batch.model} />
- {batch.config?.resolution && <Tag>{batch.config.resolution}</Tag>}
- {displayAspectRatio && <Tag>{displayAspectRatio}</Tag>}
- </Flexbox>
- </>
- );
-
return (
- <Block gap={8} variant={'borderless'}>
- {hasReferenceFrames ? (
- <Flexbox horizontal align={'center'} gap={16}>
+ <Block className={styles.container} gap={8} variant={'borderless'}>
+ <Flexbox horizontal align={'flex-start'} gap={16}>
+ {hasReferenceFrames && (
<VideoReferenceFrames
endImageUrl={batch.config?.endImageUrl}
imageUrl={batch.config?.imageUrl}
/>
- <Flexbox flex={1} gap={8}>
- {promptAndMetadata}
- </Flexbox>
- </Flexbox>
- ) : (
- promptAndMetadata
- )}
+ )}
+ <Markdown variant={'chat'}>{batch.prompt}</Markdown>
+ </Flexbox>
{renderContent()}
- <Text as={'time'} fontSize={12} type={'secondary'}>
- {time}
- </Text>
+ <Flexbox horizontal gap={4} style={{ opacity: 0.66 }}>
+ <ModelTag model={batch.model} variant={'borderless'} />
+ {batch.config?.resolution && <Tag variant={'borderless'}>{batch.config.resolution}</Tag>}
+ </Flexbox>
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={styles.batchActions}
+ justify={'space-between'}
+ >
+ <ActionIconGroup
+ items={[
+ {
+ icon: RotateCcwSquareIcon,
+ key: 'reuseSettings',
+ label: t('generation.actions.reuseSettings', { ns: 'image' }),
+ onClick: handleReuseSettings,
+ },
+ {
+ icon: CopyIcon,
+ key: 'copyPrompt',
+ label: t('generation.actions.copyPrompt', { ns: 'image' }),
+ onClick: handleCopyPrompt,
+ },
+ {
+ danger: true,
+ icon: Trash2,
+ key: 'deleteBatch',
+ label: t('generation.actions.deleteBatch', { ns: 'image' }),
+ onClick: handleDeleteBatch,
+ },
+ ]}
+ />
+ <Text as={'time'} fontSize={12} type={'secondary'}>
+ {time}
+ </Text>
+ </Flexbox>
</Block>
);
});
diff --git a/src/routes/(main)/video/features/GenerationFeed/VideoErrorItem.tsx b/src/routes/(main)/(create)/video/features/GenerationFeed/VideoErrorItem.tsx
similarity index 93%
rename from src/routes/(main)/video/features/GenerationFeed/VideoErrorItem.tsx
rename to src/routes/(main)/(create)/video/features/GenerationFeed/VideoErrorItem.tsx
index 0ea568326c7..f2246cbd55e 100644
--- a/src/routes/(main)/video/features/GenerationFeed/VideoErrorItem.tsx
+++ b/src/routes/(main)/(create)/video/features/GenerationFeed/VideoErrorItem.tsx
@@ -7,8 +7,8 @@ import { VideoOffIcon } from 'lucide-react';
import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
-import { ActionButtons } from '@/routes/(main)/image/features/GenerationFeed/GenerationItem/ActionButtons';
-import { styles } from '@/routes/(main)/image/features/GenerationFeed/GenerationItem/styles';
+import { ActionButtons } from '@/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ActionButtons';
+import { styles } from '@/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/styles';
import type { Generation } from '@/types/generation';
interface VideoErrorItemProps {
diff --git a/src/routes/(main)/video/features/GenerationFeed/VideoLoadingItem.tsx b/src/routes/(main)/(create)/video/features/GenerationFeed/VideoLoadingItem.tsx
similarity index 95%
rename from src/routes/(main)/video/features/GenerationFeed/VideoLoadingItem.tsx
rename to src/routes/(main)/(create)/video/features/GenerationFeed/VideoLoadingItem.tsx
index 580d8e1e20b..08f80b56043 100644
--- a/src/routes/(main)/video/features/GenerationFeed/VideoLoadingItem.tsx
+++ b/src/routes/(main)/(create)/video/features/GenerationFeed/VideoLoadingItem.tsx
@@ -5,7 +5,7 @@ import { Block, Center } from '@lobehub/ui';
import { Progress, Spin } from 'antd';
import { memo, useEffect, useState } from 'react';
-import { ElapsedTime } from '@/routes/(main)/image/features/GenerationFeed/GenerationItem/ElapsedTime';
+import { ElapsedTime } from '@/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ElapsedTime';
import { AsyncTaskStatus } from '@/types/asyncTask';
import type { Generation } from '@/types/generation';
diff --git a/src/routes/(main)/(create)/video/features/GenerationFeed/VideoReferenceFrames.tsx b/src/routes/(main)/(create)/video/features/GenerationFeed/VideoReferenceFrames.tsx
new file mode 100644
index 00000000000..7b26c846e69
--- /dev/null
+++ b/src/routes/(main)/(create)/video/features/GenerationFeed/VideoReferenceFrames.tsx
@@ -0,0 +1,79 @@
+'use client';
+
+import { ActionIcon, Flexbox, Image } from '@lobehub/ui';
+import { createStaticStyles } from 'antd-style';
+import { QuoteIcon } from 'lucide-react';
+import { memo } from 'react';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ container: css`
+ flex-shrink: 0;
+ width: 48px;
+ height: 48px;
+ margin-inline-start: -16px;
+ `,
+ image: css`
+ padding: 2px;
+ box-shadow: ${cssVar.boxShadowTertiary};
+
+ img {
+ border-radius: 6px;
+ }
+ `,
+ icon: css`
+ pointer-events: none;
+
+ z-index: 10;
+
+ border-radius: 50% !important;
+
+ color: ${cssVar.colorBgLayout};
+
+ background: ${cssVar.colorFill};
+ box-shadow: ${cssVar.boxShadowTertiary};
+ `,
+}));
+
+interface VideoReferenceFramesProps {
+ endImageUrl?: string | null;
+ imageUrl?: string | null;
+}
+
+const VideoReferenceFrames = memo<VideoReferenceFramesProps>(({ imageUrl, endImageUrl }) => {
+ const allImages: string[] = [];
+ if (imageUrl) allImages.push(imageUrl);
+ if (endImageUrl) allImages.push(endImageUrl);
+
+ if (allImages.length === 0) return null;
+
+ return (
+ <Image.PreviewGroup>
+ <Flexbox horizontal align={'flex-end'} flex={'none'} wrap="wrap">
+ <ActionIcon
+ glass
+ className={styles.icon}
+ icon={QuoteIcon}
+ size={'small'}
+ variant={'filled'}
+ />
+ {allImages.map((url, index) => (
+ <div className={styles.container} key={`${url}-${index}`}>
+ <Image
+ alt={index === 0 ? 'Start frame' : 'End frame'}
+ className={styles.image}
+ height={'100%'}
+ src={url}
+ style={{ height: '100%', width: '100%' }}
+ variant={'outlined'}
+ width={'100%'}
+ />
+ </div>
+ ))}
+ </Flexbox>
+ </Image.PreviewGroup>
+ );
+});
+
+VideoReferenceFrames.displayName = 'VideoReferenceFrames';
+
+export default VideoReferenceFrames;
diff --git a/src/routes/(main)/video/features/GenerationFeed/VideoSuccessItem.tsx b/src/routes/(main)/(create)/video/features/GenerationFeed/VideoSuccessItem.tsx
similarity index 81%
rename from src/routes/(main)/video/features/GenerationFeed/VideoSuccessItem.tsx
rename to src/routes/(main)/(create)/video/features/GenerationFeed/VideoSuccessItem.tsx
index fff5caee1da..bd352a424f9 100644
--- a/src/routes/(main)/video/features/GenerationFeed/VideoSuccessItem.tsx
+++ b/src/routes/(main)/(create)/video/features/GenerationFeed/VideoSuccessItem.tsx
@@ -3,8 +3,8 @@
import { Block } from '@lobehub/ui';
import { memo } from 'react';
-import { ActionButtons } from '@/routes/(main)/image/features/GenerationFeed/GenerationItem/ActionButtons';
-import { styles } from '@/routes/(main)/image/features/GenerationFeed/GenerationItem/styles';
+import { ActionButtons } from '@/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/ActionButtons';
+import { styles } from '@/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/styles';
import type { Generation, VideoGenerationAsset } from '@/types/generation';
interface VideoSuccessItemProps {
diff --git a/src/routes/(main)/(create)/video/features/GenerationFeed/index.tsx b/src/routes/(main)/(create)/video/features/GenerationFeed/index.tsx
new file mode 100644
index 00000000000..c26529d532d
--- /dev/null
+++ b/src/routes/(main)/(create)/video/features/GenerationFeed/index.tsx
@@ -0,0 +1,24 @@
+'use client';
+
+import { memo } from 'react';
+
+import GenerationFeed from '@/routes/(main)/(create)/features/GenerationFeed';
+import { useVideoStore } from '@/store/video';
+import { generationBatchSelectors } from '@/store/video/selectors';
+
+import { VideoGenerationBatchItem } from './BatchItem';
+
+const VideoGenerationFeed = memo(() => {
+ const currentGenerationBatches = useVideoStore(generationBatchSelectors.currentGenerationBatches);
+
+ return (
+ <GenerationFeed
+ batches={currentGenerationBatches ?? []}
+ renderBatchItem={(batch) => <VideoGenerationBatchItem batch={batch} key={batch.id} />}
+ />
+ );
+});
+
+VideoGenerationFeed.displayName = 'VideoGenerationFeed';
+
+export default VideoGenerationFeed;
diff --git a/src/routes/(main)/(create)/video/features/PromptInput/Title.tsx b/src/routes/(main)/(create)/video/features/PromptInput/Title.tsx
new file mode 100644
index 00000000000..9c9103fa23c
--- /dev/null
+++ b/src/routes/(main)/(create)/video/features/PromptInput/Title.tsx
@@ -0,0 +1,9 @@
+'use client';
+
+import { Video } from 'lucide-react';
+
+import PromptTitle from '@/routes/(main)/(create)/components/PromptTitle';
+
+const VideoPromptTitle = () => <PromptTitle icon={Video} namespace="video" />;
+
+export default VideoPromptTitle;
diff --git a/src/routes/(main)/(create)/video/features/PromptInput/index.tsx b/src/routes/(main)/(create)/video/features/PromptInput/index.tsx
new file mode 100644
index 00000000000..64977ca8418
--- /dev/null
+++ b/src/routes/(main)/(create)/video/features/PromptInput/index.tsx
@@ -0,0 +1,341 @@
+'use client';
+
+import { ModelIcon } from '@lobehub/icons';
+import { Center, Flexbox, InputNumber, Segmented, SliderWithInput, Text } from '@lobehub/ui';
+import { Divider, Switch } from 'antd';
+import { createStaticStyles, cx } from 'antd-style';
+import { Clock3, Dices } from 'lucide-react';
+import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import VideoFreeQuotaInfo from '@/business/client/features/VideoFreeQuotaInfo';
+import { loginRequired } from '@/components/Error/loginRequiredNotification';
+import Action from '@/features/ChatInput/ActionBar/components/Action';
+import ModelSwitchPanel from '@/features/ModelSwitchPanel';
+import { useFetchAiVideoConfig } from '@/hooks/useFetchAiVideoConfig';
+import { useIsDark } from '@/hooks/useIsDark';
+import { useQueryState } from '@/hooks/useQueryParam';
+import {
+ ConfigAction,
+ GenerationPromptInput,
+ InlineVideoFrames,
+} from '@/routes/(main)/(create)/features/GenerationInput';
+import { AspectRatioSelect } from '@/routes/(main)/(create)/image/features/ConfigPanel';
+import VideoModelItem from '@/routes/(main)/(create)/video/features/ConfigPanel/components/ModelSelect/VideoModelItem';
+import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
+import { useUserStore } from '@/store/user';
+import { authSelectors } from '@/store/user/slices/auth/selectors';
+import { useVideoStore } from '@/store/video';
+import { createVideoSelectors, videoGenerationConfigSelectors } from '@/store/video/selectors';
+import { useVideoGenerationConfigParam } from '@/store/video/slices/generationConfig/hooks';
+import { generateUniqueSeeds } from '@/utils/number';
+
+import PromptTitle from './Title';
+
+const triggerStyles = createStaticStyles(({ css, cssVar }) => ({
+ icon: cx(
+ 'model-switch',
+ css`
+ transition: scale 400ms cubic-bezier(0.215, 0.61, 0.355, 1);
+ `,
+ ),
+ model: css`
+ cursor: pointer;
+ border-radius: 24px;
+
+ :hover {
+ background: ${cssVar.colorFillSecondary};
+ }
+
+ :active {
+ .model-switch {
+ scale: 0.8;
+ }
+ }
+ `,
+}));
+
+interface PromptInputProps {
+ disableAnimation?: boolean;
+ showTitle?: boolean;
+}
+
+const isSupportedParamSelector = videoGenerationConfigSelectors.isSupportedParam;
+
+const AspectRatioItem = memo(() => {
+ const { value, setValue, enumValues } = useVideoGenerationConfigParam('aspectRatio');
+ const options = useMemo(
+ () => (enumValues ?? []).map((v) => ({ label: v, value: v })),
+ [enumValues],
+ );
+
+ if (options.length === 0) return null;
+
+ return <AspectRatioSelect options={options} value={value} onChange={(v) => setValue(v as any)} />;
+});
+
+const ResolutionItem = memo(() => {
+ const { value, setValue, enumValues } = useVideoGenerationConfigParam('resolution');
+ const options = useMemo(
+ () => (enumValues ?? []).map((v) => ({ label: v, value: v })),
+ [enumValues],
+ );
+
+ if (options.length === 0) return null;
+
+ return (
+ <Segmented
+ block
+ options={options}
+ style={{ width: '100%' }}
+ value={value}
+ variant="filled"
+ onChange={(v) => setValue(String(v) as any)}
+ />
+ );
+});
+
+const DurationItem = memo(() => {
+ const { value, setValue, min, max, step } = useVideoGenerationConfigParam('duration');
+
+ return (
+ <SliderWithInput
+ max={max}
+ min={min}
+ step={step ?? 1}
+ value={value ?? min}
+ onChange={(v) => setValue(v as any)}
+ />
+ );
+});
+
+const SeedItem = memo(() => {
+ const { t } = useTranslation('video');
+ const { value, setValue } = useVideoGenerationConfigParam('seed');
+
+ const handleRandomize = useCallback(() => {
+ setValue(generateUniqueSeeds(1)[0] as any);
+ }, [setValue]);
+
+ return (
+ <Flexbox horizontal gap={4}>
+ <InputNumber
+ min={0}
+ placeholder={t('config.seed.random')}
+ step={1}
+ style={{ width: '100%' }}
+ value={value}
+ onChange={(v) => setValue(v as any)}
+ />
+ <Action icon={Dices} title={t('config.seed.random')} onClick={handleRandomize} />
+ </Flexbox>
+ );
+});
+
+interface SwitchItemProps {
+ label: string;
+ paramName: 'cameraFixed' | 'generateAudio';
+}
+
+const SwitchItem = memo<SwitchItemProps>(({ label, paramName }) => {
+ const { value, setValue } = useVideoGenerationConfigParam(paramName);
+
+ return (
+ <Flexbox horizontal align="center" justify="space-between" padding={'0 2px'}>
+ <Text weight={500}>{label}</Text>
+ <Switch checked={!!value} onChange={(checked) => setValue(checked as any)} />
+ </Flexbox>
+ );
+});
+
+const PromptInput = ({ showTitle = false }: PromptInputProps) => {
+ const isDarkMode = useIsDark();
+ const { t } = useTranslation('video');
+ const { value, setValue } = useVideoGenerationConfigParam('prompt');
+ const { value: imageUrl, setValue: setImageUrl } = useVideoGenerationConfigParam('imageUrl');
+ const { value: endImageUrl, setValue: setEndImageUrl } =
+ useVideoGenerationConfigParam('endImageUrl');
+ const isCreating = useVideoStore(createVideoSelectors.isCreating);
+ const createVideo = useVideoStore((s) => s.createVideo);
+ const setModelAndProviderOnSelect = useVideoStore((s) => s.setModelAndProviderOnSelect);
+ const currentModel = useVideoStore(videoGenerationConfigSelectors.model);
+ const currentProvider = useVideoStore(videoGenerationConfigSelectors.provider);
+ const enabledVideoModelList = useAiInfraStore(aiProviderSelectors.enabledVideoModelList);
+ const isInit = useVideoStore((s) => s.isInit);
+ const isSupportImageUrl = useVideoStore(isSupportedParamSelector('imageUrl'));
+ const isSupportEndImageUrl = useVideoStore(isSupportedParamSelector('endImageUrl'));
+ const isSupportAspectRatio = useVideoStore(isSupportedParamSelector('aspectRatio'));
+ const isSupportResolution = useVideoStore(isSupportedParamSelector('resolution'));
+ const isSupportDuration = useVideoStore(isSupportedParamSelector('duration'));
+ const isSupportSeed = useVideoStore(isSupportedParamSelector('seed'));
+ const isSupportGenerateAudio = useVideoStore(isSupportedParamSelector('generateAudio'));
+ const isSupportCameraFixed = useVideoStore(isSupportedParamSelector('cameraFixed'));
+ const isLogin = useUserStore(authSelectors.isLogin);
+ const { value: duration } = useVideoGenerationConfigParam('duration');
+ useFetchAiVideoConfig();
+
+ // Read prompt from query parameter
+ const [promptParam, setPromptParam] = useQueryState('prompt');
+ const hasProcessedPrompt = useRef(false);
+
+ const handleGenerate = async () => {
+ if (!isLogin) {
+ loginRequired.redirect({ timeout: 2000 });
+ return;
+ }
+
+ await createVideo();
+ };
+
+ // Auto-fill and auto-send when prompt query parameter is present
+ useEffect(() => {
+ if (promptParam && !hasProcessedPrompt.current && isLogin) {
+ const decodedPrompt = decodeURIComponent(promptParam);
+
+ setValue(decodedPrompt);
+
+ hasProcessedPrompt.current = true;
+
+ setPromptParam(null);
+
+ setTimeout(async () => {
+ await createVideo();
+ }, 100);
+ }
+ }, [promptParam, isLogin, setValue, setPromptParam, createVideo]);
+
+ const showInlineFrames = isSupportImageUrl || isSupportEndImageUrl;
+ const hasRefImages = Boolean(imageUrl || endImageUrl);
+
+ const handleImageChange = useCallback(
+ (data: string | { dimensions?: { height: number; width: number }; url: string } | null) => {
+ if (data === null) {
+ setImageUrl(null as any);
+ return;
+ }
+ const url = typeof data === 'string' ? data : data?.url;
+ setImageUrl((url ?? null) as any);
+ },
+ [setImageUrl],
+ );
+
+ const handleEndImageChange = useCallback(
+ (data: string | { dimensions?: { height: number; width: number }; url: string } | null) => {
+ if (data === null) {
+ setEndImageUrl(null as any);
+ return;
+ }
+ const url = typeof data === 'string' ? data : data?.url;
+ setEndImageUrl((url ?? null) as any);
+ },
+ [setEndImageUrl],
+ );
+
+ return (
+ <Flexbox gap={32} width={'100%'}>
+ {showTitle && <PromptTitle />}
+ <Flexbox gap={8}>
+ <GenerationPromptInput
+ disableGenerate={!isInit}
+ generateLabel={t('generation.actions.generate')}
+ generatingLabel={t('generation.status.generating')}
+ isCreating={isCreating}
+ isDarkMode={isDarkMode}
+ value={value}
+ inlineContent={
+ showInlineFrames ? (
+ <InlineVideoFrames
+ endImageUrl={endImageUrl}
+ imageUrl={imageUrl}
+ isSupportEndImage={isSupportEndImageUrl}
+ onEndImageChange={handleEndImageChange}
+ onImageChange={handleImageChange}
+ />
+ ) : undefined
+ }
+ leftActions={
+ <Flexbox horizontal align={'center'} gap={4}>
+ <ModelSwitchPanel
+ ModelItemComponent={VideoModelItem}
+ enabledList={enabledVideoModelList}
+ model={currentModel ?? undefined}
+ openOnHover={false}
+ placement="topLeft"
+ pricingMode="video"
+ provider={currentProvider ?? undefined}
+ onModelChange={async ({ model, provider }) => {
+ setModelAndProviderOnSelect(model, provider);
+ }}
+ >
+ <Center className={triggerStyles.model} height={36} width={36}>
+ <div className={triggerStyles.icon}>
+ <ModelIcon model={currentModel ?? ''} size={22} />
+ </div>
+ </Center>
+ </ModelSwitchPanel>
+ <ConfigAction
+ title={t('config.title', { defaultValue: 'Config' })}
+ content={
+ <Flexbox gap={12}>
+ {isSupportAspectRatio && (
+ <Flexbox gap={6}>
+ <Text fontSize={12}>{t('config.aspectRatio.label')}</Text>
+ <AspectRatioItem />
+ </Flexbox>
+ )}
+ {isSupportResolution && (
+ <Flexbox gap={6}>
+ <Text fontSize={12}>{t('config.resolution.label')}</Text>
+ <ResolutionItem />
+ </Flexbox>
+ )}
+ {isSupportSeed && (
+ <Flexbox gap={6}>
+ <Text fontSize={12}>{t('config.seed.label')}</Text>
+ <SeedItem />
+ </Flexbox>
+ )}
+ {(isSupportGenerateAudio || isSupportCameraFixed) && (
+ <Divider style={{ marginBlock: 4 }} />
+ )}
+ {isSupportGenerateAudio && (
+ <SwitchItem
+ label={t('config.generateAudio.label')}
+ paramName={'generateAudio'}
+ />
+ )}
+ {isSupportCameraFixed && (
+ <SwitchItem label={t('config.cameraFixed.label')} paramName={'cameraFixed'} />
+ )}
+ </Flexbox>
+ }
+ />
+ {isSupportDuration && (
+ <Action
+ icon={Clock3}
+ trigger={'click'}
+ popover={{
+ content: <DurationItem />,
+ minWidth: 220,
+ title: t('config.duration.label'),
+ }}
+ title={[t('config.duration.label'), duration ? `${duration}s` : '']
+ .filter(Boolean)
+ .join(' ')}
+ />
+ )}
+ </Flexbox>
+ }
+ placeholder={
+ hasRefImages ? t('config.prompt.placeholderWithRef') : t('config.prompt.placeholder')
+ }
+ onGenerate={handleGenerate}
+ onValueChange={setValue}
+ />
+ <VideoFreeQuotaInfo />
+ </Flexbox>
+ </Flexbox>
+ );
+};
+
+export default PromptInput;
diff --git a/src/routes/(main)/video/features/VideoWorkspace/SkeletonList.tsx b/src/routes/(main)/(create)/video/features/VideoWorkspace/SkeletonList.tsx
similarity index 71%
rename from src/routes/(main)/video/features/VideoWorkspace/SkeletonList.tsx
rename to src/routes/(main)/(create)/video/features/VideoWorkspace/SkeletonList.tsx
index cd2d1721ecc..d840d420f20 100644
--- a/src/routes/(main)/video/features/VideoWorkspace/SkeletonList.tsx
+++ b/src/routes/(main)/(create)/video/features/VideoWorkspace/SkeletonList.tsx
@@ -3,9 +3,13 @@
import { Block, Center, Flexbox, Skeleton } from '@lobehub/ui';
import { memo } from 'react';
-import PromptInput from '@/routes/(main)/video/features/PromptInput';
+import PromptInput from '@/routes/(main)/(create)/video/features/PromptInput';
-const SkeletonList = memo(() => {
+interface SkeletonListProps {
+ embedInput?: boolean;
+}
+
+const SkeletonList = memo<SkeletonListProps>(({ embedInput = true }) => {
return (
<Flexbox style={{ minHeight: 'calc(100vh - 44px)' }}>
<Block variant={'borderless'}>
@@ -28,15 +32,17 @@ const SkeletonList = memo(() => {
</Flexbox>
</Block>
<div style={{ flex: 1 }} />
- <Center
- style={{
- bottom: 24,
- position: 'sticky',
- width: '100%',
- }}
- >
- <PromptInput disableAnimation={true} showTitle={false} />
- </Center>
+ {embedInput && (
+ <Center
+ style={{
+ bottom: 24,
+ position: 'sticky',
+ width: '100%',
+ }}
+ >
+ <PromptInput disableAnimation={true} showTitle={false} />
+ </Center>
+ )}
</Flexbox>
);
});
diff --git a/src/routes/(main)/(create)/video/features/VideoWorkspace/index.tsx b/src/routes/(main)/(create)/video/features/VideoWorkspace/index.tsx
new file mode 100644
index 00000000000..d0c9b5c0f37
--- /dev/null
+++ b/src/routes/(main)/(create)/video/features/VideoWorkspace/index.tsx
@@ -0,0 +1,30 @@
+'use client';
+
+import GenerationWorkspace from '@/routes/(main)/(create)/features/GenerationWorkspace';
+import { useVideoStore } from '@/store/video';
+import { generationBatchSelectors, videoGenerationTopicSelectors } from '@/store/video/selectors';
+
+import GenerationFeed from '../GenerationFeed';
+import PromptInput from '../PromptInput';
+import SkeletonList from './SkeletonList';
+
+interface VideoWorkspaceProps {
+ embedInput?: boolean;
+}
+
+const VideoWorkspace = ({ embedInput = true }: VideoWorkspaceProps) => (
+ <GenerationWorkspace
+ GenerationFeed={GenerationFeed}
+ PromptInput={PromptInput}
+ SkeletonList={SkeletonList}
+ embedInput={embedInput}
+ useStore={useVideoStore}
+ selectors={{
+ activeGenerationTopicId: videoGenerationTopicSelectors.activeGenerationTopicId,
+ currentGenerationBatches: generationBatchSelectors.currentGenerationBatches,
+ isCurrentGenerationTopicLoaded: generationBatchSelectors.isCurrentGenerationTopicLoaded,
+ }}
+ />
+);
+
+export default VideoWorkspace;
diff --git a/src/routes/(main)/(create)/video/index.tsx b/src/routes/(main)/(create)/video/index.tsx
new file mode 100644
index 00000000000..f61524e8a53
--- /dev/null
+++ b/src/routes/(main)/(create)/video/index.tsx
@@ -0,0 +1,16 @@
+'use client';
+
+import { memo } from 'react';
+
+import CreateGenerationPage from '@/routes/(main)/(create)/features/CreateGenerationPage';
+
+import PromptInput from './features/PromptInput';
+import VideoWorkspace from './features/VideoWorkspace';
+
+const DesktopVideoPage = memo(() => (
+ <CreateGenerationPage PromptInput={PromptInput} Workspace={VideoWorkspace} path="/video" />
+));
+
+DesktopVideoPage.displayName = 'DesktopVideoPage';
+
+export default DesktopVideoPage;
diff --git a/src/routes/(main)/video/loading.tsx b/src/routes/(main)/(create)/video/loading.tsx
similarity index 100%
rename from src/routes/(main)/video/loading.tsx
rename to src/routes/(main)/(create)/video/loading.tsx
diff --git a/src/routes/(main)/image/_layout/ConfigPanel/index.tsx b/src/routes/(main)/image/_layout/ConfigPanel/index.tsx
deleted file mode 100644
index 5437b390a32..00000000000
--- a/src/routes/(main)/image/_layout/ConfigPanel/index.tsx
+++ /dev/null
@@ -1,129 +0,0 @@
-'use client';
-
-import { Flexbox, Text } from '@lobehub/ui';
-import { type ReactNode } from 'react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useFetchAiImageConfig } from '@/hooks/useFetchAiImageConfig';
-import { imageGenerationConfigSelectors } from '@/store/image/selectors';
-import { useDimensionControl } from '@/store/image/slices/generationConfig/hooks';
-import { useImageStore } from '@/store/image/store';
-
-import CfgSliderInput from './components/CfgSliderInput';
-import DimensionControlGroup from './components/DimensionControlGroup';
-import ImageNum from './components/ImageNum';
-import ImageUrl from './components/ImageUrl';
-import ImageUrlsUpload from './components/ImageUrlsUpload';
-import ModelSelect from './components/ModelSelect';
-import QualitySelect from './components/QualitySelect';
-import ResolutionSelect from './components/ResolutionSelect';
-import SeedNumberInput from './components/SeedNumberInput';
-import SizeSelect from './components/SizeSelect';
-import StepsSliderInput from './components/StepsSliderInput';
-import ImageConfigSkeleton from './ImageConfigSkeleton';
-
-interface ConfigItemLayoutProps {
- children: ReactNode;
- label?: string;
-}
-
-const ConfigItemLayout = memo<ConfigItemLayoutProps>(({ label, children }) => {
- return (
- <Flexbox gap={8}>
- {label && <Text weight={500}>{label}</Text>}
- {children}
- </Flexbox>
- );
-});
-
-const isSupportedParamSelector = imageGenerationConfigSelectors.isSupportedParam;
-
-const ConfigPanel = memo(() => {
- const { t } = useTranslation('image');
-
- // Initialize image configuration
- useFetchAiImageConfig();
-
- // All hooks must be called before any early returns
- const isInit = useImageStore((s) => s.isInit);
- const isSupportImageUrl = useImageStore(isSupportedParamSelector('imageUrl'));
- const isSupportSize = useImageStore(isSupportedParamSelector('size'));
- const isSupportQuality = useImageStore(isSupportedParamSelector('quality'));
- const isSupportResolution = useImageStore(isSupportedParamSelector('resolution'));
- const isSupportSeed = useImageStore(isSupportedParamSelector('seed'));
- const isSupportSteps = useImageStore(isSupportedParamSelector('steps'));
- const isSupportCfg = useImageStore(isSupportedParamSelector('cfg'));
- const isSupportImageUrls = useImageStore(isSupportedParamSelector('imageUrls'));
-
- const { showDimensionControl } = useDimensionControl();
-
- // Show loading state if not initialized
- if (!isInit) {
- return <ImageConfigSkeleton />;
- }
-
- return (
- <Flexbox gap={16} padding={10}>
- <ConfigItemLayout>
- <ModelSelect />
- </ConfigItemLayout>
-
- {isSupportImageUrl && (
- <ConfigItemLayout label={t('config.imageUrl.label')}>
- <ImageUrl />
- </ConfigItemLayout>
- )}
-
- {isSupportImageUrls && (
- <ConfigItemLayout label={t('config.imageUrls.label')}>
- <ImageUrlsUpload />
- </ConfigItemLayout>
- )}
-
- {isSupportSize && (
- <ConfigItemLayout label={t('config.size.label')}>
- <SizeSelect />
- </ConfigItemLayout>
- )}
-
- {isSupportQuality && (
- <ConfigItemLayout label={t('config.quality.label')}>
- <QualitySelect />
- </ConfigItemLayout>
- )}
-
- {isSupportResolution && (
- <ConfigItemLayout label={t('config.resolution.label')}>
- <ResolutionSelect />
- </ConfigItemLayout>
- )}
-
- {showDimensionControl && <DimensionControlGroup />}
-
- {isSupportSteps && (
- <ConfigItemLayout label={t('config.steps.label')}>
- <StepsSliderInput />
- </ConfigItemLayout>
- )}
-
- {isSupportCfg && (
- <ConfigItemLayout label={t('config.cfg.label')}>
- <CfgSliderInput />
- </ConfigItemLayout>
- )}
-
- {isSupportSeed && (
- <ConfigItemLayout label={t('config.seed.label')}>
- <SeedNumberInput />
- </ConfigItemLayout>
- )}
-
- <ConfigItemLayout label={t('config.imageNum.label')}>
- <ImageNum />
- </ConfigItemLayout>
- </Flexbox>
- );
-});
-
-export default ConfigPanel;
diff --git a/src/routes/(main)/image/_layout/Header.tsx b/src/routes/(main)/image/_layout/Header.tsx
deleted file mode 100644
index 70810bb39b2..00000000000
--- a/src/routes/(main)/image/_layout/Header.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-'use client';
-
-import { type PropsWithChildren } from 'react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import SideBarHeaderLayout from '@/features/NavPanel/SideBarHeaderLayout';
-
-const Header = memo<PropsWithChildren>(() => {
- const { t } = useTranslation('common');
- return (
- <SideBarHeaderLayout
- breadcrumb={[
- {
- href: '/image',
- title: t('tab.aiImage'),
- },
- ]}
- />
- );
-});
-
-export default Header;
diff --git a/src/routes/(main)/image/_layout/Sidebar.tsx b/src/routes/(main)/image/_layout/Sidebar.tsx
deleted file mode 100644
index 342aa18ad8b..00000000000
--- a/src/routes/(main)/image/_layout/Sidebar.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import React, { memo } from 'react';
-
-import { NavPanelPortal } from '@/features/NavPanel';
-import SideBarLayout from '@/features/NavPanel/SideBarLayout';
-
-import ConfigPanel from './ConfigPanel';
-import Header from './Header';
-
-const Sidebar = memo(() => {
- return (
- <NavPanelPortal navKey="image">
- <SideBarLayout body={<ConfigPanel />} header={<Header />} />
- </NavPanelPortal>
- );
-});
-
-Sidebar.displayName = 'ImageSidebar';
-
-export default Sidebar;
diff --git a/src/routes/(main)/image/_layout/TopicSidebar.tsx b/src/routes/(main)/image/_layout/TopicSidebar.tsx
deleted file mode 100644
index 41f7a3adcdc..00000000000
--- a/src/routes/(main)/image/_layout/TopicSidebar.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import { memo, Suspense } from 'react';
-
-import {
- GenerationTopicStoreProvider,
- SkeletonList,
- TopicList,
- TopicUrlSync,
-} from '@/features/GenerationTopicList';
-import ImageTopicPanel from '@/features/ImageTopicPanel';
-import { useImageStore } from '@/store/image';
-
-const TopicSidebar = memo(() => {
- return (
- <GenerationTopicStoreProvider value={{ namespace: 'image', useStore: useImageStore as any }}>
- <ImageTopicPanel>
- <Suspense fallback={<SkeletonList />}>
- <TopicList />
- <TopicUrlSync />
- </Suspense>
- </ImageTopicPanel>
- </GenerationTopicStoreProvider>
- );
-});
-
-TopicSidebar.displayName = 'ImageTopicSidebar';
-
-export default TopicSidebar;
diff --git a/src/routes/(main)/image/_layout/index.tsx b/src/routes/(main)/image/_layout/index.tsx
deleted file mode 100644
index d7db3c62fcb..00000000000
--- a/src/routes/(main)/image/_layout/index.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import { Flexbox } from '@lobehub/ui';
-import { type FC } from 'react';
-import { Outlet } from 'react-router-dom';
-
-import RegisterHotkeys from './RegisterHotkeys';
-import Sidebar from './Sidebar';
-import { styles } from './style';
-import TopicSidebar from './TopicSidebar';
-
-const Layout: FC = () => {
- return (
- <>
- <Sidebar />
- <Flexbox horizontal className={styles.mainContainer} flex={1} height={'100%'}>
- <Flexbox className={styles.contentContainer} flex={1} height={'100%'}>
- <Outlet />
- </Flexbox>
- <TopicSidebar />
- </Flexbox>
- <RegisterHotkeys />
- </>
- );
-};
-
-export default Layout;
diff --git a/src/routes/(main)/image/_layout/style.ts b/src/routes/(main)/image/_layout/style.ts
deleted file mode 100644
index 23bc8fdf6d4..00000000000
--- a/src/routes/(main)/image/_layout/style.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { createStaticStyles } from 'antd-style';
-
-export const styles = createStaticStyles(({ css, cssVar }) => ({
- // 内容容器
- contentContainer: css`
- position: relative;
- overflow: hidden;
- `,
-
- // 主容器
- mainContainer: css`
- position: relative;
- overflow: hidden;
- background: ${cssVar.colorBgContainer};
- `,
-}));
diff --git a/src/routes/(main)/image/features/GenerationFeed/ReferenceImages.tsx b/src/routes/(main)/image/features/GenerationFeed/ReferenceImages.tsx
deleted file mode 100644
index 8aa3da4e5d9..00000000000
--- a/src/routes/(main)/image/features/GenerationFeed/ReferenceImages.tsx
+++ /dev/null
@@ -1,120 +0,0 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { memo } from 'react';
-
-import ImageItem from '@/components/ImageItem';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- gap: 8px;
- margin-block-end: 12px;
- `,
- image: css`
- overflow: hidden;
- flex-shrink: 0;
-
- width: 60px;
- height: 60px;
- border-radius: ${cssVar.borderRadius}px;
- `,
- imageSingle: css`
- position: relative;
- transform: rotate(-3deg);
-
- flex-shrink: 0;
-
- width: 64px;
- height: 64px;
-
- transition: transform 0.2s ease;
-
- &::before {
- content: '';
-
- position: absolute;
- z-index: -1;
- inset: -4px;
-
- border: 1px solid ${cssVar.colorBorder};
- border-radius: ${cssVar.borderRadius}px;
-
- background: ${cssVar.colorBgContainer};
- box-shadow: 0 2px 8px ${cssVar.colorBgMask};
- }
-
- &:hover {
- transform: rotate(-1deg) scale(1.05);
- }
- `,
- imageSingleInner: css`
- overflow: hidden;
-
- width: 100%;
- height: 100%;
- border-radius: ${cssVar.borderRadiusSM}px;
-
- background: ${cssVar.colorBgLayout};
- `,
-}));
-
-interface ReferenceImagesProps {
- imageUrl?: string | null;
- imageUrls?: string[];
- layout?: 'single' | 'multiple';
-}
-
-export const ReferenceImages = memo<ReferenceImagesProps>(({ imageUrl, imageUrls, layout }) => {
- // Collect all images
- const allImages: string[] = [];
- if (imageUrl) {
- allImages.push(imageUrl);
- }
- if (imageUrls && imageUrls.length > 0) {
- allImages.push(...imageUrls);
- }
-
- // Don't render if no images
- if (allImages.length === 0) {
- return null;
- }
-
- // Single image layout (no label, with frame effect)
- if (layout === 'single' && allImages.length === 1) {
- return (
- <div className={styles.imageSingle}>
- <div className={styles.imageSingleInner}>
- <ImageItem
- alt="Reference image"
- style={{ height: '100%', width: '100%' }}
- url={allImages[0]}
- preview={{
- src: allImages[0],
- }}
- />
- </div>
- </div>
- );
- }
-
- // Multiple images layout
- return (
- <Flexbox horizontal className={styles.container} wrap="wrap">
- {allImages.map((url, index) => (
- <div className={styles.image} key={`${url}-${index}`}>
- <ImageItem
- alt={`Reference image ${index + 1}`}
- style={{ height: '100%', width: '100%' }}
- url={url}
- preview={{
- src: url,
- }}
- />
- </div>
- ))}
- </Flexbox>
- );
-});
-
-ReferenceImages.displayName = 'ReferenceImages';
diff --git a/src/routes/(main)/image/features/GenerationFeed/index.tsx b/src/routes/(main)/image/features/GenerationFeed/index.tsx
deleted file mode 100644
index 0ccc244b002..00000000000
--- a/src/routes/(main)/image/features/GenerationFeed/index.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-'use client';
-
-import { useAutoAnimate } from '@formkit/auto-animate/react';
-import { Flexbox } from '@lobehub/ui';
-import { Divider } from 'antd';
-import { Fragment, memo, useEffect, useRef } from 'react';
-
-import { useImageStore } from '@/store/image';
-import { generationBatchSelectors } from '@/store/image/selectors';
-
-import { GenerationBatchItem } from './BatchItem';
-
-const GenerationFeed = memo(() => {
- const [parent, enableAnimations] = useAutoAnimate();
- const containerRef = useRef<HTMLDivElement>(null);
- const isInitialLoadRef = useRef(true);
- const prevBatchesCountRef = useRef(0);
-
- const currentGenerationBatches = useImageStore(generationBatchSelectors.currentGenerationBatches);
-
- // Smart scroll function that accounts for sticky elements
- const scrollToBottom = (behavior: 'smooth' | 'auto' = 'smooth') => {
- if (!containerRef.current) return;
-
- // Find the main scrollable container (usually the parent of the sticky element)
- const scrollableParent =
- containerRef.current.closest('[style*="overflow"]') || document.documentElement;
-
- // Get the position of our target element
- const targetRect = containerRef.current.getBoundingClientRect();
- const scrollableRect = scrollableParent.getBoundingClientRect();
-
- // Calculate the scroll position, adding extra offset for sticky elements
- // The 120px accounts for typical sticky input height + some padding
- const scrollTop = scrollableParent.scrollTop + targetRect.bottom - scrollableRect.bottom + 999;
-
- scrollableParent.scrollTo({
- behavior,
- top: scrollTop,
- });
- };
-
- // Auto-scroll to bottom, with different behavior for initial load vs. updates
- useEffect(() => {
- const currentBatches = currentGenerationBatches || [];
- const currentBatchesCount = currentBatches.length;
- const prevBatchesCount = prevBatchesCountRef.current;
-
- if (currentBatchesCount === 0) {
- prevBatchesCountRef.current = 0;
- return;
- }
-
- if (isInitialLoadRef.current) {
- // On initial load, scroll instantly to the end.
- scrollToBottom('auto');
- isInitialLoadRef.current = false;
- } else if (currentBatchesCount > prevBatchesCount) {
- // For subsequent updates where a batch was ADDED, scroll smoothly.
- enableAnimations(false);
- // Wait for React to re-render without animations.
- const timer = setTimeout(() => {
- scrollToBottom('smooth');
- // Re-enable animations for future interactions like deleting items.
- enableAnimations(true);
- }, 50); // A small delay is enough.
-
- return () => clearTimeout(timer);
- }
-
- // Always update the ref with the latest count for the next render.
- prevBatchesCountRef.current = currentBatchesCount;
- }, [currentGenerationBatches, enableAnimations]);
-
- if (!currentGenerationBatches || currentGenerationBatches.length === 0) {
- return null;
- }
-
- return (
- <Flexbox flex={1} style={{ overflowY: 'auto' }}>
- <Flexbox gap={16} ref={parent} style={{ paddingBottom: 48 }} width="100%">
- {currentGenerationBatches.map((batch, index) => (
- <Fragment key={batch.id}>
- {Boolean(index !== 0) && <Divider dashed style={{ margin: 0 }} />}
- <GenerationBatchItem batch={batch} key={batch.id} />
- </Fragment>
- ))}
- </Flexbox>
- {/* Invisible element for scroll target */}
- <div ref={containerRef} style={{ height: 1 }} />
- </Flexbox>
- );
-});
-
-GenerationFeed.displayName = 'GenerationFeed';
-
-export default GenerationFeed;
diff --git a/src/routes/(main)/image/features/ImageWorkspace/Content.tsx b/src/routes/(main)/image/features/ImageWorkspace/Content.tsx
deleted file mode 100644
index 94584dec713..00000000000
--- a/src/routes/(main)/image/features/ImageWorkspace/Content.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-'use client';
-
-import { useImageStore } from '@/store/image';
-import { generationBatchSelectors, generationTopicSelectors } from '@/store/image/selectors';
-
-import GenerationFeed from '../GenerationFeed';
-import PromptInput from '../PromptInput';
-import EmptyState from './EmptyState';
-import SkeletonList from './SkeletonList';
-
-const ImageWorkspaceContent = () => {
- const activeTopicId = useImageStore(generationTopicSelectors.activeGenerationTopicId);
- const useFetchGenerationBatches = useImageStore((s) => s.useFetchGenerationBatches);
- const isCurrentGenerationTopicLoaded = useImageStore(
- generationBatchSelectors.isCurrentGenerationTopicLoaded,
- );
- useFetchGenerationBatches(activeTopicId);
- const currentBatches = useImageStore(generationBatchSelectors.currentGenerationBatches);
- const hasGenerations = currentBatches && currentBatches.length > 0;
-
- if (!isCurrentGenerationTopicLoaded) {
- return <SkeletonList />;
- }
-
- if (!hasGenerations) return <EmptyState />;
-
- return (
- <>
- {/* 生成结果展示区 */}
- <GenerationFeed key={activeTopicId} />
-
- {/* 底部输入框 */}
- <PromptInput disableAnimation={true} showTitle={false} />
- </>
- );
-};
-
-export default ImageWorkspaceContent;
diff --git a/src/routes/(main)/image/features/ImageWorkspace/EmptyState.tsx b/src/routes/(main)/image/features/ImageWorkspace/EmptyState.tsx
deleted file mode 100644
index 0c1b68b1fcf..00000000000
--- a/src/routes/(main)/image/features/ImageWorkspace/EmptyState.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Center } from '@lobehub/ui';
-import { memo } from 'react';
-
-import PromptInput from '../PromptInput';
-
-const EmptyState = memo(() => {
- return (
- <Center height={'calc(100vh - 180px)'}>
- <PromptInput showTitle={true} />
- </Center>
- );
-});
-
-export default EmptyState;
diff --git a/src/routes/(main)/image/features/ImageWorkspace/index.tsx b/src/routes/(main)/image/features/ImageWorkspace/index.tsx
deleted file mode 100644
index 23e6f46aba6..00000000000
--- a/src/routes/(main)/image/features/ImageWorkspace/index.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-'use client';
-
-import { useQueryState } from '@/hooks/useQueryParam';
-import { useImageStore } from '@/store/image';
-
-import Content from './Content';
-import EmptyState from './EmptyState';
-
-const ImageWorkspace = () => {
- const [topic] = useQueryState('topic');
- const isCreatingWithNewTopic = useImageStore((s) => s.isCreatingWithNewTopic);
-
- // 如果没有 topic 参数,或者正在创建新 topic 的图片,显示空状态布局
- if (!topic || isCreatingWithNewTopic) {
- return <EmptyState />;
- }
-
- // 有 topic 参数且不在创建新 topic 状态时显示主要内容
- return <Content />;
-};
-
-export default ImageWorkspace;
diff --git a/src/routes/(main)/image/features/PromptInput/Title.tsx b/src/routes/(main)/image/features/PromptInput/Title.tsx
deleted file mode 100644
index 25c63a56b6a..00000000000
--- a/src/routes/(main)/image/features/PromptInput/Title.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-'use client';
-
-import { Center, Icon, Text } from '@lobehub/ui';
-import { cssVar } from 'antd-style';
-import { Palette } from 'lucide-react';
-import { useTranslation } from 'react-i18next';
-
-const PromptTitle = () => {
- const { t } = useTranslation('image');
-
- return (
- <Center horizontal gap={16} style={{ width: '100%' }}>
- <Center
- flex={'none'}
- height={54}
- width={54}
- style={{
- backgroundColor: cssVar.colorText,
- borderRadius: 16,
- }}
- >
- <Icon color={cssVar.colorBgLayout} icon={Palette} size={32} />
- </Center>
- <Text
- as={'h1'}
- style={{
- margin: 0,
- }}
- >
- {t('config.header.title')}
- </Text>
- </Center>
- );
-};
-
-export default PromptTitle;
diff --git a/src/routes/(main)/image/features/PromptInput/index.tsx b/src/routes/(main)/image/features/PromptInput/index.tsx
deleted file mode 100644
index 4ddfda64fe2..00000000000
--- a/src/routes/(main)/image/features/PromptInput/index.tsx
+++ /dev/null
@@ -1,163 +0,0 @@
-'use client';
-
-import { ChatInput } from '@lobehub/editor/react';
-import { Button, Flexbox, TextArea } from '@lobehub/ui';
-import { createStaticStyles, cx } from 'antd-style';
-import { Sparkles } from 'lucide-react';
-import { type KeyboardEvent } from 'react';
-import { useEffect, useRef } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { loginRequired } from '@/components/Error/loginRequiredNotification';
-import { useIsDark } from '@/hooks/useIsDark';
-import { useQueryState } from '@/hooks/useQueryParam';
-import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
-import { useImageStore } from '@/store/image';
-import { createImageSelectors } from '@/store/image/selectors';
-import { useGenerationConfigParam } from '@/store/image/slices/generationConfig/hooks';
-import { useUserStore } from '@/store/user';
-import { authSelectors } from '@/store/user/slices/auth/selectors';
-
-import PromptTitle from './Title';
-
-interface PromptInputProps {
- disableAnimation?: boolean;
- showTitle?: boolean;
-}
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- box-shadow:
- ${cssVar.boxShadowTertiary},
- 0 0 0 ${cssVar.colorBgContainer},
- 0 32px 0 ${cssVar.colorBgContainer};
- `,
- container_dark: css`
- box-shadow:
- ${cssVar.boxShadowTertiary},
- 0 0 48px 32px ${cssVar.colorBgContainer},
- 0 32px 0 ${cssVar.colorBgContainer};
- `,
-}));
-
-const PromptInput = ({ showTitle = false }: PromptInputProps) => {
- const isDarkMode = useIsDark();
- const { t } = useTranslation('image');
- const { value, setValue } = useGenerationConfigParam('prompt');
- const isCreating = useImageStore(createImageSelectors.isCreating);
- const createImage = useImageStore((s) => s.createImage);
- const setModelAndProviderOnSelect = useImageStore((s) => s.setModelAndProviderOnSelect);
- const isInit = useImageStore((s) => s.isInit);
- const isLogin = useUserStore(authSelectors.isLogin);
- const enabledImageModelList = useAiInfraStore(aiProviderSelectors.enabledImageModelList);
-
- // Read prompt from query parameter
- const [promptParam, setPromptParam] = useQueryState('prompt');
- // Read model from query parameter
- const [modelParam, setModelParam] = useQueryState('model');
- const hasProcessedPrompt = useRef(false);
- const hasProcessedModel = useRef(false);
-
- const handleGenerate = async () => {
- if (!isLogin) {
- loginRequired.redirect({ timeout: 2000 });
- return;
- }
-
- await createImage();
- };
-
- // Auto-select model when model query parameter is present
- useEffect(() => {
- if (modelParam && !hasProcessedModel.current && isInit) {
- const targetModel = modelParam;
-
- // Find the provider for this model from enabledImageModelList
- for (const providerGroup of enabledImageModelList) {
- const found = providerGroup.children.some((m) => m.id === targetModel);
- if (found) {
- setModelAndProviderOnSelect(targetModel, providerGroup.id);
- break;
- }
- }
-
- hasProcessedModel.current = true;
- setModelParam(null);
- }
- }, [modelParam, isInit, enabledImageModelList, setModelAndProviderOnSelect, setModelParam]);
-
- // Auto-fill and auto-send when prompt query parameter is present
- useEffect(() => {
- if (promptParam && !hasProcessedPrompt.current && isLogin) {
- // Decode the prompt parameter
- const decodedPrompt = decodeURIComponent(promptParam);
-
- // Set the prompt value in the store
- setValue(decodedPrompt);
-
- // Mark as processed to avoid running this effect again
- hasProcessedPrompt.current = true;
-
- // Clear the query parameter
- setPromptParam(null);
-
- // Auto-trigger generation after a short delay to ensure state is updated
- setTimeout(async () => {
- await createImage();
- }, 100);
- }
- }, [promptParam, isLogin, setValue, setPromptParam, createImage]);
-
- const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {
- if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
- e.preventDefault();
- if (!isCreating && value.trim()) {
- handleGenerate();
- }
- }
- };
-
- return (
- <Flexbox gap={32} width={'100%'}>
- {showTitle && <PromptTitle />}
- <ChatInput
- className={cx(styles.container, isDarkMode && styles.container_dark)}
- styles={{ body: { padding: 8 } }}
- >
- <Flexbox horizontal align="flex-end" gap={12} height={'100%'} width={'100%'}>
- <TextArea
- autoSize={{ maxRows: 6, minRows: 3 }}
- placeholder={t('config.prompt.placeholder')}
- value={value}
- variant={'borderless'}
- style={{
- borderRadius: 0,
- padding: 0,
- }}
- onChange={(e) => setValue(e.target.value)}
- onKeyDown={handleKeyDown}
- />
- <Button
- disabled={!value}
- icon={Sparkles}
- loading={isCreating}
- size={'large'}
- type={'primary'}
- style={{
- fontWeight: 500,
- height: 64,
- minWidth: 64,
- width: 64,
- }}
- title={
- isCreating ? t('generation.status.generating') : t('generation.actions.generate')
- }
- onClick={handleGenerate}
- />
- </Flexbox>
- </ChatInput>
- </Flexbox>
- );
-};
-
-export default PromptInput;
diff --git a/src/routes/(main)/image/index.tsx b/src/routes/(main)/image/index.tsx
deleted file mode 100644
index 49721fa45fb..00000000000
--- a/src/routes/(main)/image/index.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { memo } from 'react';
-
-import NavHeader from '@/features/NavHeader';
-import WideScreenContainer from '@/features/WideScreenContainer';
-import WideScreenButton from '@/features/WideScreenContainer/WideScreenButton';
-
-import ImageWorkspace from './features/ImageWorkspace';
-
-const DesktopImagePage = memo(() => {
- return (
- <>
- <NavHeader right={<WideScreenButton />} />
- <Flexbox height={'100%'} style={{ overflowY: 'auto', position: 'relative' }} width={'100%'}>
- <WideScreenContainer height={'100%'} wrapperStyle={{ height: '100%' }}>
- <ImageWorkspace />
- </WideScreenContainer>
- </Flexbox>
- </>
- );
-});
-
-DesktopImagePage.displayName = 'DesktopImagePage';
-
-export default DesktopImagePage;
diff --git a/src/routes/(main)/video/_layout/ConfigPanel/components/ModelSelect/VideoModelItem.tsx b/src/routes/(main)/video/_layout/ConfigPanel/components/ModelSelect/VideoModelItem.tsx
deleted file mode 100644
index 8e0d6f09093..00000000000
--- a/src/routes/(main)/video/_layout/ConfigPanel/components/ModelSelect/VideoModelItem.tsx
+++ /dev/null
@@ -1,79 +0,0 @@
-import { ModelIcon } from '@lobehub/icons';
-import { Flexbox, Popover, Text } from '@lobehub/ui';
-import { createStaticStyles, cx } from 'antd-style';
-import type { AiModelForSelect } from 'model-bank';
-import { memo, useMemo } from 'react';
-
-import NewModelBadge from '@/components/ModelSelect/NewModelBadge';
-import { useIsDark } from '@/hooks/useIsDark';
-
-const POPOVER_MAX_WIDTH = 320;
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- descriptionText: css`
- color: ${cssVar.colorTextSecondary};
- `,
- descriptionText_dark: css`
- color: ${cssVar.colorText};
- `,
- popover: css`
- .ant-popover-inner {
- background: ${cssVar.colorBgElevated};
- }
- `,
- popover_dark: css`
- .ant-popover-inner {
- background: ${cssVar.colorBgSpotlight};
- }
- `,
-}));
-
-type VideoModelItemProps = AiModelForSelect & {
- providerId?: string;
- showBadge?: boolean;
- showPopover?: boolean;
-};
-
-const VideoModelItem = memo<VideoModelItemProps>(
- ({ description, showPopover = true, showBadge = true, ...model }) => {
- const isDarkMode = useIsDark();
-
- const popoverContent = useMemo(() => {
- if (!description) return null;
-
- return (
- <Flexbox gap={8} style={{ maxWidth: POPOVER_MAX_WIDTH }}>
- <Text className={cx(styles.descriptionText, isDarkMode && styles.descriptionText_dark)}>
- {description}
- </Text>
- </Flexbox>
- );
- }, [description, isDarkMode]);
-
- const content = (
- <Flexbox horizontal align={'center'} gap={8} style={{ overflow: 'hidden' }}>
- <ModelIcon model={model.id} size={20} />
- <Text ellipsis title={model.displayName || model.id}>
- {model.displayName || model.id}
- </Text>
- {showBadge && <NewModelBadge releasedAt={model.releasedAt} />}
- </Flexbox>
- );
-
- if (!showPopover || !popoverContent) return content;
-
- return (
- <Popover
- classNames={{ root: cx(styles.popover, isDarkMode && styles.popover_dark) }}
- content={popoverContent}
- placement="rightTop"
- >
- {content}
- </Popover>
- );
- },
-);
-
-VideoModelItem.displayName = 'VideoModelItem';
-
-export default VideoModelItem;
diff --git a/src/routes/(main)/video/_layout/ConfigPanel/index.tsx b/src/routes/(main)/video/_layout/ConfigPanel/index.tsx
deleted file mode 100644
index 2e9c65b68f0..00000000000
--- a/src/routes/(main)/video/_layout/ConfigPanel/index.tsx
+++ /dev/null
@@ -1,214 +0,0 @@
-'use client';
-
-import {
- Button,
- Flexbox,
- InputNumber,
- Segmented,
- SliderWithInput,
- Text,
- Tooltip,
-} from '@lobehub/ui';
-import { Switch } from 'antd';
-import { Dices } from 'lucide-react';
-import { MAX_VIDEO_SEED } from 'model-bank';
-import type { ReactNode } from 'react';
-import { memo, useCallback, useMemo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useFetchAiVideoConfig } from '@/hooks/useFetchAiVideoConfig';
-import AspectRatioSelect from '@/routes/(main)/image/_layout/ConfigPanel/components/AspectRatioSelect';
-import { videoGenerationConfigSelectors } from '@/store/video/selectors';
-import { useVideoGenerationConfigParam } from '@/store/video/slices/generationConfig/hooks';
-import { useVideoStore } from '@/store/video/store';
-import { generateUniqueSeeds } from '@/utils/number';
-
-import FrameUpload from './components/FrameUpload';
-import ModelSelect from './components/ModelSelect';
-import VideoConfigSkeleton from './VideoConfigSkeleton';
-
-interface ConfigItemLayoutProps {
- children: ReactNode;
- label?: string;
-}
-
-const ConfigItemLayout = memo<ConfigItemLayoutProps>(({ label, children }) => {
- return (
- <Flexbox gap={8}>
- {label && <Text weight={500}>{label}</Text>}
- {children}
- </Flexbox>
- );
-});
-
-const isSupportedParamSelector = videoGenerationConfigSelectors.isSupportedParam;
-
-const AspectRatioItem = memo(() => {
- const { value, setValue, enumValues } = useVideoGenerationConfigParam('aspectRatio');
-
- const options = useMemo(() => (enumValues ?? []).map((v) => ({ value: v })), [enumValues]);
-
- return <AspectRatioSelect options={options} value={value} onChange={(v) => setValue(v as any)} />;
-});
-
-const ResolutionItem = memo(() => {
- const { value, setValue, enumValues } = useVideoGenerationConfigParam('resolution');
-
- const options = useMemo(() => {
- if (!enumValues || enumValues.length === 0) return [];
- return enumValues.map((v) => ({ label: v, value: v }));
- }, [enumValues]);
-
- if (options.length === 0) return null;
-
- return (
- <Segmented
- block
- options={options}
- style={{ width: '100%' }}
- value={value}
- variant="filled"
- onChange={(v) => setValue(String(v) as any)}
- />
- );
-});
-
-const DurationItem = memo(() => {
- const { value, setValue, min, max, step } = useVideoGenerationConfigParam('duration');
-
- return (
- <SliderWithInput
- max={max}
- min={min}
- step={step ?? 1}
- value={value ?? min}
- onChange={(v) => setValue(v as any)}
- />
- );
-});
-
-const SeedItem = memo(() => {
- const { t } = useTranslation('video');
- const { value, setValue } = useVideoGenerationConfigParam('seed');
-
- const handleRandomize = useCallback(() => {
- setValue(generateUniqueSeeds(1)[0] as any);
- }, [setValue]);
-
- return (
- <Flexbox horizontal gap={4}>
- <InputNumber
- max={MAX_VIDEO_SEED}
- min={0}
- placeholder={t('config.seed.random')}
- step={1}
- style={{ width: '100%' }}
- value={value}
- onChange={(v) => setValue(v as any)}
- />
- <Tooltip title={t('config.seed.random')}>
- <Button
- icon={Dices}
- style={{ flex: 'none', width: 48 }}
- variant={'outlined'}
- onClick={handleRandomize}
- />
- </Tooltip>
- </Flexbox>
- );
-});
-
-interface SwitchItemProps {
- label: string;
- paramName: 'cameraFixed' | 'generateAudio';
-}
-
-const SwitchItem = memo<SwitchItemProps>(({ label, paramName }) => {
- const { value, setValue } = useVideoGenerationConfigParam(paramName);
-
- return (
- <Flexbox horizontal align="center" justify="space-between" padding={'0 2px'}>
- <Text weight={500}>{label}</Text>
- <Switch checked={!!value} onChange={(checked) => setValue(checked as any)} />
- </Flexbox>
- );
-});
-
-const ConfigPanel = memo(() => {
- const { t } = useTranslation('video');
-
- // Initialize video configuration
- useFetchAiVideoConfig();
-
- const isInit = useVideoStore((s) => s.isInit);
- const isSupportImageUrl = useVideoStore(isSupportedParamSelector('imageUrl'));
- const isSupportEndImageUrl = useVideoStore(isSupportedParamSelector('endImageUrl'));
- const isSupportAspectRatio = useVideoStore(isSupportedParamSelector('aspectRatio'));
- const isSupportResolution = useVideoStore(isSupportedParamSelector('resolution'));
- const isSupportDuration = useVideoStore(isSupportedParamSelector('duration'));
- const isSupportSeed = useVideoStore(isSupportedParamSelector('seed'));
- const isSupportGenerateAudio = useVideoStore(isSupportedParamSelector('generateAudio'));
- const isSupportCameraFixed = useVideoStore(isSupportedParamSelector('cameraFixed'));
-
- // Show loading state if not initialized
- if (!isInit) {
- return <VideoConfigSkeleton />;
- }
-
- const imageUrlLabel = isSupportEndImageUrl
- ? t('config.imageUrl.label')
- : t('config.referenceImage.label');
-
- return (
- <Flexbox gap={16} padding={10}>
- <ConfigItemLayout>
- <ModelSelect />
- </ConfigItemLayout>
-
- {isSupportImageUrl && (
- <ConfigItemLayout label={imageUrlLabel}>
- <FrameUpload paramName="imageUrl" />
- </ConfigItemLayout>
- )}
-
- {isSupportEndImageUrl && (
- <ConfigItemLayout label={t('config.endImageUrl.label')}>
- <FrameUpload paramName="endImageUrl" />
- </ConfigItemLayout>
- )}
-
- {isSupportAspectRatio && (
- <ConfigItemLayout label={t('config.aspectRatio.label')}>
- <AspectRatioItem />
- </ConfigItemLayout>
- )}
-
- {isSupportResolution && (
- <ConfigItemLayout label={t('config.resolution.label')}>
- <ResolutionItem />
- </ConfigItemLayout>
- )}
-
- {isSupportDuration && (
- <ConfigItemLayout label={t('config.duration.label')}>
- <DurationItem />
- </ConfigItemLayout>
- )}
-
- {isSupportSeed && (
- <ConfigItemLayout label={t('config.seed.label')}>
- <SeedItem />
- </ConfigItemLayout>
- )}
-
- {isSupportGenerateAudio && (
- <SwitchItem label={t('config.generateAudio.label')} paramName="generateAudio" />
- )}
- {isSupportCameraFixed && (
- <SwitchItem label={t('config.cameraFixed.label')} paramName="cameraFixed" />
- )}
- </Flexbox>
- );
-});
-
-export default ConfigPanel;
diff --git a/src/routes/(main)/video/_layout/Header.tsx b/src/routes/(main)/video/_layout/Header.tsx
deleted file mode 100644
index 27cdbaf8141..00000000000
--- a/src/routes/(main)/video/_layout/Header.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-'use client';
-
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import SideBarHeaderLayout from '@/features/NavPanel/SideBarHeaderLayout';
-
-const Header = memo(() => {
- const { t } = useTranslation('common');
- return <SideBarHeaderLayout breadcrumb={[{ href: '/video', title: t('tab.video') }]} />;
-});
-
-export default Header;
diff --git a/src/routes/(main)/video/_layout/Sidebar.tsx b/src/routes/(main)/video/_layout/Sidebar.tsx
deleted file mode 100644
index 97415d4186b..00000000000
--- a/src/routes/(main)/video/_layout/Sidebar.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import React, { memo } from 'react';
-
-import { NavPanelPortal } from '@/features/NavPanel';
-import SideBarLayout from '@/features/NavPanel/SideBarLayout';
-
-import ConfigPanel from './ConfigPanel';
-import Header from './Header';
-
-const Sidebar = memo(() => {
- return (
- <NavPanelPortal navKey="video">
- <SideBarLayout body={<ConfigPanel />} header={<Header />} />
- </NavPanelPortal>
- );
-});
-
-Sidebar.displayName = 'VideoSidebar';
-
-export default Sidebar;
diff --git a/src/routes/(main)/video/_layout/TopicSidebar.tsx b/src/routes/(main)/video/_layout/TopicSidebar.tsx
deleted file mode 100644
index 7962da627cb..00000000000
--- a/src/routes/(main)/video/_layout/TopicSidebar.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-'use client';
-
-import { memo, Suspense } from 'react';
-
-import {
- GenerationTopicStoreProvider,
- SkeletonList,
- TopicList,
- TopicUrlSync,
-} from '@/features/GenerationTopicList';
-import GenerationTopicPanel from '@/features/GenerationTopicPanel';
-import { useGlobalStore } from '@/store/global';
-import { systemStatusSelectors } from '@/store/global/selectors';
-import { useVideoStore } from '@/store/video';
-
-const TopicSidebar = memo(() => {
- const [videoTopicPanelWidth, showVideoTopicPanel, updateSystemStatus] = useGlobalStore((s) => [
- systemStatusSelectors.videoTopicPanelWidth(s),
- systemStatusSelectors.showVideoTopicPanel(s),
- s.updateSystemStatus,
- ]);
-
- return (
- <GenerationTopicStoreProvider value={{ namespace: 'video', useStore: useVideoStore as any }}>
- <GenerationTopicPanel
- panelWidth={videoTopicPanelWidth ?? 256}
- showPanel={showVideoTopicPanel ?? true}
- onExpandChange={(expand) => updateSystemStatus({ showVideoTopicPanel: expand })}
- onSizeChange={(width) => updateSystemStatus({ videoTopicPanelWidth: width })}
- >
- <Suspense fallback={<SkeletonList />}>
- <TopicList />
- <TopicUrlSync />
- </Suspense>
- </GenerationTopicPanel>
- </GenerationTopicStoreProvider>
- );
-});
-
-TopicSidebar.displayName = 'VideoTopicSidebar';
-
-export default TopicSidebar;
diff --git a/src/routes/(main)/video/_layout/index.tsx b/src/routes/(main)/video/_layout/index.tsx
deleted file mode 100644
index 23fd47e16cc..00000000000
--- a/src/routes/(main)/video/_layout/index.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { Flexbox } from '@lobehub/ui';
-import type { FC } from 'react';
-import { Outlet } from 'react-router-dom';
-
-import Sidebar from './Sidebar';
-import { styles } from './style';
-import TopicSidebar from './TopicSidebar';
-
-const Layout: FC = () => {
- return (
- <>
- <Sidebar />
- <Flexbox horizontal className={styles.mainContainer} flex={1} height={'100%'}>
- <Flexbox className={styles.contentContainer} flex={1} height={'100%'}>
- <Outlet />
- </Flexbox>
- <TopicSidebar />
- </Flexbox>
- </>
- );
-};
-
-export default Layout;
diff --git a/src/routes/(main)/video/features/GenerationFeed/VideoReferenceFrames.tsx b/src/routes/(main)/video/features/GenerationFeed/VideoReferenceFrames.tsx
deleted file mode 100644
index e2fac599b65..00000000000
--- a/src/routes/(main)/video/features/GenerationFeed/VideoReferenceFrames.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { memo } from 'react';
-
-import ImageItem from '@/components/ImageItem';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- frameEnd: css`
- position: relative;
- transform: rotate(3deg);
-
- flex-shrink: 0;
-
- width: 64px;
- height: 64px;
-
- transition: transform 0.2s ease;
-
- &::before {
- content: '';
-
- position: absolute;
- z-index: -1;
- inset: -4px;
-
- border: 1px solid ${cssVar.colorBorder};
- border-radius: ${cssVar.borderRadius}px;
-
- background: ${cssVar.colorBgContainer};
- box-shadow: 0 2px 8px ${cssVar.colorBgMask};
- }
-
- &:hover {
- transform: rotate(1deg) scale(1.05);
- }
- `,
- frameInner: css`
- overflow: hidden;
-
- width: 100%;
- height: 100%;
- border-radius: ${cssVar.borderRadiusSM}px;
-
- background: ${cssVar.colorBgLayout};
- `,
- frameStart: css`
- position: relative;
- transform: rotate(-3deg);
-
- flex-shrink: 0;
-
- width: 64px;
- height: 64px;
-
- transition: transform 0.2s ease;
-
- &::before {
- content: '';
-
- position: absolute;
- z-index: -1;
- inset: -4px;
-
- border: 1px solid ${cssVar.colorBorder};
- border-radius: ${cssVar.borderRadius}px;
-
- background: ${cssVar.colorBgContainer};
- box-shadow: 0 2px 8px ${cssVar.colorBgMask};
- }
-
- &:hover {
- transform: rotate(-1deg) scale(1.05);
- }
- `,
-}));
-
-interface VideoReferenceFramesProps {
- endImageUrl?: string | null;
- imageUrl?: string | null;
-}
-
-const VideoReferenceFrames = memo<VideoReferenceFramesProps>(({ imageUrl, endImageUrl }) => {
- if (!imageUrl && !endImageUrl) return null;
-
- return (
- <Flexbox horizontal align={'center'} gap={12}>
- {imageUrl && (
- <div className={styles.frameStart}>
- <div className={styles.frameInner}>
- <ImageItem
- alt="Start frame"
- preview={{ src: imageUrl }}
- style={{ height: '100%', width: '100%' }}
- url={imageUrl}
- />
- </div>
- </div>
- )}
- {endImageUrl && (
- <div className={styles.frameEnd}>
- <div className={styles.frameInner}>
- <ImageItem
- alt="End frame"
- preview={{ src: endImageUrl }}
- style={{ height: '100%', width: '100%' }}
- url={endImageUrl}
- />
- </div>
- </div>
- )}
- </Flexbox>
- );
-});
-
-VideoReferenceFrames.displayName = 'VideoReferenceFrames';
-
-export default VideoReferenceFrames;
diff --git a/src/routes/(main)/video/features/PromptInput/index.tsx b/src/routes/(main)/video/features/PromptInput/index.tsx
deleted file mode 100644
index c41e9af7c6c..00000000000
--- a/src/routes/(main)/video/features/PromptInput/index.tsx
+++ /dev/null
@@ -1,136 +0,0 @@
-'use client';
-
-import { ChatInput } from '@lobehub/editor/react';
-import { Button, Flexbox, TextArea } from '@lobehub/ui';
-import { createStaticStyles, cx } from 'antd-style';
-import { Sparkles } from 'lucide-react';
-import type { KeyboardEvent } from 'react';
-import { useEffect, useRef } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import VideoFreeQuotaInfo from '@/business/client/features/VideoFreeQuotaInfo';
-import { loginRequired } from '@/components/Error/loginRequiredNotification';
-import { useIsDark } from '@/hooks/useIsDark';
-import { useQueryState } from '@/hooks/useQueryParam';
-import { useUserStore } from '@/store/user';
-import { authSelectors } from '@/store/user/slices/auth/selectors';
-import { useVideoStore } from '@/store/video';
-import { createVideoSelectors } from '@/store/video/selectors';
-import { useVideoGenerationConfigParam } from '@/store/video/slices/generationConfig/hooks';
-
-import PromptTitle from './Title';
-
-interface PromptInputProps {
- disableAnimation?: boolean;
- showTitle?: boolean;
-}
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- box-shadow:
- ${cssVar.boxShadowTertiary},
- 0 0 0 ${cssVar.colorBgContainer},
- 0 32px 0 ${cssVar.colorBgContainer};
- `,
- container_dark: css`
- box-shadow:
- ${cssVar.boxShadowTertiary},
- 0 0 48px 32px ${cssVar.colorBgContainer},
- 0 32px 0 ${cssVar.colorBgContainer};
- `,
-}));
-
-const PromptInput = ({ showTitle = false }: PromptInputProps) => {
- const isDarkMode = useIsDark();
- const { t } = useTranslation('video');
- const { value, setValue } = useVideoGenerationConfigParam('prompt');
- const isCreating = useVideoStore(createVideoSelectors.isCreating);
- const createVideo = useVideoStore((s) => s.createVideo);
- const isLogin = useUserStore(authSelectors.isLogin);
-
- // Read prompt from query parameter
- const [promptParam, setPromptParam] = useQueryState('prompt');
- const hasProcessedPrompt = useRef(false);
-
- const handleGenerate = async () => {
- if (!isLogin) {
- loginRequired.redirect({ timeout: 2000 });
- return;
- }
-
- await createVideo();
- };
-
- // Auto-fill and auto-send when prompt query parameter is present
- useEffect(() => {
- if (promptParam && !hasProcessedPrompt.current && isLogin) {
- const decodedPrompt = decodeURIComponent(promptParam);
-
- setValue(decodedPrompt);
-
- hasProcessedPrompt.current = true;
-
- setPromptParam(null);
-
- setTimeout(async () => {
- await createVideo();
- }, 100);
- }
- }, [promptParam, isLogin, setValue, setPromptParam, createVideo]);
-
- const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {
- if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
- e.preventDefault();
- if (!isCreating && value.trim()) {
- handleGenerate();
- }
- }
- };
-
- return (
- <Flexbox gap={32} width={'100%'}>
- {showTitle && <PromptTitle />}
- <Flexbox gap={8}>
- <ChatInput
- className={cx(styles.container, isDarkMode && styles.container_dark)}
- styles={{ body: { padding: 8 } }}
- >
- <Flexbox horizontal align="flex-end" gap={12} height={'100%'} width={'100%'}>
- <TextArea
- autoSize={{ maxRows: 6, minRows: 3 }}
- placeholder={t('config.prompt.placeholder')}
- value={value}
- variant={'borderless'}
- style={{
- borderRadius: 0,
- padding: 0,
- }}
- onChange={(e) => setValue(e.target.value)}
- onKeyDown={handleKeyDown}
- />
- <Button
- disabled={!value}
- icon={Sparkles}
- loading={isCreating}
- size={'large'}
- type={'primary'}
- style={{
- fontWeight: 500,
- height: 64,
- minWidth: 64,
- width: 64,
- }}
- title={
- isCreating ? t('generation.status.generating') : t('generation.actions.generate')
- }
- onClick={handleGenerate}
- />
- </Flexbox>
- </ChatInput>
- <VideoFreeQuotaInfo />
- </Flexbox>
- </Flexbox>
- );
-};
-
-export default PromptInput;
diff --git a/src/routes/(main)/video/features/VideoWorkspace/Content.tsx b/src/routes/(main)/video/features/VideoWorkspace/Content.tsx
deleted file mode 100644
index cc9bd655866..00000000000
--- a/src/routes/(main)/video/features/VideoWorkspace/Content.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-'use client';
-
-import { useVideoStore } from '@/store/video';
-import { generationBatchSelectors, videoGenerationTopicSelectors } from '@/store/video/selectors';
-
-import GenerationFeed from '../GenerationFeed';
-import PromptInput from '../PromptInput';
-import EmptyState from './EmptyState';
-import SkeletonList from './SkeletonList';
-
-const VideoWorkspaceContent = () => {
- const activeTopicId = useVideoStore(videoGenerationTopicSelectors.activeGenerationTopicId);
- const useFetchGenerationBatches = useVideoStore((s) => s.useFetchGenerationBatches);
- const isCurrentGenerationTopicLoaded = useVideoStore(
- generationBatchSelectors.isCurrentGenerationTopicLoaded,
- );
- useFetchGenerationBatches(activeTopicId);
- const currentBatches = useVideoStore(generationBatchSelectors.currentGenerationBatches);
- const hasGenerations = currentBatches && currentBatches.length > 0;
-
- if (!isCurrentGenerationTopicLoaded) {
- return <SkeletonList />;
- }
-
- if (!hasGenerations) return <EmptyState />;
-
- return (
- <>
- <GenerationFeed key={activeTopicId} />
- <PromptInput disableAnimation={true} showTitle={false} />
- </>
- );
-};
-
-export default VideoWorkspaceContent;
diff --git a/src/routes/(main)/video/features/VideoWorkspace/EmptyState.tsx b/src/routes/(main)/video/features/VideoWorkspace/EmptyState.tsx
deleted file mode 100644
index 0c1b68b1fcf..00000000000
--- a/src/routes/(main)/video/features/VideoWorkspace/EmptyState.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Center } from '@lobehub/ui';
-import { memo } from 'react';
-
-import PromptInput from '../PromptInput';
-
-const EmptyState = memo(() => {
- return (
- <Center height={'calc(100vh - 180px)'}>
- <PromptInput showTitle={true} />
- </Center>
- );
-});
-
-export default EmptyState;
diff --git a/src/routes/(main)/video/features/VideoWorkspace/index.tsx b/src/routes/(main)/video/features/VideoWorkspace/index.tsx
deleted file mode 100644
index f5aa548902f..00000000000
--- a/src/routes/(main)/video/features/VideoWorkspace/index.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-'use client';
-
-import { useQueryState } from '@/hooks/useQueryParam';
-import { useVideoStore } from '@/store/video';
-
-import Content from './Content';
-import EmptyState from './EmptyState';
-
-const VideoWorkspace = () => {
- const [topic] = useQueryState('topic');
- const isCreatingWithNewTopic = useVideoStore((s) => s.isCreatingWithNewTopic);
-
- if (!topic || isCreatingWithNewTopic) {
- return <EmptyState />;
- }
-
- return <Content />;
-};
-
-export default VideoWorkspace;
diff --git a/src/routes/(main)/video/index.tsx b/src/routes/(main)/video/index.tsx
deleted file mode 100644
index 796475d55d0..00000000000
--- a/src/routes/(main)/video/index.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { memo } from 'react';
-
-import NavHeader from '@/features/NavHeader';
-import WideScreenContainer from '@/features/WideScreenContainer';
-import WideScreenButton from '@/features/WideScreenContainer/WideScreenButton';
-
-import VideoWorkspace from './features/VideoWorkspace';
-
-const DesktopVideoPage = memo(() => {
- return (
- <>
- <NavHeader right={<WideScreenButton />} />
- <Flexbox height={'100%'} style={{ overflowY: 'auto', position: 'relative' }} width={'100%'}>
- <WideScreenContainer height={'100%'} wrapperStyle={{ height: '100%' }}>
- <VideoWorkspace />
- </WideScreenContainer>
- </Flexbox>
- </>
- );
-});
-
-DesktopVideoPage.displayName = 'DesktopVideoPage';
-
-export default DesktopVideoPage;
diff --git a/src/spa/router/desktopRouter.config.desktop.tsx b/src/spa/router/desktopRouter.config.desktop.tsx
index 4e840b02abe..83be7b6d19f 100644
--- a/src/spa/router/desktopRouter.config.desktop.tsx
+++ b/src/spa/router/desktopRouter.config.desktop.tsx
@@ -9,6 +9,10 @@ import {
import DesktopOnboarding from '@/routes/(desktop)/desktop-onboarding';
// Layouts — sync import (Electron local, no network overhead)
import DesktopMainLayout from '@/routes/(main)/_layout';
+import ImagePage from '@/routes/(main)/(create)/image';
+import DesktopImageLayout from '@/routes/(main)/(create)/image/_layout';
+import VideoPage from '@/routes/(main)/(create)/video';
+import DesktopVideoLayout from '@/routes/(main)/(create)/video/_layout';
// Pages — sync import
import AgentPage from '@/routes/(main)/agent';
import DesktopChatLayout from '@/routes/(main)/agent/_layout';
@@ -43,8 +47,6 @@ import EvalCaseDetailPage from '@/routes/(main)/eval/bench/[benchmarkId]/runs/[r
import GroupPage from '@/routes/(main)/group';
import DesktopGroupLayout from '@/routes/(main)/group/_layout';
import GroupProfilePage from '@/routes/(main)/group/profile';
-import ImagePage from '@/routes/(main)/image';
-import DesktopImageLayout from '@/routes/(main)/image/_layout';
import DesktopMemoryLayout from '@/routes/(main)/memory/_layout';
import MemoryHomePage from '@/routes/(main)/memory/(home)';
import MemoryActivitiesPage from '@/routes/(main)/memory/activities';
@@ -64,8 +66,6 @@ import ResourceLibrarySlugPage from '@/routes/(main)/resource/library/[slug]';
import SettingsTabPage from '@/routes/(main)/settings';
import SettingsLayout from '@/routes/(main)/settings/_layout';
import { ProviderDetailPage, ProviderLayout } from '@/routes/(main)/settings/provider';
-import VideoPage from '@/routes/(main)/video';
-import DesktopVideoLayout from '@/routes/(main)/video/_layout';
import ShareTopicPage from '@/routes/share/t/[id]';
import ShareTopicLayout from '@/routes/share/t/[id]/_layout';
import { ErrorBoundary, redirectElement } from '@/utils/router';
diff --git a/src/spa/router/desktopRouter.config.tsx b/src/spa/router/desktopRouter.config.tsx
index fa1b6607c20..ec043668323 100644
--- a/src/spa/router/desktopRouter.config.tsx
+++ b/src/spa/router/desktopRouter.config.tsx
@@ -406,12 +406,15 @@ export const desktopRoutes: RouteObject[] = [
{
children: [
{
- element: dynamicElement(() => import('@/routes/(main)/video'), 'Desktop > Video'),
+ element: dynamicElement(
+ () => import('@/routes/(main)/(create)/video'),
+ 'Desktop > Video',
+ ),
index: true,
},
],
element: dynamicLayout(
- () => import('@/routes/(main)/video/_layout'),
+ () => import('@/routes/(main)/(create)/video/_layout'),
'Desktop > Video > Layout',
),
errorElement: <ErrorBoundary resetPath="/video" />,
@@ -422,12 +425,15 @@ export const desktopRoutes: RouteObject[] = [
{
children: [
{
- element: dynamicElement(() => import('@/routes/(main)/image'), 'Desktop > Image'),
+ element: dynamicElement(
+ () => import('@/routes/(main)/(create)/image'),
+ 'Desktop > Image',
+ ),
index: true,
},
],
element: dynamicLayout(
- () => import('@/routes/(main)/image/_layout'),
+ () => import('@/routes/(main)/(create)/image/_layout'),
'Desktop > Image > Layout',
),
errorElement: <ErrorBoundary resetPath="/image" />,
diff --git a/src/store/aiInfra/slices/aiProvider/action.ts b/src/store/aiInfra/slices/aiProvider/action.ts
index 55ac14e2e28..e54d2b33d0a 100644
--- a/src/store/aiInfra/slices/aiProvider/action.ts
+++ b/src/store/aiInfra/slices/aiProvider/action.ts
@@ -1,7 +1,12 @@
-import { getModelPropertyWithFallback, resolveImageSinglePrice } from '@lobechat/model-runtime';
+import {
+ getModelPropertyWithFallback,
+ resolveImageSinglePrice,
+ resolveVideoSinglePrice,
+} from '@lobechat/model-runtime';
import { uniqBy } from 'es-toolkit/compat';
import {
type AIImageModelCard,
+ type AIVideoModelCard,
type EnabledAiModel,
type LobeDefaultAiModelListItem,
type ModelAbilities,
@@ -32,12 +37,14 @@ import { AiProviderSourceEnum } from '@/types/aiProvider';
export type ProviderModelListItem = {
abilities: ModelAbilities;
approximatePricePerImage?: number;
+ approximatePricePerVideo?: number;
contextWindowTokens?: number;
description?: string;
displayName: string;
id: string;
parameters?: ModelParamsSchema;
pricePerImage?: number;
+ pricePerVideo?: number;
pricing?: Pricing;
releasedAt?: string;
};
@@ -137,19 +144,27 @@ export const normalizeVideoModel = async (
model.providerId,
);
+ const modelWithPricing = model as AIVideoModelCard;
+ const fallbackPricingPromise = modelWithPricing.pricing
+ ? Promise.resolve<Pricing | undefined>(modelWithPricing.pricing)
+ : getModelPropertyWithFallback<Pricing | undefined>(model.id, 'pricing', model.providerId);
+
const fallbackDescriptionPromise = getModelPropertyWithFallback<string | undefined>(
model.id,
'description',
model.providerId,
);
- const [fallbackParameters, fallbackDescription] = await Promise.all([
+ const [fallbackParameters, fallbackPricing, fallbackDescription] = await Promise.all([
fallbackParametersPromise,
+ fallbackPricingPromise,
fallbackDescriptionPromise,
]);
const parameters = model.parameters ?? fallbackParameters;
+ const pricing = fallbackPricing;
const description = fallbackDescription;
+ const { approximatePrice } = resolveVideoSinglePrice(pricing);
return {
abilities: (model.abilities || {}) as ModelAbilities,
@@ -159,6 +174,8 @@ export const normalizeVideoModel = async (
releasedAt: model.releasedAt,
...(parameters && { parameters }),
...(description && { description }),
+ ...(pricing && { pricing }),
+ ...(typeof approximatePrice === 'number' && { approximatePricePerVideo: approximatePrice }),
};
};
diff --git a/src/store/global/initialState.ts b/src/store/global/initialState.ts
index d4168645c41..ad863ed86b0 100644
--- a/src/store/global/initialState.ts
+++ b/src/store/global/initialState.ts
@@ -113,6 +113,7 @@ export interface SystemStatus {
hideTopicSharePrivacyWarning?: boolean;
imagePanelWidth: number;
imageTopicPanelWidth?: number;
+ imageTopicViewMode?: 'grid' | 'list';
/**
* Do not enable PGLite on app initialization, only enable when user manually turns it on
*/
@@ -179,6 +180,7 @@ export interface SystemStatus {
topicPageSize?: number;
videoPanelWidth: number;
videoTopicPanelWidth?: number;
+ videoTopicViewMode?: 'grid' | 'list';
zenMode?: boolean;
}
@@ -229,6 +231,7 @@ export const INITIAL_STATUS = {
hideThreadLimitAlert: false,
hideTopicSharePrivacyWarning: false,
imagePanelWidth: 320,
+ imageTopicViewMode: 'grid' as const,
imageTopicPanelWidth: 80,
knowledgeBaseModalViewMode: 'list' as const,
leftPanelWidth: 320,
@@ -259,6 +262,7 @@ export const INITIAL_STATUS = {
tokenDisplayFormatShort: true,
topicPageSize: 20,
videoPanelWidth: 320,
+ videoTopicViewMode: 'grid' as const,
videoTopicPanelWidth: 80,
zenMode: false,
} satisfies SystemStatus;
diff --git a/src/store/global/selectors/systemStatus.ts b/src/store/global/selectors/systemStatus.ts
index 0140361680b..7c6f56311bc 100644
--- a/src/store/global/selectors/systemStatus.ts
+++ b/src/store/global/selectors/systemStatus.ts
@@ -42,8 +42,10 @@ const portalWidth = (s: GlobalState) => s.status.portalWidth || 400;
const filePanelWidth = (s: GlobalState) => s.status.filePanelWidth;
const groupAgentBuilderPanelWidth = (s: GlobalState) => s.status.groupAgentBuilderPanelWidth || 360;
const imagePanelWidth = (s: GlobalState) => s.status.imagePanelWidth;
+const imageTopicViewMode = (s: GlobalState) => s.status.imageTopicViewMode || 'grid';
const imageTopicPanelWidth = (s: GlobalState) => s.status.imageTopicPanelWidth;
const videoPanelWidth = (s: GlobalState) => s.status.videoPanelWidth;
+const videoTopicViewMode = (s: GlobalState) => s.status.videoTopicViewMode || 'grid';
const videoTopicPanelWidth = (s: GlobalState) => s.status.videoTopicPanelWidth;
const showVideoPanel = (s: GlobalState) => s.status.showVideoPanel;
const showVideoTopicPanel = (s: GlobalState) => s.status.showVideoTopicPanel;
@@ -84,6 +86,7 @@ export const systemStatusSelectors = {
groupAgentBuilderPanelWidth,
hidePWAInstaller,
imagePanelWidth,
+ imageTopicViewMode,
imageTopicPanelWidth,
inZenMode,
isNotificationRead,
@@ -113,6 +116,7 @@ export const systemStatusSelectors = {
topicGroupKeys,
topicPageSize,
videoPanelWidth,
+ videoTopicViewMode,
videoTopicPanelWidth,
wideScreen,
};
diff --git a/src/store/image/slices/generationTopic/action.ts b/src/store/image/slices/generationTopic/action.ts
index 709ba935cda..b1128e8e710 100644
--- a/src/store/image/slices/generationTopic/action.ts
+++ b/src/store/image/slices/generationTopic/action.ts
@@ -56,18 +56,15 @@ export class GenerationTopicActionImpl {
};
switchGenerationTopic = (topicId: string): void => {
- // Check if topic exists
- const currentTopics = this.#get().generationTopics;
- const targetTopic = currentTopics.find((topic) => topic.id === topicId);
+ // Don't update if already active
+ if (this.#get().activeGenerationTopicId === topicId) return;
- if (!targetTopic) {
+ const topic = generationTopicSelectors.getGenerationTopicById(topicId)(this.#get());
+ if (!topic) {
console.warn(`Generation topic with id ${topicId} not found`);
return;
}
- // Don't update if already active
- if (this.#get().activeGenerationTopicId === topicId) return;
-
this.#set({ activeGenerationTopicId: topicId }, false, n('switchGenerationTopic'));
};
diff --git a/src/store/video/slices/generationTopic/action.ts b/src/store/video/slices/generationTopic/action.ts
index fc87cea0a6a..c2a4c05091b 100644
--- a/src/store/video/slices/generationTopic/action.ts
+++ b/src/store/video/slices/generationTopic/action.ts
@@ -265,14 +265,6 @@ export const createGenerationTopicSlice: StateCreator<
},
switchGenerationTopic: (topicId: string) => {
- const currentTopics = get().generationTopics;
- const targetTopic = currentTopics.find((topic) => topic.id === topicId);
-
- if (!targetTopic) {
- console.warn(`Generation topic with id ${topicId} not found`);
- return;
- }
-
if (get().activeGenerationTopicId === topicId) return;
set({ activeGenerationTopicId: topicId }, false, n('switchGenerationTopic'));