Documentation
¶
Index ¶
- Constants
- Variables
- type AIConversation
- type AIMessage
- type AIMessageRole
- type AIMessageType
- type Activity
- type ActivityLevel
- type ActivityType
- type AgentMetrics
- type AgentSessionStats
- type AgentStatsStore
- type Attachment
- type BM25Result
- type BM25SearchOptions
- type CostStats
- type DailyCostData
- type DeleteAIConversation
- type DeleteAIMessage
- type DeleteAgentMetrics
- type DeleteAttachment
- type DeleteEpisodicMemory
- type DeleteIdentityProvider
- type DeleteInbox
- type DeleteInstanceSetting
- type DeleteMemo
- type DeleteMemoRelation
- type DeleteReaction
- type DeleteSchedule
- type DeleteToolMetrics
- type DeleteUser
- type Driver
- type EpisodicMemory
- type FindAIConversation
- type FindAIMessage
- type FindActivity
- type FindAgentMetrics
- type FindAttachment
- type FindEpisodicMemory
- type FindIdentityProvider
- type FindInbox
- type FindInstanceSetting
- type FindMemo
- type FindMemoEmbedding
- type FindMemoPayload
- type FindMemoRelation
- type FindMemosWithoutEmbedding
- type FindPromptVersionMetrics
- type FindReaction
- type FindSchedule
- type FindToolMetrics
- type FindUser
- type FindUserPreferences
- type FindUserSetting
- type IdentityProvider
- type Inbox
- type InboxStatus
- type InstanceSetting
- type Memo
- type MemoEmbedding
- type MemoRelation
- type MemoRelationType
- type MemoWithScore
- type PATQueryResult
- type PromptExperimentSummary
- type PromptVersionMetrics
- type Reaction
- type RefreshTokenQueryResult
- type Role
- type RowStatus
- type Schedule
- type ScheduleService
- type SecurityAuditEvent
- type SecurityAuditStore
- type Store
- func (s *Store) AddUserPersonalAccessToken(ctx context.Context, userID int32, ...) error
- func (s *Store) AddUserRefreshToken(ctx context.Context, userID int32, ...) error
- func (s *Store) AddUserWebhook(ctx context.Context, userID int32, ...) error
- func (s *Store) BM25Search(ctx context.Context, opts *BM25SearchOptions) ([]*BM25Result, error)
- func (s *Store) Close() error
- func (s *Store) CreateAIConversation(ctx context.Context, create *AIConversation) (*AIConversation, error)
- func (s *Store) CreateAIMessage(ctx context.Context, create *AIMessage) (*AIMessage, error)
- func (s *Store) CreateActivity(ctx context.Context, create *Activity) (*Activity, error)
- func (s *Store) CreateAttachment(ctx context.Context, create *Attachment) (*Attachment, error)
- func (s *Store) CreateEpisodicMemory(ctx context.Context, create *EpisodicMemory) (*EpisodicMemory, error)
- func (s *Store) CreateIdentityProvider(ctx context.Context, create *storepb.IdentityProvider) (*storepb.IdentityProvider, error)
- func (s *Store) CreateInbox(ctx context.Context, create *Inbox) (*Inbox, error)
- func (s *Store) CreateMemo(ctx context.Context, create *Memo) (*Memo, error)
- func (s *Store) CreateSchedule(ctx context.Context, create *Schedule) (*Schedule, error)
- func (s *Store) CreateUser(ctx context.Context, create *User) (*User, error)
- func (s *Store) DeleteAIConversation(ctx context.Context, delete *DeleteAIConversation) error
- func (s *Store) DeleteAIMessage(ctx context.Context, delete *DeleteAIMessage) error
- func (s *Store) DeleteAgentMetrics(ctx context.Context, delete *DeleteAgentMetrics) error
- func (s *Store) DeleteAttachment(ctx context.Context, delete *DeleteAttachment) error
- func (s *Store) DeleteEpisodicMemory(ctx context.Context, delete *DeleteEpisodicMemory) error
- func (s *Store) DeleteIdentityProvider(ctx context.Context, delete *DeleteIdentityProvider) error
- func (s *Store) DeleteInbox(ctx context.Context, delete *DeleteInbox) error
- func (s *Store) DeleteMemo(ctx context.Context, delete *DeleteMemo) error
- func (s *Store) DeleteMemoEmbedding(ctx context.Context, memoID int32) error
- func (s *Store) DeleteMemoRelation(ctx context.Context, delete *DeleteMemoRelation) error
- func (s *Store) DeleteReaction(ctx context.Context, delete *DeleteReaction) error
- func (s *Store) DeleteSchedule(ctx context.Context, delete *DeleteSchedule) error
- func (s *Store) DeleteToolMetrics(ctx context.Context, delete *DeleteToolMetrics) error
- func (s *Store) DeleteUser(ctx context.Context, delete *DeleteUser) error
- func (s *Store) FindMemosWithoutEmbedding(ctx context.Context, find *FindMemosWithoutEmbedding) ([]*Memo, error)
- func (s *Store) GetActivity(ctx context.Context, find *FindActivity) (*Activity, error)
- func (s *Store) GetAttachment(ctx context.Context, find *FindAttachment) (*Attachment, error)
- func (s *Store) GetCurrentSchemaVersion() (string, error)
- func (s *Store) GetDriver() Driver
- func (s *Store) GetIdentityProvider(ctx context.Context, find *FindIdentityProvider) (*storepb.IdentityProvider, error)
- func (s *Store) GetInstanceBasicSetting(ctx context.Context) (*storepb.InstanceBasicSetting, error)
- func (s *Store) GetInstanceGeneralSetting(ctx context.Context) (*storepb.InstanceGeneralSetting, error)
- func (s *Store) GetInstanceMemoRelatedSetting(ctx context.Context) (*storepb.InstanceMemoRelatedSetting, error)
- func (s *Store) GetInstanceSetting(ctx context.Context, find *FindInstanceSetting) (*storepb.InstanceSetting, error)
- func (s *Store) GetInstanceStorageSetting(ctx context.Context) (*storepb.InstanceStorageSetting, error)
- func (s *Store) GetMemo(ctx context.Context, find *FindMemo) (*Memo, error)
- func (s *Store) GetMemoEmbedding(ctx context.Context, memoID int32, model string) (*MemoEmbedding, error)
- func (s *Store) GetReaction(ctx context.Context, find *FindReaction) (*Reaction, error)
- func (s *Store) GetSchedule(ctx context.Context, find *FindSchedule) (*Schedule, error)
- func (s *Store) GetUser(ctx context.Context, find *FindUser) (*User, error)
- func (s *Store) GetUserByPATHash(ctx context.Context, tokenHash string) (*PATQueryResult, error)
- func (s *Store) GetUserPersonalAccessTokens(ctx context.Context, userID int32) ([]*storepb.PersonalAccessTokensUserSetting_PersonalAccessToken, error)
- func (s *Store) GetUserPreferences(ctx context.Context, find *FindUserPreferences) (*UserPreferences, error)
- func (s *Store) GetUserRefreshTokenByID(ctx context.Context, userID int32, tokenID string) (*storepb.RefreshTokensUserSetting_RefreshToken, error)
- func (s *Store) GetUserRefreshTokens(ctx context.Context, userID int32) ([]*storepb.RefreshTokensUserSetting_RefreshToken, error)
- func (s *Store) GetUserSetting(ctx context.Context, find *FindUserSetting) (*storepb.UserSetting, error)
- func (s *Store) GetUserWebhooks(ctx context.Context, userID int32) ([]*storepb.WebhooksUserSetting_Webhook, error)
- func (s *Store) ListAIConversations(ctx context.Context, find *FindAIConversation) ([]*AIConversation, error)
- func (s *Store) ListAIMessages(ctx context.Context, find *FindAIMessage) ([]*AIMessage, error)
- func (s *Store) ListActiveUserIDs(ctx context.Context, cutoff time.Time) ([]int32, error)
- func (s *Store) ListActivities(ctx context.Context, find *FindActivity) ([]*Activity, error)
- func (s *Store) ListAgentMetrics(ctx context.Context, find *FindAgentMetrics) ([]*AgentMetrics, error)
- func (s *Store) ListAttachments(ctx context.Context, find *FindAttachment) ([]*Attachment, error)
- func (s *Store) ListEpisodicMemories(ctx context.Context, find *FindEpisodicMemory) ([]*EpisodicMemory, error)
- func (s *Store) ListIdentityProviders(ctx context.Context, find *FindIdentityProvider) ([]*storepb.IdentityProvider, error)
- func (s *Store) ListInboxes(ctx context.Context, find *FindInbox) ([]*Inbox, error)
- func (s *Store) ListInstanceSettings(ctx context.Context, find *FindInstanceSetting) ([]*storepb.InstanceSetting, error)
- func (s *Store) ListMemoEmbeddings(ctx context.Context, find *FindMemoEmbedding) ([]*MemoEmbedding, error)
- func (s *Store) ListMemoRelations(ctx context.Context, find *FindMemoRelation) ([]*MemoRelation, error)
- func (s *Store) ListMemos(ctx context.Context, find *FindMemo) ([]*Memo, error)
- func (s *Store) ListReactions(ctx context.Context, find *FindReaction) ([]*Reaction, error)
- func (s *Store) ListSchedules(ctx context.Context, find *FindSchedule) ([]*Schedule, error)
- func (s *Store) ListToolMetrics(ctx context.Context, find *FindToolMetrics) ([]*ToolMetrics, error)
- func (s *Store) ListUserSettings(ctx context.Context, find *FindUserSetting) ([]*storepb.UserSetting, error)
- func (s *Store) ListUsers(ctx context.Context, find *FindUser) ([]*User, error)
- func (s *Store) Migrate(ctx context.Context) error
- func (s *Store) RemoveUserPersonalAccessToken(ctx context.Context, userID int32, tokenID string) error
- func (s *Store) RemoveUserRefreshToken(ctx context.Context, userID int32, tokenID string) error
- func (s *Store) RemoveUserWebhook(ctx context.Context, userID int32, webhookID string) error
- func (s *Store) UpdateAIConversation(ctx context.Context, update *UpdateAIConversation) (*AIConversation, error)
- func (s *Store) UpdateAttachment(ctx context.Context, update *UpdateAttachment) error
- func (s *Store) UpdateIdentityProvider(ctx context.Context, update *UpdateIdentityProviderV1) (*storepb.IdentityProvider, error)
- func (s *Store) UpdateInbox(ctx context.Context, update *UpdateInbox) (*Inbox, error)
- func (s *Store) UpdateMemo(ctx context.Context, update *UpdateMemo) error
- func (s *Store) UpdatePATLastUsed(ctx context.Context, userID int32, tokenID string, ...) error
- func (s *Store) UpdateSchedule(ctx context.Context, update *UpdateSchedule) error
- func (s *Store) UpdateUser(ctx context.Context, update *UpdateUser) (*User, error)
- func (s *Store) UpdateUserWebhook(ctx context.Context, userID int32, ...) error
- func (s *Store) UpsertAgentMetrics(ctx context.Context, upsert *UpsertAgentMetrics) (*AgentMetrics, error)
- func (s *Store) UpsertInstanceSetting(ctx context.Context, upsert *storepb.InstanceSetting) (*storepb.InstanceSetting, error)
- func (s *Store) UpsertMemoEmbedding(ctx context.Context, embedding *MemoEmbedding) (*MemoEmbedding, error)
- func (s *Store) UpsertMemoRelation(ctx context.Context, create *MemoRelation) (*MemoRelation, error)
- func (s *Store) UpsertReaction(ctx context.Context, upsert *Reaction) (*Reaction, error)
- func (s *Store) UpsertToolMetrics(ctx context.Context, upsert *UpsertToolMetrics) (*ToolMetrics, error)
- func (s *Store) UpsertUserPreferences(ctx context.Context, upsert *UpsertUserPreferences) (*UserPreferences, error)
- func (s *Store) UpsertUserSetting(ctx context.Context, upsert *storepb.UserSetting) (*storepb.UserSetting, error)
- func (s *Store) VectorSearch(ctx context.Context, opts *VectorSearchOptions) ([]*MemoWithScore, error)
- type ToolMetrics
- type UpdateAIConversation
- type UpdateAttachment
- type UpdateIdentityProvider
- type UpdateIdentityProviderV1
- type UpdateInbox
- type UpdateMemo
- type UpdateSchedule
- type UpdateUser
- type UpsertAgentMetrics
- type UpsertPromptVersionMetrics
- type UpsertToolMetrics
- type UpsertUserPreferences
- type User
- type UserCostSettings
- type UserPreferences
- type UserSetting
- type VectorSearchOptions
- type Visibility
Constants ¶
const ( // MigrateFilePrefix is the prefix for migration files. // Migration files use timestamp format: YYYYMMDDHHMMSS_description.sql MigrateFilePrefix = "" // LatestSchemaFileName is the name of the latest schema file. // This file is used to initialize fresh installations with the current schema. LatestSchemaFileName = "LATEST.sql" // MigrateDirName is the subdirectory containing migration files. MigrateDirName = "migrate" // SchemaDirName is the subdirectory containing the base schema file. SchemaDirName = "schema" )
const DefaultContentLengthLimit = 8 * 1024
DefaultContentLengthLimit is the default limit of content length in bytes. 8KB.
const (
SystemBotID int32 = 0
)
Variables ¶
var DefaultReactions = []string{"👍", "👎", "❤️", "🎉", "😄", "😕", "😢", "😡"}
DefaultReactions is the default reactions for memo related setting.
var ( SystemBot = &User{ ID: SystemBotID, Username: "system_bot", Role: RoleAdmin, Email: "", Nickname: "Bot", } )
Functions ¶
This section is empty.
Types ¶
type AIConversation ¶
type AIMessage ¶
type AIMessage struct {
UID string
Type AIMessageType
Role AIMessageRole
Content string
Metadata string
CreatedTs int64
ID int32
ConversationID int32
}
type AIMessageRole ¶
type AIMessageRole string
const ( AIMessageRoleUser AIMessageRole = "USER" AIMessageRoleAssistant AIMessageRole = "ASSISTANT" AIMessageRoleSystem AIMessageRole = "SYSTEM" )
type AIMessageType ¶
type AIMessageType string
const ( AIMessageTypeMessage AIMessageType = "MESSAGE" AIMessageTypeSeparator AIMessageType = "SEPARATOR" AIMessageTypeSummary AIMessageType = "SUMMARY" // Conversation summary (invisible to frontend) )
type Activity ¶
type Activity struct {
Payload *storepb.ActivityPayload
Type ActivityType
Level ActivityLevel
CreatedTs int64
ID int32
CreatorID int32
}
type ActivityLevel ¶
type ActivityLevel string
const (
ActivityLevelInfo ActivityLevel = "INFO"
)
func (ActivityLevel) String ¶
func (l ActivityLevel) String() string
type ActivityType ¶
type ActivityType string
const (
ActivityTypeMemoComment ActivityType = "MEMO_COMMENT"
)
func (ActivityType) String ¶
func (t ActivityType) String() string
type AgentMetrics ¶
type AgentMetrics struct {
HourBucket time.Time
AgentType string
Errors string
ID int64
RequestCount int64
SuccessCount int64
LatencySumMs int64
LatencyP50Ms int32
LatencyP95Ms int32
}
AgentMetrics represents hourly aggregated metrics for an agent type.
type AgentSessionStats ¶ added in v0.93.0
type AgentSessionStats struct {
ID int64
SessionID string
ConversationID int64
UserID int32
AgentType string
StartedAt time.Time
EndedAt time.Time
TotalDurationMs int64
ThinkingDurationMs int64
ToolDurationMs int64
GenerationDurationMs int64
InputTokens int32
OutputTokens int32
CacheWriteTokens int32
CacheReadTokens int32
TotalTokens int32
TotalCostUSD float64
ToolCallCount int32
ToolsUsed []string
FilesModified int32
FilePaths []string
ModelUsed string
IsError bool
ErrorMessage string
CreatedAt time.Time
UpdatedAt time.Time
}
AgentSessionStats represents a session statistics record for storage. AgentSessionStats 表示会话统计数据的存储记录。
type AgentStatsStore ¶ added in v0.93.0
type AgentStatsStore interface {
// SaveSessionStats saves a session statistics record.
SaveSessionStats(ctx context.Context, stats *AgentSessionStats) error
// GetSessionStats retrieves stats by session ID.
GetSessionStats(ctx context.Context, sessionID string) (*AgentSessionStats, error)
// ListSessionStats retrieves stats for a user with pagination.
ListSessionStats(ctx context.Context, userID int32, limit, offset int) ([]*AgentSessionStats, int64, error)
// GetDailyCostUsage retrieves total cost for a user in a date range.
GetDailyCostUsage(ctx context.Context, userID int32, startDate, endDate time.Time) (float64, error)
// GetCostStats retrieves aggregated cost statistics.
GetCostStats(ctx context.Context, userID int32, days int) (*CostStats, error)
// GetUserCostSettings retrieves or creates user cost settings.
GetUserCostSettings(ctx context.Context, userID int32) (*UserCostSettings, error)
// SetUserCostSettings updates user cost settings.
SetUserCostSettings(ctx context.Context, settings *UserCostSettings) error
}
AgentStatsStore defines the interface for session statistics persistence. AgentStatsStore 定义会话统计持久化的接口。
type Attachment ¶
type Attachment struct {
Payload *storepb.AttachmentPayload
MemoUID *string
MemoID *int32
Type string
FilePath string
RowStatus string
Filename string
UID string
OCRText string
ExtractedText string
ThumbnailPath string
Reference string
Blob []byte
CreatedTs int64
Size int64
UpdatedTs int64
StorageType storepb.AttachmentStorageType
ID int32
CreatorID int32
}
type BM25Result ¶
BM25Result represents a BM25 search result with relevance score.
type BM25SearchOptions ¶
BM25SearchOptions represents the options for BM25 full-text search.
func (*BM25SearchOptions) Validate ¶
func (o *BM25SearchOptions) Validate() error
Validate validates the BM25SearchOptions.
type CostStats ¶ added in v0.93.0
type CostStats struct {
TotalCostUSD float64
DailyAverageUSD float64
SessionCount int64
MostExpensiveSession *AgentSessionStats
DailyBreakdown []*DailyCostData
}
CostStats represents aggregated cost statistics for a user. CostStats 表示用户的聚合成本统计。
type DailyCostData ¶ added in v0.93.0
DailyCostData represents cost data for a single day. DailyCostData 表示单日的成本数据。
type DeleteAIConversation ¶
type DeleteAIConversation struct {
ID int32
}
type DeleteAIMessage ¶
type DeleteAgentMetrics ¶
DeleteAgentMetrics specifies the conditions for deleting agent metrics.
type DeleteAttachment ¶
type DeleteEpisodicMemory ¶
DeleteEpisodicMemory specifies the conditions for deleting episodic memories.
type DeleteIdentityProvider ¶
type DeleteIdentityProvider struct {
ID int32
}
type DeleteInbox ¶
type DeleteInbox struct {
ID int32
}
DeleteInbox specifies which inbox item to delete.
type DeleteInstanceSetting ¶
type DeleteInstanceSetting struct {
Name string
}
type DeleteMemo ¶
type DeleteMemo struct {
ID int32
}
type DeleteMemoRelation ¶
type DeleteMemoRelation struct {
MemoID *int32
RelatedMemoID *int32
Type *MemoRelationType
}
type DeleteReaction ¶
type DeleteReaction struct {
ID int32
}
type DeleteSchedule ¶
type DeleteSchedule struct {
ID int32
}
DeleteSchedule is the delete request for schedule.
type DeleteToolMetrics ¶
DeleteToolMetrics specifies the conditions for deleting tool metrics.
type DeleteUser ¶
type DeleteUser struct {
ID int32
}
type Driver ¶
type Driver interface {
GetDB() *sql.DB
Close() error
IsInitialized(ctx context.Context) (bool, error)
// Activity model related methods.
CreateActivity(ctx context.Context, create *Activity) (*Activity, error)
ListActivities(ctx context.Context, find *FindActivity) ([]*Activity, error)
// Attachment model related methods.
CreateAttachment(ctx context.Context, create *Attachment) (*Attachment, error)
ListAttachments(ctx context.Context, find *FindAttachment) ([]*Attachment, error)
UpdateAttachment(ctx context.Context, update *UpdateAttachment) error
DeleteAttachment(ctx context.Context, delete *DeleteAttachment) error
// Memo model related methods.
CreateMemo(ctx context.Context, create *Memo) (*Memo, error)
ListMemos(ctx context.Context, find *FindMemo) ([]*Memo, error)
UpdateMemo(ctx context.Context, update *UpdateMemo) error
DeleteMemo(ctx context.Context, delete *DeleteMemo) error
// UpdateMemoEmbedding updates the embedding vector for a memo.
UpdateMemoEmbedding(ctx context.Context, id int32, embedding []float32) error
// SearchMemosByVector performs semantic search using vector similarity.
// Returns memos and their similarity scores.
SearchMemosByVector(ctx context.Context, embedding []float32, limit int) ([]*Memo, []float32, error)
// MemoRelation model related methods.
UpsertMemoRelation(ctx context.Context, create *MemoRelation) (*MemoRelation, error)
ListMemoRelations(ctx context.Context, find *FindMemoRelation) ([]*MemoRelation, error)
DeleteMemoRelation(ctx context.Context, delete *DeleteMemoRelation) error
// InstanceSetting model related methods.
UpsertInstanceSetting(ctx context.Context, upsert *InstanceSetting) (*InstanceSetting, error)
ListInstanceSettings(ctx context.Context, find *FindInstanceSetting) ([]*InstanceSetting, error)
DeleteInstanceSetting(ctx context.Context, delete *DeleteInstanceSetting) error
// User model related methods.
CreateUser(ctx context.Context, create *User) (*User, error)
UpdateUser(ctx context.Context, update *UpdateUser) (*User, error)
ListUsers(ctx context.Context, find *FindUser) ([]*User, error)
DeleteUser(ctx context.Context, delete *DeleteUser) error
// UserSetting model related methods.
UpsertUserSetting(ctx context.Context, upsert *UserSetting) (*UserSetting, error)
ListUserSettings(ctx context.Context, find *FindUserSetting) ([]*UserSetting, error)
GetUserByPATHash(ctx context.Context, tokenHash string) (*PATQueryResult, error)
// IdentityProvider model related methods.
CreateIdentityProvider(ctx context.Context, create *IdentityProvider) (*IdentityProvider, error)
ListIdentityProviders(ctx context.Context, find *FindIdentityProvider) ([]*IdentityProvider, error)
UpdateIdentityProvider(ctx context.Context, update *UpdateIdentityProvider) (*IdentityProvider, error)
DeleteIdentityProvider(ctx context.Context, delete *DeleteIdentityProvider) error
// Inbox model related methods.
CreateInbox(ctx context.Context, create *Inbox) (*Inbox, error)
ListInboxes(ctx context.Context, find *FindInbox) ([]*Inbox, error)
UpdateInbox(ctx context.Context, update *UpdateInbox) (*Inbox, error)
DeleteInbox(ctx context.Context, delete *DeleteInbox) error
// Reaction model related methods.
UpsertReaction(ctx context.Context, create *Reaction) (*Reaction, error)
ListReactions(ctx context.Context, find *FindReaction) ([]*Reaction, error)
GetReaction(ctx context.Context, find *FindReaction) (*Reaction, error)
DeleteReaction(ctx context.Context, delete *DeleteReaction) error
// MemoEmbedding model related methods.
UpsertMemoEmbedding(ctx context.Context, embedding *MemoEmbedding) (*MemoEmbedding, error)
ListMemoEmbeddings(ctx context.Context, find *FindMemoEmbedding) ([]*MemoEmbedding, error)
DeleteMemoEmbedding(ctx context.Context, memoID int32) error
FindMemosWithoutEmbedding(ctx context.Context, find *FindMemosWithoutEmbedding) ([]*Memo, error)
VectorSearch(ctx context.Context, opts *VectorSearchOptions) ([]*MemoWithScore, error)
BM25Search(ctx context.Context, opts *BM25SearchOptions) ([]*BM25Result, error)
// Schedule model related methods.
CreateSchedule(ctx context.Context, create *Schedule) (*Schedule, error)
ListSchedules(ctx context.Context, find *FindSchedule) ([]*Schedule, error)
UpdateSchedule(ctx context.Context, update *UpdateSchedule) error
DeleteSchedule(ctx context.Context, delete *DeleteSchedule) error
// AIConversation model related methods.
CreateAIConversation(ctx context.Context, create *AIConversation) (*AIConversation, error)
ListAIConversations(ctx context.Context, find *FindAIConversation) ([]*AIConversation, error)
UpdateAIConversation(ctx context.Context, update *UpdateAIConversation) (*AIConversation, error)
DeleteAIConversation(ctx context.Context, delete *DeleteAIConversation) error
// AIMessage model related methods.
CreateAIMessage(ctx context.Context, create *AIMessage) (*AIMessage, error)
ListAIMessages(ctx context.Context, find *FindAIMessage) ([]*AIMessage, error)
DeleteAIMessage(ctx context.Context, delete *DeleteAIMessage) error
// EpisodicMemory model related methods.
CreateEpisodicMemory(ctx context.Context, create *EpisodicMemory) (*EpisodicMemory, error)
ListEpisodicMemories(ctx context.Context, find *FindEpisodicMemory) ([]*EpisodicMemory, error)
ListActiveUserIDs(ctx context.Context, cutoff time.Time) ([]int32, error)
DeleteEpisodicMemory(ctx context.Context, delete *DeleteEpisodicMemory) error
// UserPreferences model related methods.
UpsertUserPreferences(ctx context.Context, upsert *UpsertUserPreferences) (*UserPreferences, error)
GetUserPreferences(ctx context.Context, find *FindUserPreferences) (*UserPreferences, error)
// AgentMetrics model related methods.
UpsertAgentMetrics(ctx context.Context, upsert *UpsertAgentMetrics) (*AgentMetrics, error)
ListAgentMetrics(ctx context.Context, find *FindAgentMetrics) ([]*AgentMetrics, error)
DeleteAgentMetrics(ctx context.Context, delete *DeleteAgentMetrics) error
// ToolMetrics model related methods.
UpsertToolMetrics(ctx context.Context, upsert *UpsertToolMetrics) (*ToolMetrics, error)
ListToolMetrics(ctx context.Context, find *FindToolMetrics) ([]*ToolMetrics, error)
DeleteToolMetrics(ctx context.Context, delete *DeleteToolMetrics) error
// AgentStatsStore provides session statistics persistence.
AgentStatsStore() AgentStatsStore
// SecurityAuditStore provides security audit logging.
SecurityAuditStore() SecurityAuditStore
}
Driver is an interface for store driver. It contains all methods that store database driver should implement.
type EpisodicMemory ¶
type EpisodicMemory struct {
Timestamp time.Time
AgentType string
UserInput string
Outcome string
Summary string
ID int64
CreatedTs int64
UserID int32
Importance float32
}
EpisodicMemory represents an episodic memory record for AI learning.
type FindAIConversation ¶
type FindAIMessage ¶
type FindActivity ¶
type FindActivity struct {
ID *int32
Type *ActivityType
}
type FindAgentMetrics ¶
type FindAgentMetrics struct {
AgentType *string
StartTime *time.Time
EndTime *time.Time
Limit int
}
FindAgentMetrics specifies the conditions for finding agent metrics.
type FindAttachment ¶
type FindEpisodicMemory ¶
type FindEpisodicMemory struct {
ID *int64
UserID *int32
AgentType *string
Query *string // For text search in user_input and summary
Limit int
Offset int
}
FindEpisodicMemory specifies the conditions for finding episodic memories.
type FindIdentityProvider ¶
type FindIdentityProvider struct {
ID *int32
}
type FindInbox ¶
type FindInbox struct {
ID *int32
SenderID *int32
ReceiverID *int32
Status *InboxStatus
MessageType *storepb.InboxMessage_Type
// Pagination
Limit *int
Offset *int
}
FindInbox specifies filter criteria for querying inbox items.
type FindInstanceSetting ¶
type FindInstanceSetting struct {
Name string
}
type FindMemoEmbedding ¶
FindMemoEmbedding is the find condition for memo embeddings.
type FindMemoPayload ¶
type FindMemoRelation ¶
type FindMemoRelation struct {
MemoID *int32
RelatedMemoID *int32
Type *MemoRelationType
MemoFilter *string
}
type FindMemosWithoutEmbedding ¶
type FindMemosWithoutEmbedding struct {
Model string // Embedding model to check
Limit int // Maximum number of memos to return
}
FindMemosWithoutEmbedding is the find condition for memos without embeddings.
type FindPromptVersionMetrics ¶
type FindPromptVersionMetrics struct {
AgentType *string
PromptVersion *string
StartTime *time.Time
EndTime *time.Time
Limit int
}
FindPromptVersionMetrics specifies the conditions for finding prompt version metrics.
type FindReaction ¶
type FindSchedule ¶
type FindSchedule struct {
ID *int32
UID *string
CreatorID *int32
// Time range filters
StartTs *int64
EndTs *int64
// Status filter
RowStatus *RowStatus
// P1: Schedule query mode
// 0 = AUTO (auto-select based on query type)
// 1 = STANDARD (return schedules with any part in range)
// 2 = STRICT (return only schedules completely in range)
QueryMode *int32
// Pagination
Limit *int
Offset *int
}
FindSchedule is the find condition for schedule.
type FindToolMetrics ¶
FindToolMetrics specifies the conditions for finding tool metrics.
type FindUserPreferences ¶
type FindUserPreferences struct {
UserID *int32
}
FindUserPreferences specifies the conditions for finding user preferences.
type FindUserSetting ¶
type FindUserSetting struct {
UserID *int32
Key storepb.UserSetting_Key
}
type IdentityProvider ¶
type Inbox ¶
type Inbox struct {
Message *storepb.InboxMessage
Status InboxStatus
CreatedTs int64
ID int32
SenderID int32
ReceiverID int32
}
Inbox represents a notification in a user's inbox. It connects activities to users who should be notified.
type InboxStatus ¶
type InboxStatus string
InboxStatus represents the status of an inbox notification.
const ( // UNREAD indicates the notification has not been read by the user. UNREAD InboxStatus = "UNREAD" // ARCHIVED indicates the notification has been archived/dismissed by the user. ARCHIVED InboxStatus = "ARCHIVED" )
func (InboxStatus) String ¶
func (s InboxStatus) String() string
type InstanceSetting ¶
type MemoEmbedding ¶
type MemoEmbedding struct {
Model string
Embedding []float32
CreatedTs int64
UpdatedTs int64
ID int32
MemoID int32
}
MemoEmbedding represents the vector embedding of a memo.
type MemoRelation ¶
type MemoRelation struct {
Type MemoRelationType
MemoID int32
RelatedMemoID int32
}
type MemoRelationType ¶
type MemoRelationType string
const ( // MemoRelationReference is the type for a reference memo relation. MemoRelationReference MemoRelationType = "REFERENCE" // MemoRelationComment is the type for a comment memo relation. MemoRelationComment MemoRelationType = "COMMENT" )
type MemoWithScore ¶
type MemoWithScore struct {
Memo *Memo
Score float32 // Similarity score (0-1, higher is more similar)
}
MemoWithScore represents a vector search result with similarity score.
type PATQueryResult ¶
type PATQueryResult struct {
User *User
PAT *storepb.PersonalAccessTokensUserSetting_PersonalAccessToken
UserID int32
}
PATQueryResult contains the result of querying a PAT by hash.
type PromptExperimentSummary ¶
type PromptExperimentSummary struct {
AgentType string
ControlVersion string
TreatmentVersion string
Recommendation string
ControlRequests int64
TreatmentRequests int64
ControlSuccessRate float64
TreatmentSuccessRate float64
ControlAvgLatencyMs int64
TreatmentAvgLatencyMs int64
ImprovementRate float64
IsStatisticallySignificant bool
}
PromptExperimentSummary represents aggregated metrics for an A/B experiment. Used for comparing control vs treatment performance.
type PromptVersionMetrics ¶
type PromptVersionMetrics struct {
HourBucket time.Time
AgentType string
PromptVersion string
ID int64
RequestCount int64
SuccessCount int64
AvgLatencyMs int64
UserSatisfaction float32
}
PromptVersionMetrics represents metrics for a specific prompt version in an A/B experiment. This enables comparison of prompt performance across versions.
type RefreshTokenQueryResult ¶
type RefreshTokenQueryResult struct {
RefreshToken *storepb.RefreshTokensUserSetting_RefreshToken
UserID int32
}
RefreshTokenQueryResult contains the result of querying a refresh token.
type Schedule ¶
type Schedule struct {
EndTs *int64
Payload *string
Reminders *string
RecurrenceEndTs *int64
RecurrenceRule *string
Timezone string
Title string
Description string
Location string
RowStatus RowStatus
UID string
StartTs int64
UpdatedTs int64
CreatedTs int64
ID int32
CreatorID int32
AllDay bool
}
Schedule is the object representing a schedule.
func (*Schedule) ConflictWith ¶
ConflictWith checks if this schedule conflicts with another.
func (*Schedule) GetDuration ¶
GetDuration returns the duration of the schedule.
func (*Schedule) IsActiveAt ¶
IsActiveAt checks if the schedule is active at the given time.
func (*Schedule) ParseEndTime ¶
ParseEndTime parses the schedule end time to time.Time.
func (*Schedule) ParseStartTime ¶
ParseStartTime parses the schedule start time to time.Time.
type ScheduleService ¶
type ScheduleService interface {
CreateSchedule(ctx context.Context, create *Schedule) (*Schedule, error)
ListSchedules(ctx context.Context, find *FindSchedule) ([]*Schedule, error)
UpdateSchedule(ctx context.Context, update *UpdateSchedule) error
DeleteSchedule(ctx context.Context, delete *DeleteSchedule) error
}
ScheduleService is the interface for schedule-related operations.
type SecurityAuditEvent ¶ added in v0.93.0
type SecurityAuditEvent struct {
ID int64
SessionID string
UserID int32
AgentType string
OperationType string
OperationName string
RiskLevel string
CommandInput string
CommandMatchedPattern string
ActionTaken string
Reason string
FilePath string
ToolID string
OccurredAt time.Time
}
SecurityAuditEvent represents a security-related event for audit logging. SecurityAuditEvent 表示安全相关事件的审计日志。
type SecurityAuditStore ¶ added in v0.93.0
type SecurityAuditStore interface {
// LogSecurityEvent saves a security event.
LogSecurityEvent(ctx context.Context, event *SecurityAuditEvent) error
// ListSecurityEvents retrieves security events for a user with pagination.
ListSecurityEvents(ctx context.Context, userID int32, limit, offset int) ([]*SecurityAuditEvent, int64, error)
// ListSecurityEventsByRisk retrieves events filtered by risk level.
ListSecurityEventsByRisk(ctx context.Context, userID int32, riskLevel string, limit, offset int) ([]*SecurityAuditEvent, int64, error)
}
SecurityAuditStore defines the interface for security audit logging. SecurityAuditStore 定义安全审计日志的接口。
type Store ¶
type Store struct {
// Store services
AgentStatsStore AgentStatsStore // session statistics persistence
SecurityAuditStore SecurityAuditStore // security audit logging
// contains filtered or unexported fields
}
Store provides database access to all raw objects.
func (*Store) AddUserPersonalAccessToken ¶
func (s *Store) AddUserPersonalAccessToken(ctx context.Context, userID int32, token *storepb.PersonalAccessTokensUserSetting_PersonalAccessToken) error
AddUserPersonalAccessToken adds a new PAT for the user.
func (*Store) AddUserRefreshToken ¶
func (s *Store) AddUserRefreshToken(ctx context.Context, userID int32, token *storepb.RefreshTokensUserSetting_RefreshToken) error
AddUserRefreshToken adds a new refresh token for the user.
func (*Store) AddUserWebhook ¶
func (s *Store) AddUserWebhook(ctx context.Context, userID int32, webhook *storepb.WebhooksUserSetting_Webhook) error
AddUserWebhook adds a new webhook for the user.
func (*Store) BM25Search ¶
func (s *Store) BM25Search(ctx context.Context, opts *BM25SearchOptions) ([]*BM25Result, error)
BM25Search performs full-text search using BM25 ranking.
func (*Store) CreateAIConversation ¶
func (s *Store) CreateAIConversation(ctx context.Context, create *AIConversation) (*AIConversation, error)
func (*Store) CreateAIMessage ¶
func (*Store) CreateActivity ¶
func (*Store) CreateAttachment ¶
func (s *Store) CreateAttachment(ctx context.Context, create *Attachment) (*Attachment, error)
func (*Store) CreateEpisodicMemory ¶
func (s *Store) CreateEpisodicMemory(ctx context.Context, create *EpisodicMemory) (*EpisodicMemory, error)
func (*Store) CreateIdentityProvider ¶
func (s *Store) CreateIdentityProvider(ctx context.Context, create *storepb.IdentityProvider) (*storepb.IdentityProvider, error)
func (*Store) CreateInbox ¶
CreateInbox creates a new inbox notification.
func (*Store) CreateMemo ¶
func (*Store) CreateSchedule ¶
CreateSchedule creates a new schedule.
func (*Store) CreateUser ¶
func (*Store) DeleteAIConversation ¶
func (s *Store) DeleteAIConversation(ctx context.Context, delete *DeleteAIConversation) error
func (*Store) DeleteAIMessage ¶
func (s *Store) DeleteAIMessage(ctx context.Context, delete *DeleteAIMessage) error
func (*Store) DeleteAgentMetrics ¶
func (s *Store) DeleteAgentMetrics(ctx context.Context, delete *DeleteAgentMetrics) error
func (*Store) DeleteAttachment ¶
func (s *Store) DeleteAttachment(ctx context.Context, delete *DeleteAttachment) error
func (*Store) DeleteEpisodicMemory ¶
func (s *Store) DeleteEpisodicMemory(ctx context.Context, delete *DeleteEpisodicMemory) error
func (*Store) DeleteIdentityProvider ¶
func (s *Store) DeleteIdentityProvider(ctx context.Context, delete *DeleteIdentityProvider) error
func (*Store) DeleteInbox ¶
func (s *Store) DeleteInbox(ctx context.Context, delete *DeleteInbox) error
DeleteInbox permanently removes an inbox item.
func (*Store) DeleteMemo ¶
func (s *Store) DeleteMemo(ctx context.Context, delete *DeleteMemo) error
func (*Store) DeleteMemoEmbedding ¶
DeleteMemoEmbedding deletes a memo embedding.
func (*Store) DeleteMemoRelation ¶
func (s *Store) DeleteMemoRelation(ctx context.Context, delete *DeleteMemoRelation) error
func (*Store) DeleteReaction ¶
func (s *Store) DeleteReaction(ctx context.Context, delete *DeleteReaction) error
func (*Store) DeleteSchedule ¶
func (s *Store) DeleteSchedule(ctx context.Context, delete *DeleteSchedule) error
DeleteSchedule deletes a schedule.
func (*Store) DeleteToolMetrics ¶
func (s *Store) DeleteToolMetrics(ctx context.Context, delete *DeleteToolMetrics) error
func (*Store) DeleteUser ¶
func (s *Store) DeleteUser(ctx context.Context, delete *DeleteUser) error
func (*Store) FindMemosWithoutEmbedding ¶
func (s *Store) FindMemosWithoutEmbedding(ctx context.Context, find *FindMemosWithoutEmbedding) ([]*Memo, error)
FindMemosWithoutEmbedding finds memos that don't have embeddings for the specified model.
func (*Store) GetActivity ¶
func (*Store) GetAttachment ¶
func (s *Store) GetAttachment(ctx context.Context, find *FindAttachment) (*Attachment, error)
func (*Store) GetCurrentSchemaVersion ¶
func (*Store) GetIdentityProvider ¶
func (s *Store) GetIdentityProvider(ctx context.Context, find *FindIdentityProvider) (*storepb.IdentityProvider, error)
func (*Store) GetInstanceBasicSetting ¶
func (*Store) GetInstanceGeneralSetting ¶
func (*Store) GetInstanceMemoRelatedSetting ¶
func (*Store) GetInstanceSetting ¶
func (s *Store) GetInstanceSetting(ctx context.Context, find *FindInstanceSetting) (*storepb.InstanceSetting, error)
func (*Store) GetInstanceStorageSetting ¶
func (*Store) GetMemoEmbedding ¶
func (s *Store) GetMemoEmbedding(ctx context.Context, memoID int32, model string) (*MemoEmbedding, error)
GetMemoEmbedding gets the embedding of a specific memo.
func (*Store) GetReaction ¶
func (*Store) GetSchedule ¶
GetSchedule gets a schedule by uid.
func (*Store) GetUserByPATHash ¶
GetUserByPATHash finds a user by PAT hash.
func (*Store) GetUserPersonalAccessTokens ¶
func (s *Store) GetUserPersonalAccessTokens(ctx context.Context, userID int32) ([]*storepb.PersonalAccessTokensUserSetting_PersonalAccessToken, error)
GetUserPersonalAccessTokens returns the PATs of the user.
func (*Store) GetUserPreferences ¶
func (s *Store) GetUserPreferences(ctx context.Context, find *FindUserPreferences) (*UserPreferences, error)
func (*Store) GetUserRefreshTokenByID ¶
func (s *Store) GetUserRefreshTokenByID(ctx context.Context, userID int32, tokenID string) (*storepb.RefreshTokensUserSetting_RefreshToken, error)
GetUserRefreshTokenByID returns a specific refresh token.
func (*Store) GetUserRefreshTokens ¶
func (s *Store) GetUserRefreshTokens(ctx context.Context, userID int32) ([]*storepb.RefreshTokensUserSetting_RefreshToken, error)
GetUserRefreshTokens returns the refresh tokens of the user.
func (*Store) GetUserSetting ¶
func (s *Store) GetUserSetting(ctx context.Context, find *FindUserSetting) (*storepb.UserSetting, error)
func (*Store) GetUserWebhooks ¶
func (s *Store) GetUserWebhooks(ctx context.Context, userID int32) ([]*storepb.WebhooksUserSetting_Webhook, error)
GetUserWebhooks returns the webhooks of the user.
func (*Store) ListAIConversations ¶
func (s *Store) ListAIConversations(ctx context.Context, find *FindAIConversation) ([]*AIConversation, error)
func (*Store) ListAIMessages ¶
func (*Store) ListActiveUserIDs ¶
func (*Store) ListActivities ¶
func (*Store) ListAgentMetrics ¶
func (s *Store) ListAgentMetrics(ctx context.Context, find *FindAgentMetrics) ([]*AgentMetrics, error)
func (*Store) ListAttachments ¶
func (s *Store) ListAttachments(ctx context.Context, find *FindAttachment) ([]*Attachment, error)
func (*Store) ListEpisodicMemories ¶
func (s *Store) ListEpisodicMemories(ctx context.Context, find *FindEpisodicMemory) ([]*EpisodicMemory, error)
func (*Store) ListIdentityProviders ¶
func (s *Store) ListIdentityProviders(ctx context.Context, find *FindIdentityProvider) ([]*storepb.IdentityProvider, error)
func (*Store) ListInboxes ¶
ListInboxes retrieves inbox items matching the filter criteria.
func (*Store) ListInstanceSettings ¶
func (s *Store) ListInstanceSettings(ctx context.Context, find *FindInstanceSetting) ([]*storepb.InstanceSetting, error)
func (*Store) ListMemoEmbeddings ¶
func (s *Store) ListMemoEmbeddings(ctx context.Context, find *FindMemoEmbedding) ([]*MemoEmbedding, error)
ListMemoEmbeddings lists memo embeddings.
func (*Store) ListMemoRelations ¶
func (s *Store) ListMemoRelations(ctx context.Context, find *FindMemoRelation) ([]*MemoRelation, error)
func (*Store) ListReactions ¶
func (*Store) ListSchedules ¶
ListSchedules lists schedules with filter.
func (*Store) ListToolMetrics ¶
func (s *Store) ListToolMetrics(ctx context.Context, find *FindToolMetrics) ([]*ToolMetrics, error)
func (*Store) ListUserSettings ¶
func (s *Store) ListUserSettings(ctx context.Context, find *FindUserSetting) ([]*storepb.UserSetting, error)
func (*Store) Migrate ¶
Migrate migrates the database schema to the latest version. It checks the current schema version and applies any necessary migrations. It also seeds the database with initial data if in demo mode.
func (*Store) RemoveUserPersonalAccessToken ¶
func (s *Store) RemoveUserPersonalAccessToken(ctx context.Context, userID int32, tokenID string) error
RemoveUserPersonalAccessToken removes a PAT from the user.
func (*Store) RemoveUserRefreshToken ¶
RemoveUserRefreshToken removes a refresh token from the user.
func (*Store) RemoveUserWebhook ¶
RemoveUserWebhook removes the webhook of the user.
func (*Store) UpdateAIConversation ¶
func (s *Store) UpdateAIConversation(ctx context.Context, update *UpdateAIConversation) (*AIConversation, error)
func (*Store) UpdateAttachment ¶
func (s *Store) UpdateAttachment(ctx context.Context, update *UpdateAttachment) error
func (*Store) UpdateIdentityProvider ¶
func (s *Store) UpdateIdentityProvider(ctx context.Context, update *UpdateIdentityProviderV1) (*storepb.IdentityProvider, error)
func (*Store) UpdateInbox ¶
UpdateInbox updates an existing inbox item.
func (*Store) UpdateMemo ¶
func (s *Store) UpdateMemo(ctx context.Context, update *UpdateMemo) error
func (*Store) UpdatePATLastUsed ¶
func (s *Store) UpdatePATLastUsed(ctx context.Context, userID int32, tokenID string, lastUsed *timestamppb.Timestamp) error
UpdatePATLastUsed updates the last_used_at timestamp of a PAT.
func (*Store) UpdateSchedule ¶
func (s *Store) UpdateSchedule(ctx context.Context, update *UpdateSchedule) error
UpdateSchedule updates a schedule.
func (*Store) UpdateUser ¶
func (*Store) UpdateUserWebhook ¶
func (s *Store) UpdateUserWebhook(ctx context.Context, userID int32, webhook *storepb.WebhooksUserSetting_Webhook) error
UpdateUserWebhook updates an existing webhook for the user.
func (*Store) UpsertAgentMetrics ¶
func (s *Store) UpsertAgentMetrics(ctx context.Context, upsert *UpsertAgentMetrics) (*AgentMetrics, error)
func (*Store) UpsertInstanceSetting ¶
func (s *Store) UpsertInstanceSetting(ctx context.Context, upsert *storepb.InstanceSetting) (*storepb.InstanceSetting, error)
func (*Store) UpsertMemoEmbedding ¶
func (s *Store) UpsertMemoEmbedding(ctx context.Context, embedding *MemoEmbedding) (*MemoEmbedding, error)
UpsertMemoEmbedding inserts or updates a memo embedding.
func (*Store) UpsertMemoRelation ¶
func (s *Store) UpsertMemoRelation(ctx context.Context, create *MemoRelation) (*MemoRelation, error)
func (*Store) UpsertReaction ¶
func (*Store) UpsertToolMetrics ¶
func (s *Store) UpsertToolMetrics(ctx context.Context, upsert *UpsertToolMetrics) (*ToolMetrics, error)
func (*Store) UpsertUserPreferences ¶
func (s *Store) UpsertUserPreferences(ctx context.Context, upsert *UpsertUserPreferences) (*UserPreferences, error)
func (*Store) UpsertUserSetting ¶
func (s *Store) UpsertUserSetting(ctx context.Context, upsert *storepb.UserSetting) (*storepb.UserSetting, error)
func (*Store) VectorSearch ¶
func (s *Store) VectorSearch(ctx context.Context, opts *VectorSearchOptions) ([]*MemoWithScore, error)
VectorSearch performs vector similarity search.
type ToolMetrics ¶
type ToolMetrics struct {
HourBucket time.Time
ToolName string
ID int64
CallCount int64
SuccessCount int64
LatencySumMs int64
}
ToolMetrics represents hourly aggregated metrics for a tool.
type UpdateAIConversation ¶
type UpdateAttachment ¶
type UpdateIdentityProvider ¶
type UpdateIdentityProviderV1 ¶
type UpdateIdentityProviderV1 struct {
Name *string
IdentifierFilter *string
Config *storepb.IdentityProviderConfig
ID int32
Type storepb.IdentityProvider_Type
}
type UpdateInbox ¶
type UpdateInbox struct {
Status InboxStatus
ID int32
}
UpdateInbox contains fields that can be updated for an inbox item.
type UpdateMemo ¶
type UpdateMemo struct {
UID *string
CreatedTs *int64
UpdatedTs *int64
RowStatus *RowStatus
Content *string
Visibility *Visibility
Pinned *bool
Payload *storepb.MemoPayload
ID int32
}
type UpdateSchedule ¶
type UpdateSchedule struct {
StartTs *int64
EndTs *int64
CreatedTs *int64
UpdatedTs *int64
RowStatus *RowStatus
Title *string
UID *string
Description *string
Payload *string
Location *string
AllDay *bool
Timezone *string
RecurrenceRule *string
RecurrenceEndTs *int64
Reminders *string
ID int32
}
UpdateSchedule is the update request for schedule.
type UpdateUser ¶
type UpsertAgentMetrics ¶
type UpsertAgentMetrics struct {
HourBucket time.Time
AgentType string
Errors string
RequestCount int64
SuccessCount int64
LatencySumMs int64
LatencyP50Ms int32
LatencyP95Ms int32
}
UpsertAgentMetrics specifies the data for upserting agent metrics.
type UpsertPromptVersionMetrics ¶
type UpsertPromptVersionMetrics struct {
HourBucket time.Time
AgentType string
PromptVersion string
RequestCount int64
SuccessCount int64
AvgLatencyMs int64
}
UpsertPromptVersionMetrics specifies the data for upserting prompt version metrics.
type UpsertToolMetrics ¶
type UpsertToolMetrics struct {
HourBucket time.Time
ToolName string
CallCount int64
SuccessCount int64
LatencySumMs int64
}
UpsertToolMetrics specifies the data for upserting tool metrics.
type UpsertUserPreferences ¶
UpsertUserPreferences specifies the data for upserting user preferences.
type UserCostSettings ¶ added in v0.93.0
type UserCostSettings struct {
UserID int32
DailyBudgetUSD *float64 // NULL = unlimited
PerSessionThresholdUSD float64
AlertEnabled bool
AlertEmail bool
AlertInApp bool
BudgetResetAt *time.Time
}
UserCostSettings represents user-specific cost control settings. UserCostSettings 表示用户特定的成本控制设置。
type UserPreferences ¶
UserPreferences represents user preferences for AI personalization.
type UserSetting ¶
type UserSetting struct {
Value string
UserID int32
Key storepb.UserSetting_Key
}
type VectorSearchOptions ¶
VectorSearchOptions represents the options for vector search.
func (*VectorSearchOptions) Validate ¶
func (o *VectorSearchOptions) Validate() error
Validate validates the VectorSearchOptions.
type Visibility ¶
type Visibility string
Visibility is the type of a visibility.
const ( // Public is the PUBLIC visibility. Public Visibility = "PUBLIC" // Protected is the PROTECTED visibility. Protected Visibility = "PROTECTED" // Private is the PRIVATE visibility. Private Visibility = "PRIVATE" )
func (Visibility) String ¶
func (v Visibility) String() string