MCPcopy Index your code
hub / github.com/coder/coder / normalizeMessages

Function normalizeMessages

coderd/x/chatd/chatdebug/model.go:726–735  ·  view source on GitHub ↗

--------------- helper functions --------------- normalizeMessages converts a fantasy.Prompt into a slice of normalizedMessage values with bounded part metadata.

(prompt fantasy.Prompt)

Source from the content-addressed store, hash-verified

724// normalizeMessages converts a fantasy.Prompt into a slice of
725// normalizedMessage values with bounded part metadata.
726func normalizeMessages(prompt fantasy.Prompt) []normalizedMessage {
727 msgs := make([]normalizedMessage, 0, len(prompt))
728 for _, m := range prompt {
729 msgs = append(msgs, normalizedMessage{
730 Role: string(m.Role),
731 Parts: normalizeMessageParts(m.Content),
732 })
733 }
734 return msgs
735}
736
737// boundText truncates s to MaxMessagePartTextLength runes, appending
738// an ellipsis if truncation occurs.

Callers 2

normalizeCallFunction · 0.85
normalizeObjectCallFunction · 0.85

Calls 1

normalizeMessagePartsFunction · 0.85

Tested by

no test coverage detected