Fix: Usar UButton para debug y agregar logs de selección de archivos
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m10s

This commit is contained in:
2025-12-04 11:40:08 -06:00
parent 3ef09c7b4d
commit 91173775a4

View File

@@ -141,13 +141,13 @@
</div> </div>
<!-- Debug button --> <!-- Debug button -->
<button <UButton
@click="showDebug = !showDebug" variant="ghost"
class="p-2 rounded bg-gray-700 hover:bg-gray-600 text-gray-300" icon="i-lucide-bug"
class="text-gray-400"
title="Debug input state" title="Debug input state"
> @click="showDebug = !showDebug"
<UIcon name="i-lucide-bug" class="w-4 h-4" /> />
</button>
<!-- Send / Mic button --> <!-- Send / Mic button -->
<UButton <UButton
@@ -322,7 +322,9 @@ const attachmentMenuItems = [
// Methods // Methods
const handleFileSelect = (event: Event, type: string) => { const handleFileSelect = (event: Event, type: string) => {
console.log('[MessageInput] handleFileSelect called, type:', type)
const input = event.target as HTMLInputElement const input = event.target as HTMLInputElement
console.log('[MessageInput] input.files:', input.files?.length)
if (input.files && input.files.length > 0) { if (input.files && input.files.length > 0) {
addFiles(Array.from(input.files)) addFiles(Array.from(input.files))
input.value = '' // Reset input input.value = '' // Reset input
@@ -345,15 +347,19 @@ const formatFileSize = (bytes: number): string => {
} }
const addFiles = (files: File[]) => { const addFiles = (files: File[]) => {
console.log('[MessageInput] addFiles called with', files.length, 'files')
// Limit to 10 files // Limit to 10 files
const remaining = 10 - selectedFiles.value.length const remaining = 10 - selectedFiles.value.length
const toAdd = files.slice(0, remaining) const toAdd = files.slice(0, remaining)
console.log('[MessageInput] toAdd:', toAdd.length, 'files')
// Validate file sizes // Validate file sizes
const validFiles: File[] = [] const validFiles: File[] = []
for (const file of toAdd) { for (const file of toAdd) {
const mediaType = getFileMediaType(file) const mediaType = getFileMediaType(file)
const maxSize = MAX_SIZES[mediaType] const maxSize = MAX_SIZES[mediaType]
console.log('[MessageInput] Processing file:', file.name, 'type:', mediaType, 'size:', file.size)
if (file.size > maxSize) { if (file.size > maxSize) {
toast.add({ toast.add({
@@ -367,9 +373,12 @@ const addFiles = (files: File[]) => {
} }
} }
console.log('[MessageInput] validFiles:', validFiles.length)
if (validFiles.length > 0) { if (validFiles.length > 0) {
// Use spread operator to trigger reactivity // Use spread operator to trigger reactivity
selectedFiles.value = [...selectedFiles.value, ...validFiles] selectedFiles.value = [...selectedFiles.value, ...validFiles]
console.log('[MessageInput] selectedFiles now has', selectedFiles.value.length, 'files')
} }
} }