UI: Agregar botones de copiar en paneles de debug de Mensajes
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m2s
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m2s
This commit is contained in:
@@ -32,7 +32,17 @@
|
||||
>
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<span class="text-gray-400">Last SSE Event:</span>
|
||||
<span class="text-gray-500">{{ lastEvent?.timestamp?.toLocaleTimeString() || 'N/A' }}</span>
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-gray-500">{{ lastEvent?.timestamp?.toLocaleTimeString() || 'N/A' }}</span>
|
||||
<button
|
||||
v-if="lastEvent"
|
||||
@click="copyToClipboard(JSON.stringify(lastEvent, 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>
|
||||
</div>
|
||||
<pre v-if="lastEvent" class="text-green-400 whitespace-pre-wrap overflow-x-auto max-h-40">{{ JSON.stringify(lastEvent, null, 2) }}</pre>
|
||||
<p v-else class="text-gray-500">No events received yet</p>
|
||||
@@ -73,7 +83,16 @@
|
||||
v-if="showChatsDebug"
|
||||
class="mt-2 p-2 rounded bg-gray-900 border border-gray-700 text-xs font-mono max-h-60 overflow-auto"
|
||||
>
|
||||
<div class="text-gray-400 mb-1">Chats ({{ chats.length }}):</div>
|
||||
<div class="flex items-center justify-between mb-1">
|
||||
<span class="text-gray-400">Chats ({{ chats.length }}):</span>
|
||||
<button
|
||||
@click="copyToClipboard(JSON.stringify(chats, 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(chats, null, 2) }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
@@ -127,7 +146,16 @@
|
||||
v-if="showSelectedChatDebug"
|
||||
class="mt-2 p-2 rounded bg-gray-900 border border-gray-700 text-xs font-mono max-h-40 overflow-auto"
|
||||
>
|
||||
<div class="text-gray-400 mb-1">Selected Chat:</div>
|
||||
<div class="flex items-center justify-between mb-1">
|
||||
<span class="text-gray-400">Selected Chat:</span>
|
||||
<button
|
||||
@click="copyToClipboard(JSON.stringify(selectedChat, 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(selectedChat, null, 2) }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
@@ -229,6 +257,15 @@ const filteredChats = computed(() => {
|
||||
)
|
||||
})
|
||||
|
||||
// Copy to clipboard function
|
||||
const copyToClipboard = async (text: string) => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text)
|
||||
} catch (err) {
|
||||
console.error('Failed to copy:', err)
|
||||
}
|
||||
}
|
||||
|
||||
const handleSendMessage = async (content: string) => {
|
||||
if (!selectedInstance.value?.value || !selectedChat.value) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user