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

Function findUserMessage

coderd/exp_chats_test.go:136–143  ·  view source on GitHub ↗

findUserMessage returns the first user-role message from a slice of chat messages, failing the test if none is found.

(t testing.TB, messages []database.ChatMessage)

Source from the content-addressed store, hash-verified

134// findUserMessage returns the first user-role message from a slice of chat
135// messages, failing the test if none is found.
136func findUserMessage(t testing.TB, messages []database.ChatMessage) database.ChatMessage {
137 t.Helper()
138 idx := slices.IndexFunc(messages, func(m database.ChatMessage) bool {
139 return m.Role == database.ChatMessageRoleUser
140 })
141 require.NotEqual(t, -1, idx, "expected to find a user message")
142 return messages[idx]
143}
144
145type failNextChatSystemPromptStore struct {
146 database.Store

Calls 1

HelperMethod · 0.65

Tested by

no test coverage detected