Files
majordomo/imagegen/edit_test.go
T
steve 434d721b99
CI / Tidy (pull_request) Successful in 10m9s
CI / Build & Test (pull_request) Successful in 11m16s
Adversarial Review (Gadfly) / review (pull_request) Successful in 14m51s
feat: audio surfaces (TTS + transcription), imagegen.Editor, llamaswap health probe
- New leaf package `audio` (ADR-0017): SpeechModel/SpeechProvider and
  TranscriptionModel/TranscriptionProvider with imagegen conventions
  (zero value = backend default, functional options + Apply, bytes
  in/out, never URLs). Root re-exports added.
- imagegen.Editor (ADR-0018): optional image-to-image interface —
  EditRequest carries the generation knobs plus Init image and
  denoising Strength; separate interface so existing Models keep
  compiling.
- provider/llamaswap implements all of it: POST /v1/audio/speech (JSON,
  raw-audio response, MIME from Content-Type with format fallback),
  POST /v1/audio/transcriptions (multipart, response_format=json),
  ListVoices (GET /v1/audio/voices?model=, tolerant of string-list and
  object-list shapes), POST /sdapi/v1/img2img (txt2img wire +
  init_images/denoising_strength, shared image decode), and Health(ctx)
  (GET /health) — a cheap liveness probe for often-offline hosts.
- Hermetic httptest coverage for every new wire shape and validation
  path; README sections + support-matrix footnote updated in the same
  commit (also corrects the stale /v1/images/generations claim — the
  image path has been SDAPI since the seed fix).

First consumer: mort's llamaswap media tool cluster (status / image /
TTS / STT agent tools against the netherstorm host).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AXQxVhXBw8PwFAtsVrXSmj
2026-07-11 23:24:14 -04:00

27 lines
763 B
Go

package imagegen
import "testing"
func TestEditRequestApply(t *testing.T) {
base := EditRequest{Prompt: "make it night", Init: Image{MIME: "image/png", Data: []byte{1}}}
got := base.Apply(WithEditStrength(0.7), WithEditN(2), WithEditSeed(42))
if got.Prompt != "make it night" || len(got.Init.Data) != 1 {
t.Errorf("got = %+v", got)
}
if got.Strength == nil || *got.Strength != 0.7 {
t.Errorf("Strength = %v, want 0.7", got.Strength)
}
if got.N != 2 {
t.Errorf("N = %d, want 2", got.N)
}
if got.Seed == nil || *got.Seed != 42 {
t.Errorf("Seed = %v, want 42", got.Seed)
}
// Apply must not mutate the receiver (options apply to a copy).
if base.Strength != nil || base.N != 0 || base.Seed != nil {
t.Errorf("base mutated: %+v", base)
}
}