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