Files
gochat/internal/model/copilot_message.go.txt
T
2026-06-04 15:44:48 +08:00

21 lines
733 B
Plaintext

package model
import (
"encoding/json"
"time"
)
// CopilotMessage represents a message within a copilot thread.
// Reference: P2B M10 spec
type CopilotMessage struct {
ID uint `gorm:"primaryKey" json:"id"`
ThreadID uint `gorm:"not null;index" json:"thread_id"`
Role string `gorm:"size:50;not null" json:"role"` // user/assistant/system
Content string `gorm:"type:text;not null" json:"content"`
Metadata json.RawMessage `gorm:"type:jsonb" json:"metadata"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
Thread CopilotThread `gorm:"foreignKey:ThreadID" json:"thread,omitempty"`
}
func (CopilotMessage) TableName() string { return "copilot_messages" }