| 1 | package provider |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | ) |
| 6 | |
| 7 | func TestModelMessagesStripsVisionSummaryMetadataButKeepsSummaryContent(t *testing.T) { |
| 8 | for _, role := range []Role{RoleUser, RoleTool} { |
| 9 | stored := []Message{{ |
| 10 | Role: role, |
| 11 | Content: "question\n\n<reasonix-image-context>chart</reasonix-image-context>", |
| 12 | VisionSummary: &VisionSummary{ |
| 13 | Version: 1, PromptVersion: "image-summary-v1", ModelRef: "vision/model", |
| 14 | ImageDigests: []string{"digest"}, Summary: "chart", |
| 15 | }, |
| 16 | }} |
| 17 | model := ModelMessages(stored) |
| 18 | if len(model) != 1 || model[0].VisionSummary != nil || model[0].Content != stored[0].Content { |
| 19 | t.Fatalf("provider projection = %+v", model) |
| 20 | } |
| 21 | if stored[0].VisionSummary == nil { |
| 22 | t.Fatal("provider projection mutated stored metadata") |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 |