ant: improve encapsulation
- Replace string literals with package constants for message roles and content types.
- Create UserStringMessage helper function to simplify user message creation
- Replace manual Content creation with ant.StringContent()
Co-Authored-By: sketch <hello@sketch.dev>
diff --git a/dockerimg/createdockerfile.go b/dockerimg/createdockerfile.go
index 7b4bb13..856303b 100644
--- a/dockerimg/createdockerfile.go
+++ b/dockerimg/createdockerfile.go
@@ -251,15 +251,9 @@
}
for _, name := range slices.Sorted(maps.Keys(initFiles)) {
- msg.Content = append(msg.Content, ant.Content{
- Type: ant.ContentTypeText,
- Text: fmt.Sprintf("Here is the contents %s:\n<file>\n%s\n</file>\n\n", name, initFiles[name]),
- })
+ msg.Content = append(msg.Content, ant.StringContent(fmt.Sprintf("Here is the contents %s:\n<file>\n%s\n</file>\n\n", name, initFiles[name])))
}
- msg.Content = append(msg.Content, ant.Content{
- Type: ant.ContentTypeText,
- Text: "Now call the dockerfile tool.",
- })
+ msg.Content = append(msg.Content, ant.StringContent("Now call the dockerfile tool."))
res, err := convo.SendMessage(msg)
if err != nil {
return "", err