BuildSingleUserChatMessageInsertParams creates batch insert params for one user message, requiring an apiKeyID for AI Gateway attribution.
( chatID uuid.UUID, apiKeyID string, content pqtype.NullRawMessage, visibility database.ChatMessageVisibility, modelConfigID uuid.UUID, contentVersion int16, createdBy uuid.UUID, )
| 4074 | // BuildSingleUserChatMessageInsertParams creates batch insert params for |
| 4075 | // one user message, requiring an apiKeyID for AI Gateway attribution. |
| 4076 | func BuildSingleUserChatMessageInsertParams( |
| 4077 | chatID uuid.UUID, |
| 4078 | apiKeyID string, |
| 4079 | content pqtype.NullRawMessage, |
| 4080 | visibility database.ChatMessageVisibility, |
| 4081 | modelConfigID uuid.UUID, |
| 4082 | contentVersion int16, |
| 4083 | createdBy uuid.UUID, |
| 4084 | ) database.InsertChatMessagesParams { |
| 4085 | params := database.InsertChatMessagesParams{ //nolint:exhaustruct // Fields populated by appendUserChatMessage. |
| 4086 | ChatID: chatID, |
| 4087 | } |
| 4088 | msg := newUserChatMessage(apiKeyID, content, visibility, modelConfigID, contentVersion) |
| 4089 | if createdBy != uuid.Nil { |
| 4090 | msg = msg.withCreatedBy(createdBy) |
| 4091 | } |
| 4092 | appendUserChatMessage(¶ms, msg) |
| 4093 | return params |
| 4094 | } |
| 4095 | |
| 4096 | // insertUserMessageAndSetPending inserts a user message, transitions the |
| 4097 | // chat to pending when needed, and returns the refreshed chat row. |
no test coverage detected