Files
yawan f7fc992f57
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-weknora) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (latest, advisory) (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Build & Publish (dsh-weknora) / Publish to npm (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
WeKnora deployment source with the reviewed wiki identity, summary and recovery fixes
2026-09-22 16:19:06 +08:00

122 lines
4.9 KiB
Go

package workbench
import "time"
type Balance struct {
TenantID uint64 `json:"tenant_id" gorm:"primaryKey"`
UserID string `json:"user_id" gorm:"primaryKey"`
Balance int64 `json:"balance"`
Reserved int64 `json:"reserved"`
UpdatedAt time.Time `json:"updated_at"`
}
func (Balance) TableName() string { return "workbench_balances" }
type Transaction struct {
ID string `json:"id" gorm:"primaryKey"`
TenantID uint64 `json:"tenant_id" gorm:"uniqueIndex:wb_transaction_key"`
UserID string `json:"user_id"`
Delta int64 `json:"delta"`
Kind string `json:"kind"`
Reason string `json:"reason"`
ActorID string `json:"actor_id"`
IdempotencyKey string `json:"-" gorm:"uniqueIndex:wb_transaction_key"`
Metadata JSON `json:"metadata" gorm:"type:jsonb"`
CreatedAt time.Time `json:"created_at"`
}
func (Transaction) TableName() string { return "workbench_transactions" }
type Usage struct {
ID string `json:"id" gorm:"primaryKey"`
TenantID uint64 `json:"tenant_id" gorm:"uniqueIndex:wb_usage_key"`
OwnerID string `json:"owner_id"`
JobID string `json:"job_id"`
CallID string `json:"call_id" gorm:"uniqueIndex:wb_usage_key"`
AgentID string `json:"agent_id"`
ModelID string `json:"model_id"`
Action string `json:"action"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
Points int64 `json:"points"`
Status string `json:"status"`
Metadata JSON `json:"metadata" gorm:"type:jsonb"`
CreatedAt time.Time `json:"created_at"`
}
func (Usage) TableName() string { return "workbench_usage" }
type BalanceHold struct {
ID string `gorm:"primaryKey"`
TenantID uint64
UserID string
Amount int64
Status string
ExpiresAt time.Time
CreatedAt time.Time
}
func (BalanceHold) TableName() string { return "workbench_balance_holds" }
type Consumption struct {
ID string `json:"id" gorm:"primaryKey"`
TenantID uint64 `json:"tenant_id" gorm:"uniqueIndex:wb_consumption_key"`
OwnerID string `json:"owner_id" gorm:"uniqueIndex:wb_consumption_key"`
AgentID string `json:"agent_id" gorm:"uniqueIndex:wb_consumption_key"`
KBID string `json:"kb_id" gorm:"uniqueIndex:wb_consumption_key"`
ChunkID string `json:"chunk_id" gorm:"uniqueIndex:wb_consumption_key"`
KnowledgeID string `json:"knowledge_id"`
FileName string `json:"file_name"`
Category string `json:"category"`
Excerpt string `json:"excerpt"`
ResourceID string `json:"resource_id"`
SegmentID string `json:"segment_id"`
JobID string `json:"job_id"`
Status string `json:"status"`
Banned bool `json:"banned"`
LeaseUntil *time.Time `json:"lease_until"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (Consumption) TableName() string { return "workbench_consumption" }
type OperationLog struct {
ID string `json:"id" gorm:"primaryKey"`
TenantID uint64 `json:"tenant_id"`
OwnerID string `json:"owner_id"`
OwnerName string `json:"owner_name"`
Kind string `json:"kind"`
Level string `json:"level"`
Action string `json:"action"`
Message string `json:"message"`
ResourceID string `json:"resource_id"`
TraceID string `json:"trace_id"`
Status int `json:"status"`
Metadata JSON `json:"metadata" gorm:"type:jsonb"`
CreatedAt time.Time `json:"created_at"`
}
func (OperationLog) TableName() string { return "workbench_operation_logs" }
type PendingMemory struct {
ID string `json:"id" gorm:"primaryKey"`
TenantID uint64 `json:"tenant_id"`
OwnerID string `json:"owner_id"`
AgentID string `json:"agent_id"`
Content string `json:"content"`
SourceRef string `json:"source_ref"`
Status string `json:"status"`
ReviewedBy string `json:"reviewed_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LegacyHistoryID string `json:"legacy_history_id,omitempty"`
NativeMemoryID string `json:"native_memory_id,omitempty"`
ReconfirmedContent string `json:"reconfirmed_content,omitempty"`
ReconfirmedAt *time.Time `json:"reconfirmed_at,omitempty"`
CanReconfirm bool `json:"can_reconfirm" gorm:"-"`
ReconfirmationUnavailableReason string `json:"reconfirmation_unavailable_reason,omitempty" gorm:"-"`
}
func (PendingMemory) TableName() string { return "workbench_pending_memories" }