feat(copilot): align thread message payloads
This commit is contained in:
@@ -20,7 +20,9 @@ type CopilotThread struct {
|
||||
Title string `gorm:"size:255;not null" json:"title"`
|
||||
|
||||
// Relationships
|
||||
Messages []CopilotMessage `gorm:"foreignKey:CopilotThreadID" json:"messages,omitempty"`
|
||||
Messages []CopilotMessage `gorm:"foreignKey:CopilotThreadID" json:"messages,omitempty"`
|
||||
User User `gorm:"foreignKey:UserID" json:"user,omitempty"`
|
||||
Assistant CaptainAssistant `gorm:"foreignKey:AssistantID" json:"assistant,omitempty"`
|
||||
}
|
||||
|
||||
func (CopilotThread) TableName() string { return "copilot_threads" }
|
||||
@@ -51,10 +53,11 @@ func (t *CopilotThread) PreviousHistory(messages []CopilotMessage) []ChatMessage
|
||||
|
||||
type CopilotMessage struct {
|
||||
Base
|
||||
AccountID uint `gorm:"index;not null" json:"account_id"`
|
||||
CopilotThreadID uint `gorm:"index;not null" json:"copilot_thread_id"`
|
||||
MessageType CopilotMessageType `gorm:"size:50;default:user;not null" json:"message_type"`
|
||||
Message json.RawMessage `gorm:"type:jsonb;not null" json:"message"`
|
||||
AccountID uint `gorm:"index;not null" json:"account_id"`
|
||||
CopilotThreadID uint `gorm:"index;not null" json:"copilot_thread_id"`
|
||||
MessageType CopilotMessageType `gorm:"size:50;default:user;not null" json:"message_type"`
|
||||
Message json.RawMessage `gorm:"type:jsonb;not null" json:"message"`
|
||||
CopilotThread CopilotThread `gorm:"foreignKey:CopilotThreadID" json:"copilot_thread,omitempty"`
|
||||
}
|
||||
|
||||
func (CopilotMessage) TableName() string { return "copilot_messages" }
|
||||
@@ -80,9 +83,9 @@ func (m *CopilotMessage) GetMessageContent() string {
|
||||
type CopilotSuggestionType string
|
||||
|
||||
const (
|
||||
CopilotSuggestionTypeReply CopilotSuggestionType = "reply"
|
||||
CopilotSuggestionTypeReply CopilotSuggestionType = "reply"
|
||||
CopilotSuggestionTypeSuggestion CopilotSuggestionType = "suggestion"
|
||||
CopilotSuggestionTypeSummary CopilotSuggestionType = "summary"
|
||||
CopilotSuggestionTypeSummary CopilotSuggestionType = "summary"
|
||||
)
|
||||
|
||||
type CopilotSuggestionStatus string
|
||||
@@ -95,11 +98,11 @@ const (
|
||||
|
||||
type CopilotSuggestionMessage struct {
|
||||
Base
|
||||
AccountID uint `gorm:"index;not null" json:"account_id"`
|
||||
ConversationID uint `gorm:"index;not null" json:"conversation_id"`
|
||||
Content string `gorm:"type:text;not null" json:"content"`
|
||||
SuggestionType CopilotSuggestionType `gorm:"size:50;not null;default:suggestion" json:"suggestion_type"`
|
||||
Status CopilotSuggestionStatus `gorm:"size:50;not null;default:pending" json:"status"`
|
||||
AccountID uint `gorm:"index;not null" json:"account_id"`
|
||||
ConversationID uint `gorm:"index;not null" json:"conversation_id"`
|
||||
Content string `gorm:"type:text;not null" json:"content"`
|
||||
SuggestionType CopilotSuggestionType `gorm:"size:50;not null;default:suggestion" json:"suggestion_type"`
|
||||
Status CopilotSuggestionStatus `gorm:"size:50;not null;default:pending" json:"status"`
|
||||
}
|
||||
|
||||
func (CopilotSuggestionMessage) TableName() string { return "copilot_suggestion_messages" }
|
||||
@@ -109,4 +112,4 @@ func (CopilotSuggestionMessage) TableName() string { return "copilot_suggestion_
|
||||
type ChatMessage struct {
|
||||
Role string `json:"role"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user