feat: multimodal attachments — file→text, transcription, native image/audio/video (+ CLI @path//attach)#48
Merged
Conversation
…path attachments for end-of-run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
End-to-end multimodal attachments for nib: attach images/audio/video and documents to a chat. The app inspects the active model's capabilities and routes each file — native content part to a capable model, transcription (parakeet) for audio a text-only model can't hear, or document→text conversion — then sends one turn.
Reachable today from the CLI and TUI:
@pathinline —> summarize @report.pdf(resolve-if-exists: only real files attach; prose@mentionsstay literal)./attach— stage files across turns;/attach --transcribe|-t <audio>forces transcription;/attachlists,/attach clearresets.How it's layered
Core (pure-Go, no cgo/binaries):
extraction/— file→text: PDF via go-pdfium+wazero (WASM), DOCX/XLSX/PPTX/EPUB via stdlib, plus a plain-text reader.specialist/— LocalAI delegation:Transcribe(→/audio/transcriptions, parakeet/whisper) andDescribe(vision) +DataURI; models auto-selected by usecase.attachments/—Sniff+Routedecision table, a fail-safeFetchCapabilitiesclient (LocalAI's/v1/models/capabilities), and theApplyorchestrator producingResult{Parts, TextPreamble, Blocked}.Wiring:
chat.ContentPartimplements cogito'sTypedMultimedia(image/audio/video);SendMessage(text, parts...)widened;SendWithAttachments(ctx, text, files, overrides)resolves capabilities, converts/transcribes, and sends one multimodal turn, returningblockedfiles.slashparses@path+/attach; a sharedattachstage.BuildSendcombines staged + inline files and the transcribe-override map; the CLI REPL and TUI both wire it and surfaceblockedas notices, clearing staging on success only.Depends on cogito's native content-part support (mudler/cogito#63, merged) — bumped here.
Routing (capability-aware)
image_urlinput_audio(or-t→ transcribe)video_urlTesting
Every pure seam is unit-tested:
extraction(per-format fixtures),specialist(httptest wire assertions),attachments(fullRoutetable,Applyincl. block + fail-fast),parseAtPaths/Resolve,attachstage.BuildSend,buildUserFragment,composeAttachments.go build ./...+ package suites green.Built subagent-driven with per-task spec+quality reviews and two whole-branch reviews. The final review caught and this PR fixes: native audio was shipping an empty
input_audio.format(now carried from the file extension), and a queued@pathmessage injected mid-run dropped its attachments (now held for end-of-run). The TUI interactive path was verified by code-reading; a manual smoke against a live LocalAI is the recommended pre-merge check.Follow-ups (not in this PR)
Builtin agent tools (
read_image/transcribe_audio/read_video—visionModelconfig is wired ahead for these), and the desktop (Dante) attachment UI.🤖 Generated with Claude Code