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

Function insertAssistantCostMessage

coderd/exp_chats_test.go:264–285  ·  view source on GitHub ↗
(
	t *testing.T,
	db database.Store,
	chatID uuid.UUID,
	modelConfigID uuid.UUID,
	totalCostMicros int64,
)

Source from the content-addressed store, hash-verified

262}
263
264func insertAssistantCostMessage(
265 t *testing.T,
266 db database.Store,
267 chatID uuid.UUID,
268 modelConfigID uuid.UUID,
269 totalCostMicros int64,
270) {
271 t.Helper()
272
273 assistantContent, err := chatprompt.MarshalParts([]codersdk.ChatMessagePart{
274 codersdk.ChatMessageText("assistant"),
275 })
276 require.NoError(t, err)
277
278 _ = dbgen.ChatMessage(t, db, database.ChatMessage{
279 ChatID: chatID,
280 ModelConfigID: uuid.NullUUID{UUID: modelConfigID, Valid: true},
281 Role: database.ChatMessageRoleAssistant,
282 Content: assistantContent,
283 TotalCostMicros: sql.NullInt64{Int64: totalCostMicros, Valid: true},
284 })
285}
286
287func TestPostChats(t *testing.T) {
288 t.Parallel()

Callers 6

TestPostChatsFunction · 0.85
TestPostChatMessagesFunction · 0.85
TestPatchChatMessageFunction · 0.85
TestRegenerateChatTitleFunction · 0.85

Calls 4

MarshalPartsFunction · 0.92
ChatMessageTextFunction · 0.92
ChatMessageFunction · 0.92
HelperMethod · 0.65

Tested by

no test coverage detected