Documentation
¶
Index ¶
Constants ¶
const DashboardAssetRemoteURL = "https://dash-assets.agentpod.ai"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conversation ¶
type Conversation struct {
ID string `json:"id" gorm:"type:varchar(21);primary_key"`
CreatedBy uuid.UUID `json:"created_by" gorm:"type:uuid;not null"`
CreatedAt time.Time `json:"created_at" gorm:"default:CURRENT_TIMESTAMP"`
IsActive bool `json:"is_active" gorm:"default:true"`
Error string `json:"error"`
// every user message is associated with an assistant message
UserMessage MessageContent `json:"user_message" gorm:"type:jsonb;not null"`
AssistantMessage MessageContent `json:"assistant_message" gorm:"type:jsonb"`
}
type Dashboard ¶
type Dashboard struct {
// RemoteURL is the URL of the hosted dashboard
RemoteURL string
// contains filtered or unexported fields
}
Dashboard represents the web dashboard for the application
func NewDashboard ¶
NewDashboard creates a new Dashboard instance for proxying to a URL. By default, it will use https://dash-assets.agentpod.ai
func (*Dashboard) HandleUserConversations ¶
func (d *Dashboard) HandleUserConversations() http.HandlerFunc
HandleUserConversations returns a handler function that serves the /api/user/<userid>/conversations endpoint
API Endpoint: GET /api/user/<userid>/conversations
URL Parameters:
- userid: (required) The ID of the user whose conversations to retrieve
Query Parameters:
- limit: (optional) Maximum number of conversations to return. Default: 20
- offset: (optional) Number of conversations to skip. Default: 0
Response:
- 200 OK: Returns a JSON array of DashboardConversation objects with the following structure: [ { "SessionID": "string", "UserMessage": "string", "UserMessageTime": "RFC3339 timestamp", "AssistantMessage": "string", "AssistantMessageTime": "RFC3339 timestamp" }, ... ]
- 400 Bad Request: If the URL path is invalid or userID is missing
- 405 Method Not Allowed: If the request method is not GET
- 500 Internal Server Error: If there's an error retrieving or encoding the data
func (*Dashboard) HandleUsers ¶
func (d *Dashboard) HandleUsers() http.HandlerFunc
HandleUsers returns a handler function that serves the /api/users endpoint
API Endpoint: GET /api/users
Query Parameters:
- limit: (optional) Maximum number of users to return. Default: 20
- offset: (optional) Number of users to skip. Default: 0
Response:
- 200 OK: Returns a JSON array of DashboardUser objects with the following structure: [ { "ID": "string", "Name": "string", "Email": "string", "OrganizationName": "string" }, ... ]
- 405 Method Not Allowed: If the request method is not GET
- 500 Internal Server Error: If there's an error retrieving or encoding the data
type DashboardConversation ¶
type DashboardConversation struct {
SessionID string
UserMessage string
UserMessageTime time.Time
AssistantMessage string
AssistantMessageTime time.Time
}
DashboardConversation is a pair of user message and assistant message
type DashboardUser ¶
type MessageContent ¶
type MessageContent struct {
Messages []MessageItem `json:"messages"`
}
func (*MessageContent) Scan ¶
func (mc *MessageContent) Scan(value interface{}) error
Implement the sql.Scanner interface
type MessageItem ¶
type MessageItem struct {
MessageType MessageType `json:"messageType"`
Value string `json:"value"`
}
type MessageType ¶
type MessageType string
const ( TaskMessageType MessageType = "task" TextMessageType MessageType = "text" )
type OrgMembership ¶
type OrgMembership struct {
UserID uuid.UUID `json:"user_id" gorm:"type:uuid;primary_key;index:idx_org_memberships_user_id"`
OrganizationID uuid.UUID `json:"organization_id" gorm:"type:uuid;primary_key;index:idx_org_memberships_organization_id"`
// Foreign key relationships
Organization Organization `gorm:"foreignKey:OrganizationID"`
User User `gorm:"foreignKey:UserID"`
}
type Organization ¶
type PostgresStorage ¶
type PostgresStorage struct {
// contains filtered or unexported fields
}
PostgresStorage implements the dashboard.Storage interface using PostgreSQL with GORM.
func NewPostgresStorage ¶
func NewPostgresStorage(connStr string) (*PostgresStorage, error)
NewPostgresStorage creates a new PostgresStorage instance with the provided connection string. It initializes the database schema if it doesn't exist.
func (*PostgresStorage) Close ¶
func (s *PostgresStorage) Close() error
Close closes the database connection.
func (*PostgresStorage) GetDashboardConversations ¶
func (p *PostgresStorage) GetDashboardConversations(userID string, limit int, offset int) ([]DashboardConversation, error)
GetDashboardConversations retrieves conversations for a specific user with pagination for the
func (*PostgresStorage) GetDashboardUsers ¶
func (p *PostgresStorage) GetDashboardUsers(limit int, offset int) ([]DashboardUser, error)
GetDashboardUsers retrieves a paginated list of users for the
func (*PostgresStorage) InitDB ¶
func (s *PostgresStorage) InitDB() error
initDB creates the necessary tables if they don't exist.