36451a613d
- Added comprehensive technical design document for AI Brand Monitoring System V5, outlining system architecture, data models, sampling strategies, and monitoring protocols. - Key changes include a shift to a sampling-based trend monitoring approach, updated data collection and storage strategies, and new metrics for performance evaluation. - Implemented migration scripts to support the flattening of brand questions and versioning of question texts, ensuring historical data integrity and version control.
464 lines
20 KiB
Go
464 lines
20 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
|
|
package generated
|
|
|
|
import (
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
type Article struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
SourceType string `json:"source_type"`
|
|
TemplateID pgtype.Int8 `json:"template_id"`
|
|
PromptRuleID pgtype.Int8 `json:"prompt_rule_id"`
|
|
CurrentVersionID pgtype.Int8 `json:"current_version_id"`
|
|
GenerateStatus string `json:"generate_status"`
|
|
PublishStatus string `json:"publish_status"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
WizardStateJson []byte `json:"wizard_state_json"`
|
|
}
|
|
|
|
type ArticleTemplate struct {
|
|
ID int64 `json:"id"`
|
|
Scope string `json:"scope"`
|
|
TenantID pgtype.Int8 `json:"tenant_id"`
|
|
OriginType string `json:"origin_type"`
|
|
ShareCodeID pgtype.Int8 `json:"share_code_id"`
|
|
TemplateKey string `json:"template_key"`
|
|
TemplateName string `json:"template_name"`
|
|
PromptTemplate pgtype.Text `json:"prompt_template"`
|
|
PromptVisibility string `json:"prompt_visibility"`
|
|
ProtectedPromptAssetKey pgtype.Text `json:"protected_prompt_asset_key"`
|
|
CardConfigJson []byte `json:"card_config_json"`
|
|
Status string `json:"status"`
|
|
VersionNo int32 `json:"version_no"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type ArticleVersion struct {
|
|
ID int64 `json:"id"`
|
|
ArticleID int64 `json:"article_id"`
|
|
VersionNo int32 `json:"version_no"`
|
|
Title pgtype.Text `json:"title"`
|
|
HtmlContent pgtype.Text `json:"html_content"`
|
|
MarkdownContent pgtype.Text `json:"markdown_content"`
|
|
WordCount int32 `json:"word_count"`
|
|
SourceLabel pgtype.Text `json:"source_label"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type AuditLog struct {
|
|
ID int64 `json:"id"`
|
|
OperatorID int64 `json:"operator_id"`
|
|
TenantID pgtype.Int8 `json:"tenant_id"`
|
|
Module string `json:"module"`
|
|
Action string `json:"action"`
|
|
BeforeJson []byte `json:"before_json"`
|
|
AfterJson []byte `json:"after_json"`
|
|
Result pgtype.Text `json:"result"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
ResourceType pgtype.Text `json:"resource_type"`
|
|
ResourceID pgtype.Int8 `json:"resource_id"`
|
|
RequestID pgtype.Text `json:"request_id"`
|
|
ErrorMessage pgtype.Text `json:"error_message"`
|
|
}
|
|
|
|
type Brand struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
Name string `json:"name"`
|
|
Description pgtype.Text `json:"description"`
|
|
Status string `json:"status"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
Website pgtype.Text `json:"website"`
|
|
}
|
|
|
|
type BrandKeyword struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
BrandID int64 `json:"brand_id"`
|
|
Name string `json:"name"`
|
|
Status string `json:"status"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type BrandQuestion struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
BrandID int64 `json:"brand_id"`
|
|
KeywordID int64 `json:"keyword_id"`
|
|
QuestionText string `json:"question_text"`
|
|
Status string `json:"status"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type Competitor struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
BrandID int64 `json:"brand_id"`
|
|
Name string `json:"name"`
|
|
Website pgtype.Text `json:"website"`
|
|
Description pgtype.Text `json:"description"`
|
|
ProductLinesJson []byte `json:"product_lines_json"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type GenerationTask struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
ArticleID pgtype.Int8 `json:"article_id"`
|
|
TaskBatchID pgtype.Text `json:"task_batch_id"`
|
|
QuotaReservationID pgtype.Int8 `json:"quota_reservation_id"`
|
|
TaskType string `json:"task_type"`
|
|
RequestHash pgtype.Text `json:"request_hash"`
|
|
InputParamsJson []byte `json:"input_params_json"`
|
|
Status string `json:"status"`
|
|
ErrorMessage pgtype.Text `json:"error_message"`
|
|
StartedAt pgtype.Timestamptz `json:"started_at"`
|
|
CompletedAt pgtype.Timestamptz `json:"completed_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
OperatorID pgtype.Int8 `json:"operator_id"`
|
|
}
|
|
|
|
type KnowledgeChunksMetum struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
KnowledgeItemID int64 `json:"knowledge_item_id"`
|
|
ChunkIndex int32 `json:"chunk_index"`
|
|
TokenCount int32 `json:"token_count"`
|
|
QdrantPointID string `json:"qdrant_point_id"`
|
|
ItemVersion int32 `json:"item_version"`
|
|
Status string `json:"status"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type KnowledgeGroup struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
Name string `json:"name"`
|
|
ParentID pgtype.Int8 `json:"parent_id"`
|
|
SortOrder int32 `json:"sort_order"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type KnowledgeItem struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
GroupID int64 `json:"group_id"`
|
|
SourceType string `json:"source_type"`
|
|
Name string `json:"name"`
|
|
SourceUri pgtype.Text `json:"source_uri"`
|
|
StorageKey string `json:"storage_key"`
|
|
ContentText pgtype.Text `json:"content_text"`
|
|
Status string `json:"status"`
|
|
SizeBytes int64 `json:"size_bytes"`
|
|
ItemVersion int32 `json:"item_version"`
|
|
ErrorMessage pgtype.Text `json:"error_message"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
MarkdownContent pgtype.Text `json:"markdown_content"`
|
|
}
|
|
|
|
type KnowledgeParseTask struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
KnowledgeItemID int64 `json:"knowledge_item_id"`
|
|
SourceType string `json:"source_type"`
|
|
Status string `json:"status"`
|
|
ErrorMessage pgtype.Text `json:"error_message"`
|
|
StartedAt pgtype.Timestamptz `json:"started_at"`
|
|
CompletedAt pgtype.Timestamptz `json:"completed_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type MediaPlatform struct {
|
|
ID int64 `json:"id"`
|
|
PlatformID string `json:"platform_id"`
|
|
Name string `json:"name"`
|
|
Category string `json:"category"`
|
|
ShortName string `json:"short_name"`
|
|
AccentColor string `json:"accent_color"`
|
|
LoginUrl pgtype.Text `json:"login_url"`
|
|
LogoUrl pgtype.Text `json:"logo_url"`
|
|
Status string `json:"status"`
|
|
SortOrder int32 `json:"sort_order"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type Plan struct {
|
|
ID int64 `json:"id"`
|
|
PlanCode string `json:"plan_code"`
|
|
Name string `json:"name"`
|
|
QuotaPolicyJson []byte `json:"quota_policy_json"`
|
|
Status string `json:"status"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type PlatformAccount struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
UserID int64 `json:"user_id"`
|
|
PlatformID string `json:"platform_id"`
|
|
PlatformUid string `json:"platform_uid"`
|
|
Nickname string `json:"nickname"`
|
|
AvatarUrl pgtype.Text `json:"avatar_url"`
|
|
Status string `json:"status"`
|
|
MetadataJson []byte `json:"metadata_json"`
|
|
LastCheckAt pgtype.Timestamptz `json:"last_check_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type PlatformUserRole struct {
|
|
ID int64 `json:"id"`
|
|
UserID int64 `json:"user_id"`
|
|
PlatformRole string `json:"platform_role"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type PluginInstallation struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
UserID int64 `json:"user_id"`
|
|
InstallationKey string `json:"installation_key"`
|
|
InstallationName string `json:"installation_name"`
|
|
BrowserName pgtype.Text `json:"browser_name"`
|
|
ClientVersion pgtype.Text `json:"client_version"`
|
|
InstallationTokenHash string `json:"installation_token_hash"`
|
|
Status string `json:"status"`
|
|
LastSeenAt pgtype.Timestamptz `json:"last_seen_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type PluginSession struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
UserID int64 `json:"user_id"`
|
|
PluginInstallationID pgtype.Int8 `json:"plugin_installation_id"`
|
|
ActionType string `json:"action_type"`
|
|
ResourceType pgtype.Text `json:"resource_type"`
|
|
ResourceID pgtype.Int8 `json:"resource_id"`
|
|
PlatformAccountID pgtype.Int8 `json:"platform_account_id"`
|
|
PlatformID string `json:"platform_id"`
|
|
SessionToken string `json:"session_token"`
|
|
ClientVersion pgtype.Text `json:"client_version"`
|
|
Status string `json:"status"`
|
|
ExpireAt pgtype.Timestamptz `json:"expire_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type PromptRule struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
GroupID pgtype.Int8 `json:"group_id"`
|
|
Name string `json:"name"`
|
|
PromptContent string `json:"prompt_content"`
|
|
Scene pgtype.Text `json:"scene"`
|
|
DefaultTone pgtype.Text `json:"default_tone"`
|
|
DefaultWordCount pgtype.Int4 `json:"default_word_count"`
|
|
Status string `json:"status"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type PromptRuleGroup struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
Name string `json:"name"`
|
|
SortOrder int32 `json:"sort_order"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type PromptRuleKnowledgeGroup struct {
|
|
PromptRuleID int64 `json:"prompt_rule_id"`
|
|
KnowledgeGroupID int64 `json:"knowledge_group_id"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type PublishBatch struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
ArticleID int64 `json:"article_id"`
|
|
InitiatorUserID int64 `json:"initiator_user_id"`
|
|
Status string `json:"status"`
|
|
PublishType string `json:"publish_type"`
|
|
CoverAssetUrl pgtype.Text `json:"cover_asset_url"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type PublishRecord struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
PublishBatchID int64 `json:"publish_batch_id"`
|
|
ArticleID int64 `json:"article_id"`
|
|
PlatformAccountID int64 `json:"platform_account_id"`
|
|
PlatformID string `json:"platform_id"`
|
|
Status string `json:"status"`
|
|
ExternalArticleID pgtype.Text `json:"external_article_id"`
|
|
ExternalArticleUrl pgtype.Text `json:"external_article_url"`
|
|
ExternalManageUrl pgtype.Text `json:"external_manage_url"`
|
|
PublishedAt pgtype.Timestamptz `json:"published_at"`
|
|
RequestPayloadJson []byte `json:"request_payload_json"`
|
|
ResponsePayloadJson []byte `json:"response_payload_json"`
|
|
ErrorMessage pgtype.Text `json:"error_message"`
|
|
RetryCount int32 `json:"retry_count"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type QuotaReservation struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
QuotaType string `json:"quota_type"`
|
|
ResourceType string `json:"resource_type"`
|
|
ResourceID pgtype.Int8 `json:"resource_id"`
|
|
ReservedAmount int32 `json:"reserved_amount"`
|
|
ConsumedAmount int32 `json:"consumed_amount"`
|
|
RefundedAmount int32 `json:"refunded_amount"`
|
|
Status string `json:"status"`
|
|
ExpireAt pgtype.Timestamptz `json:"expire_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
OperatorID pgtype.Int8 `json:"operator_id"`
|
|
}
|
|
|
|
type ScheduleTask struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
PromptRuleID int64 `json:"prompt_rule_id"`
|
|
BrandID pgtype.Int8 `json:"brand_id"`
|
|
Name string `json:"name"`
|
|
CronExpr string `json:"cron_expr"`
|
|
TargetPlatform pgtype.Text `json:"target_platform"`
|
|
StartAt pgtype.Timestamptz `json:"start_at"`
|
|
EndAt pgtype.Timestamptz `json:"end_at"`
|
|
NextRunAt pgtype.Timestamptz `json:"next_run_at"`
|
|
Status string `json:"status"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type TaskRecord struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
TaskType string `json:"task_type"`
|
|
ResourceType string `json:"resource_type"`
|
|
ResourceID int64 `json:"resource_id"`
|
|
Status string `json:"status"`
|
|
RetryCount int32 `json:"retry_count"`
|
|
TaskBatchID pgtype.Text `json:"task_batch_id"`
|
|
ErrorMessage pgtype.Text `json:"error_message"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
OperatorID pgtype.Int8 `json:"operator_id"`
|
|
}
|
|
|
|
type TemplateAssistTask struct {
|
|
ID string `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
TemplateID int64 `json:"template_id"`
|
|
Status string `json:"status"`
|
|
RequestJson []byte `json:"request_json"`
|
|
ResultJson []byte `json:"result_json"`
|
|
ErrorMessage pgtype.Text `json:"error_message"`
|
|
StartedAt pgtype.Timestamptz `json:"started_at"`
|
|
CompletedAt pgtype.Timestamptz `json:"completed_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
TaskType string `json:"task_type"`
|
|
OperatorID pgtype.Int8 `json:"operator_id"`
|
|
}
|
|
|
|
type Tenant struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
Status string `json:"status"`
|
|
FrozenAt pgtype.Timestamptz `json:"frozen_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type TenantMembership struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
UserID int64 `json:"user_id"`
|
|
TenantRole string `json:"tenant_role"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type TenantPlanSubscription struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
PlanID int64 `json:"plan_id"`
|
|
StartAt pgtype.Timestamptz `json:"start_at"`
|
|
EndAt pgtype.Timestamptz `json:"end_at"`
|
|
Status string `json:"status"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type TenantQuotaLedger struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
QuotaType string `json:"quota_type"`
|
|
Delta int32 `json:"delta"`
|
|
BalanceAfter int32 `json:"balance_after"`
|
|
Reason pgtype.Text `json:"reason"`
|
|
ReferenceType pgtype.Text `json:"reference_type"`
|
|
ReferenceID pgtype.Int8 `json:"reference_id"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
OperatorID pgtype.Int8 `json:"operator_id"`
|
|
}
|
|
|
|
type User struct {
|
|
ID int64 `json:"id"`
|
|
Email string `json:"email"`
|
|
Phone pgtype.Text `json:"phone"`
|
|
PasswordHash string `json:"password_hash"`
|
|
Name string `json:"name"`
|
|
AvatarUrl pgtype.Text `json:"avatar_url"`
|
|
Status string `json:"status"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|