feat: add image attachments for vision models
ci / checks (push) Successful in 56s
ci / test (push) Successful in 1m1s
ci / chart (push) Successful in 6s
ci / web (push) Successful in 29s
ci / docker (push) Successful in 2m37s
ci / publish-edge-image (push) Successful in 11s
ci / publish-edge-chart (push) Successful in 4s

A chat line can carry up to four images, each capped at 5 MB and
sniffed from its bytes. Uploads go to a room route first, the message
references the ids, and the bytes are served back to members; an
upload no message claims within an hour is swept on the next send.

Images only make sense when the model can look at them, and the
catalog's answer is tri-state, so the gate is a stored fact, not a
guess: the provider listing remembers supports_vision per kind and
model, the upload and send routes refuse when the room's effective
model is not a known vision model, and the composer hides the attach
button on the same fact, which rides the room payload. At turn time
the fact goes to the host agent, which sends the blocks on a vision
model and leaves a note where each image was on the rest.
This commit is contained in:
vhaudiquet committed 2026-12-01 21:59:53 +01:00
1 parent acc545ede7
commit 2e17e7463c
18 files changed
+624 -46

No files matched your search

+19 -1
View File
@@ -5,7 +5,12 @@ import { fullTime, relativeTime } from '~/utils/format'
import { memberColorVar } from '~/utils/member'
import { renderMarkdown } from '~/utils/markdown'
const props = defineProps<{ message: Message; color?: string | null; avatar?: string | null }>()
const props = defineProps<{
message: Message
roomId: string
color?: string | null
avatar?: string | null
}>()
const html = computed(() => renderMarkdown(props.message.text))
const style = computed(() => ({ '--member': memberColorVar(props.color) }))
@@ -32,6 +37,19 @@ const style = computed(() => ({ '--member': memberColorVar(props.color) }))
<span class="msg-time" :title="fullTime(message.created_at)">{{ relativeTime(message.created_at) }}</span>
</div>
<div class="msg-text" v-html="html"></div>
<div v-if="message.attachments?.length" class="msg-attachments">
<a
v-for="att in message.attachments"
:key="att.id"
class="msg-attachment"
:href="`/api/rooms/${roomId}/attachments/${att.id}`"
target="_blank"
rel="noopener"
:aria-label="`Open attached image, ${att.mime.replace('image/', '')}, ${Math.ceil(att.size / 1024)} KB`"
>
<img :src="`/api/rooms/${roomId}/attachments/${att.id}`" alt="" loading="lazy">
</a>
</div>
</div>
</div>
</template>