feat(captain): align streaming fallbacks
This commit is contained in:
@@ -349,17 +349,37 @@ func copilotThreadPayload(thread *model.CopilotThread) gin.H {
|
||||
}
|
||||
}
|
||||
|
||||
func copilotThreadPushPayload(thread *model.CopilotThread) gin.H {
|
||||
return gin.H{
|
||||
"id": thread.ID,
|
||||
"title": thread.Title,
|
||||
"created_at": thread.CreatedAt.Unix(),
|
||||
"user": copilotUserPayload(&thread.User, thread.UserID, thread.AccountID),
|
||||
"account_id": thread.AccountID,
|
||||
}
|
||||
}
|
||||
|
||||
func copilotMessagePayload(message *model.CopilotMessage) gin.H {
|
||||
return gin.H{
|
||||
"id": message.ID,
|
||||
"message": rawJSONValue(message.Message),
|
||||
"message_type": message.MessageType,
|
||||
"created_at": message.CreatedAt.Unix(),
|
||||
"copilot_thread": copilotThreadPayload(&message.CopilotThread),
|
||||
"copilot_thread": copilotThreadPushPayload(&message.CopilotThread),
|
||||
"account_id": message.AccountID,
|
||||
}
|
||||
}
|
||||
|
||||
func copilotMessagePushPayload(message *model.CopilotMessage) gin.H {
|
||||
return gin.H{
|
||||
"id": message.ID,
|
||||
"message": rawJSONValue(message.Message),
|
||||
"message_type": message.MessageType,
|
||||
"created_at": message.CreatedAt.Unix(),
|
||||
"copilot_thread": copilotThreadPushPayload(&message.CopilotThread),
|
||||
}
|
||||
}
|
||||
|
||||
func copilotUserPayload(user *model.User, fallbackID, accountID uint) gin.H {
|
||||
if user == nil || user.ID == 0 {
|
||||
return gin.H{"id": fallbackID, "account_id": accountID, "type": "user"}
|
||||
|
||||
Reference in New Issue
Block a user