From 2aabc5b5d1679bd94fe6aaa522847779415a5f0b Mon Sep 17 00:00:00 2001 From: xds Date: Thu, 5 Feb 2026 22:50:56 +0300 Subject: [PATCH] fix --- src/views/CharacterDetailView.vue | 2 +- src/views/ImageGenerationView.vue | 54 ++++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/views/CharacterDetailView.vue b/src/views/CharacterDetailView.vue index 8793563..ea4a9c7 100644 --- a/src/views/CharacterDetailView.vue +++ b/src/views/CharacterDetailView.vue @@ -231,7 +231,7 @@ const qualityOptions = ref([{ const aspectRatio = ref({ key: "NINESIXTEEN", value: "9:16" }) const aspectRatioOptions = ref([ { key: "NINESIXTEEN", value: "9:16" }, - { key: "FOURTHIREE", value: "4:3" }, + { key: "FOURTHREE", value: "4:3" }, { key: "THIRDFOUR", value: "3:4" }, { key: "SIXTEENNINE", value: "16:9" } ]) diff --git a/src/views/ImageGenerationView.vue b/src/views/ImageGenerationView.vue index 50814ae..b8be33b 100644 --- a/src/views/ImageGenerationView.vue +++ b/src/views/ImageGenerationView.vue @@ -46,6 +46,8 @@ const activeAssetFilter = ref('all') const sendToTelegram = ref(false) const telegramId = ref(localStorage.getItem('telegram_id') || '') const isTelegramIdSaved = ref(!!localStorage.getItem('telegram_id')) +const isUploading = ref(false) +const fileInput = ref(null) const saveTelegramId = () => { if (telegramId.value) { @@ -64,7 +66,7 @@ const qualityOptions = ref([ const aspectRatio = ref({ key: "NINESIXTEEN", value: "9:16" }) const aspectRatioOptions = ref([ { key: "NINESIXTEEN", value: "9:16" }, - { key: "FOURTHIREE", value: "4:3" }, + { key: "FOURTHREE", value: "4:3" }, { key: "THIRDFOUR", value: "3:4" }, { key: "SIXTEENNINE", value: "16:9" } ]) @@ -139,6 +141,39 @@ const removeSelectedAsset = (index) => { selectedAssets.value.splice(index, 1) } +const triggerFileUpload = () => { + if (fileInput.value) fileInput.value.click() +} + +const onFileSelected = async (event) => { + const file = event.target.files[0] + if (!file) return + + isUploading.value = true + try { + // Upload without linked character (global asset) + await dataService.uploadAsset(file, null) + + // Reload assets to show the new one. + // ideally uploadAsset returns the new asset, but if not we reload. + // If it does return, we could push it to selectedAssets immediately. + // Let's assume we reload for now to be safe. + assetsFirst.value = 0 + await loadAssets() + + // Optional: Select the most recent asset if we want to be helpful + if (allAssets.value.length > 0) { + // Assuming the newest is first, we could: + // toggleAssetSelection(allAssets.value[0]) + } + } catch (e) { + console.error('Failed to upload asset', e) + } finally { + isUploading.value = false + if (event.target) event.target.value = '' // Clear input + } +} + // --- Generation Logic --- const handleGenerate = async () => { @@ -437,9 +472,18 @@ onMounted(() => {
-
@@ -607,7 +651,7 @@ onMounted(() => { gen.api_execution_time_seconds.toFixed(1) }}s {{ gen.token_usage - }} + }}