statusview

package
v0.6.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUsageStats

func AddUsageStats(dst *UsageStats, src UsageStats)

func AutomationScope

func AutomationScope(req Request) (automation.Scope, error)

func NewestUsageUpdate

func NewestUsageUpdate(items []BotUsage) time.Time

func NormalizeBotLabel

func NormalizeBotLabel(botID, botName string) (string, string)

func VisibilityKey

func VisibilityKey(req Request) string

Types

type AutomationTaskStore

type AutomationTaskStore interface {
	ListTasks(scope automation.Scope, statusFilter string, limit int) ([]automation.Task, error)
}

type BotUsage

type BotUsage struct {
	BotID   string
	BotName string
	Usage   UsageStats
}

type CampaignStore

type CampaignStore interface {
	ListCampaigns(visibilityKey, statusFilter string, limit int) ([]campaign.Campaign, error)
}

type Request

type Request struct {
	ChatType      string
	ReceiveIDType string
	ReceiveID     string
	SenderUserID  string
	SenderOpenID  string
	SessionKey    string
	Limit         int
}

type Result

type Result struct {
	ScopeLabel    string
	TotalUsage    UsageStats
	BotUsages     []BotUsage
	Tasks         []automation.Task
	Campaigns     []campaign.Campaign
	TaskError     error
	CampaignError error
	UsageError    error
}

func (Result) HasErrors added in v0.6.0

func (r Result) HasErrors() bool

func (Result) IsFailure added in v0.6.0

func (r Result) IsFailure() bool

func (Result) IsPartialSuccess added in v0.6.0

func (r Result) IsPartialSuccess() bool

func (Result) IsSuccess added in v0.6.0

func (r Result) IsSuccess() bool

type Service

type Service struct {
	Automation AutomationTaskStore
	Campaigns  CampaignStore
	Usage      UsageProvider
}

func (Service) Query

func (s Service) Query(req Request) Result

type UsageProvider

type UsageProvider interface {
	UsageForScope(scopeKey string) (UsageStats, []BotUsage, error)
}

type UsageStats

type UsageStats struct {
	InputTokens       int64     `json:"input_tokens,omitempty"`
	CachedInputTokens int64     `json:"cached_input_tokens,omitempty"`
	OutputTokens      int64     `json:"output_tokens,omitempty"`
	Turns             int64     `json:"turns,omitempty"`
	UpdatedAt         time.Time `json:"updated_at,omitempty"`
}

func (*UsageStats) AddUsage

func (s *UsageStats) AddUsage(usage llm.Usage, at time.Time)

func (UsageStats) HasUsage

func (s UsageStats) HasUsage() bool

func (UsageStats) TotalTokens

func (s UsageStats) TotalTokens() int64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL