Keep Gemini image edits role-aware on the server path
The server now resolves source, identity, and style artifacts separately, emits role-labeled Gemini parts, and logs the effective request shape so deployed debugging can confirm which references reached upstream.
Constraint: The test deployment must stay on gemini-3.1-flash-image-preview while gaining better multi-image editing semantics
Rejected: Change the default model to gemini-3-pro-image-preview | test-server parity required keeping flash as default
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Preserve the source/identity/style logging until the upstream gateway exposes equivalent structured traces
Tested: go test ./internal/server
Tested: image img2img against http://101.42.99.35:18080/v1 (job_5af212df2c27)
Not-tested: Non-Gemini multi-image providers still fall back to the first reference only
returnfmt.Sprintf("Image %d is the source scene. Keep the scene layout, camera framing, main action, and spatial relationships from this image.",index+1)
case"identity":
returnfmt.Sprintf("Image %d is the identity reference. Keep the character face, hair, accessories, and recognizability from this image.",index+1)
case"style":
returnfmt.Sprintf("Image %d is the style reference. Apply only the visual style, palette, texture, and illustration treatment from this image. Do not change the character identity because of this image.",index+1)
case"reference":
returnfmt.Sprintf("Image %d is an additional reference. Use it only for supporting details explicitly requested in the prompt.",index+1)
t.Fatalf("expected prompt plus three labeled images, got %#v",content["parts"])
}
ifgot:=parts[1].(map[string]any)["text"];got!="Image 1 is the source scene. Keep the scene layout, camera framing, main action, and spatial relationships from this image."{
t.Fatalf("unexpected source label: %#v",got)
}
ifgot:=parts[3].(map[string]any)["text"];got!="Image 2 is the identity reference. Keep the character face, hair, accessories, and recognizability from this image."{
t.Fatalf("unexpected identity label: %#v",got)
}
ifgot:=parts[5].(map[string]any)["text"];got!="Image 3 is the style reference. Apply only the visual style, palette, texture, and illustration treatment from this image. Do not change the character identity because of this image."{