Skip to content

feat: multimodal attachments — file→text, transcription, native image/audio/video (+ CLI @path//attach)#48

Merged
mudler merged 15 commits into
masterfrom
feat/multimodal-attachments-phase1b
Jul 5, 2026
Merged

feat: multimodal attachments — file→text, transcription, native image/audio/video (+ CLI @path//attach)#48
mudler merged 15 commits into
masterfrom
feat/multimodal-attachments-phase1b

Conversation

@localai-bot

@localai-bot localai-bot commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

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:

  • @path inline> summarize @report.pdf (resolve-if-exists: only real files attach; prose @mentions stay literal).
  • /attach — stage files across turns; /attach --transcribe|-t <audio> forces transcription; /attach lists, /attach clear resets.

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) and Describe (vision) + DataURI; models auto-selected by usecase.
  • attachments/Sniff + Route decision table, a fail-safe FetchCapabilities client (LocalAI's /v1/models/capabilities), and the Apply orchestrator producing Result{Parts, TextPreamble, Blocked}.

Wiring:

  • chat.ContentPart implements cogito's TypedMultimedia (image/audio/video); SendMessage(text, parts...) widened; SendWithAttachments(ctx, text, files, overrides) resolves capabilities, converts/transcribes, and sends one multimodal turn, returning blocked files.
  • slash parses @path + /attach; a shared attachstage.BuildSend combines staged + inline files and the transcribe-override map; the CLI REPL and TUI both wire it and surface blocked as notices, clearing staging on success only.

Depends on cogito's native content-part support (mudler/cogito#63, merged) — bumped here.

Routing (capability-aware)

Attached Active model Treatment
Image vision native image_url
Image text-only blocked (switch models)
Audio audio-capable native input_audio (or -t → transcribe)
Audio text-only transcribe (parakeet)
Video video-capable native video_url
Document / text any converted to text

Testing

Every pure seam is unit-tested: extraction (per-format fixtures), specialist (httptest wire assertions), attachments (full Route table, Apply incl. 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 @path message 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_videovisionModel config is wired ahead for these), and the desktop (Dante) attachment UI.

🤖 Generated with Claude Code

@localai-bot localai-bot changed the title feat: multimodal attachments core (Phase 1b) — extraction, specialist, routing feat: multimodal attachments — file→text, transcription, native image/audio/video (+ CLI @path//attach) Jul 5, 2026
@mudler mudler merged commit f7a19ce into master Jul 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants