A message's attachments persist as metadata (messaging.Message.Media) and
cross the gateway wire, but the dashboard transcript rendered text only, so
a photo was invisible to the operator while the model had seen it.
The transcript view now carries the persisted metadata, and the browser
labels each attachment in the placeholder vocabulary the channels already
write into a message's text ('[photo]', '[document: report.pdf]'), with the
surviving metadata (mime, name, size, dimensions, duration) in the chip's
tooltip.
Bytes are never rendered: they are turn-scoped and stripped before a record
is stored, so there is nothing to fetch and no broken image or 404 link. The
platform file id is deliberately not served either -- it is a download
handle, not an address -- so the chip links out only when the attachment
itself carried a URL. A message with no attachments omits the media key, so
transcripts written before this change keep the payload they had.
32 lines
1.2 KiB
Vue
32 lines
1.2 KiB
Vue
<script setup lang="ts">
|
|
import { Paperclip } from "@lucide/vue";
|
|
|
|
import { mediaDetail, mediaLabel } from "./attachment";
|
|
import type { ChatMedia } from "./state";
|
|
|
|
/**
|
|
* One attachment a message carried, as the transcript shows it.
|
|
*
|
|
* The bytes are gone by design — they are turn-scoped and are stripped before
|
|
* the record is stored — so this is a labelled chip rather than a preview. It
|
|
* links out only when the attachment itself carried a URL; a platform file id
|
|
* is deliberately never rendered, because it is a handle rather than an
|
|
* address and a chip that 404s is worse than no chip.
|
|
*/
|
|
defineProps<{ attachment: ChatMedia }>();
|
|
</script>
|
|
|
|
<template>
|
|
<component
|
|
:is="attachment.url ? 'a' : 'span'"
|
|
:href="attachment.url"
|
|
:target="attachment.url ? '_blank' : undefined"
|
|
:rel="attachment.url ? 'noopener noreferrer' : undefined"
|
|
:title="mediaDetail(attachment)"
|
|
class="inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted px-2.5 py-1 text-xs font-medium text-muted-foreground"
|
|
>
|
|
<Paperclip aria-hidden="true" class="size-3.5 shrink-0" />
|
|
<span class="truncate">{{ mediaLabel(attachment) }}</span>
|
|
</component>
|
|
</template>
|