UI: Agregar botones de copiar en paneles de debug de ChatItem y MessageBubble
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m2s

This commit is contained in:
2025-12-02 21:06:51 -06:00
parent f4ed9488bd
commit 371b5676fb
2 changed files with 36 additions and 0 deletions

View File

@@ -43,6 +43,16 @@
v-if="showDebug"
class="mx-2 mb-2 p-2 rounded bg-gray-900 border border-gray-700 text-xs font-mono overflow-x-auto"
>
<div class="flex items-center justify-between mb-1">
<span class="text-gray-400">Chat:</span>
<button
@click.stop="copyToClipboard(JSON.stringify(chat, null, 2))"
class="px-2 py-1 rounded bg-gray-700 hover:bg-gray-600 text-gray-300"
title="Copiar al portapapeles"
>
<UIcon name="i-lucide-copy" class="w-3 h-3" />
</button>
</div>
<pre class="text-green-400 whitespace-pre-wrap">{{ JSON.stringify(chat, null, 2) }}</pre>
</div>
</div>
@@ -71,6 +81,14 @@ defineEmits<{
const showDebug = ref(false)
const copyToClipboard = async (text: string) => {
try {
await navigator.clipboard.writeText(text)
} catch (err) {
console.error('Failed to copy:', err)
}
}
const formatTime = (date: Date) => {
const d = new Date(date)
const now = new Date()

View File

@@ -52,6 +52,16 @@
v-if="showDebug"
class="max-w-[90%] mt-1 p-2 rounded bg-gray-900 border border-gray-700 text-xs font-mono overflow-x-auto"
>
<div class="flex items-center justify-between mb-1">
<span class="text-gray-400">Message:</span>
<button
@click="copyToClipboard(JSON.stringify(message, null, 2))"
class="px-2 py-1 rounded bg-gray-700 hover:bg-gray-600 text-gray-300"
title="Copiar al portapapeles"
>
<UIcon name="i-lucide-copy" class="w-3 h-3" />
</button>
</div>
<pre class="text-green-400 whitespace-pre-wrap">{{ JSON.stringify(message, null, 2) }}</pre>
</div>
</div>
@@ -77,6 +87,14 @@ const props = defineProps<Props>()
const showDebug = ref(false)
const copyToClipboard = async (text: string) => {
try {
await navigator.clipboard.writeText(text)
} catch (err) {
console.error('Failed to copy:', err)
}
}
const formatTime = (date: Date) => {
return new Date(date).toLocaleTimeString('es-AR', {
hour: '2-digit',