refactor: Update function signatures across multiple files to improve readability by adding context parameters and enhancing code structure
This commit is contained in:
+13
-13
@@ -44,7 +44,7 @@ const (
|
||||
// ImageInfo 表示与 Chunk 关联的图片信息
|
||||
type ImageInfo struct {
|
||||
// 图片URL(COS)
|
||||
URL string `json:"url" gorm:"type:text"`
|
||||
URL string `json:"url" gorm:"type:text"`
|
||||
// 原始图片URL
|
||||
OriginalURL string `json:"original_url" gorm:"type:text"`
|
||||
// 图片在文本中的开始位置
|
||||
@@ -65,7 +65,7 @@ type ImageInfo struct {
|
||||
// Chunks can be independently embedded as vectors and retrieved, supporting precise content localization
|
||||
type Chunk struct {
|
||||
// Unique identifier of the chunk, using UUID format
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
// Tenant ID, used for multi-tenant isolation
|
||||
TenantID uint64 `json:"tenant_id"`
|
||||
// ID of the parent knowledge, associated with the Knowledge model
|
||||
@@ -73,17 +73,17 @@ type Chunk struct {
|
||||
// ID of the knowledge base, for quick location
|
||||
KnowledgeBaseID string `json:"knowledge_base_id"`
|
||||
// Optional tag ID for categorization within a knowledge base (used for FAQ)
|
||||
TagID string `json:"tag_id" gorm:"type:varchar(36);index"`
|
||||
TagID string `json:"tag_id" gorm:"type:varchar(36);index"`
|
||||
// Actual text content of the chunk
|
||||
Content string `json:"content"`
|
||||
// Index position of the chunk in the original document
|
||||
ChunkIndex int `json:"chunk_index"`
|
||||
// Whether the chunk is enabled, can be used to temporarily disable certain chunks
|
||||
IsEnabled bool `json:"is_enabled" gorm:"default:true"`
|
||||
IsEnabled bool `json:"is_enabled" gorm:"default:true"`
|
||||
// Status of the chunk
|
||||
Status int `json:"status" gorm:"default:0"`
|
||||
Status int `json:"status" gorm:"default:0"`
|
||||
// Starting character position in the original text
|
||||
StartAt int `json:"start_at" `
|
||||
StartAt int `json:"start_at"`
|
||||
// Ending character position in the original text
|
||||
EndAt int `json:"end_at"`
|
||||
// Previous chunk ID
|
||||
@@ -91,23 +91,23 @@ type Chunk struct {
|
||||
// Next chunk ID
|
||||
NextChunkID string `json:"next_chunk_id"`
|
||||
// Chunk 类型,用于区分不同类型的 Chunk
|
||||
ChunkType ChunkType `json:"chunk_type" gorm:"type:varchar(20);default:'text'"`
|
||||
ChunkType ChunkType `json:"chunk_type" gorm:"type:varchar(20);default:'text'"`
|
||||
// 父 Chunk ID,用于关联图片 Chunk 和原始文本 Chunk
|
||||
ParentChunkID string `json:"parent_chunk_id" gorm:"type:varchar(36);index"`
|
||||
ParentChunkID string `json:"parent_chunk_id" gorm:"type:varchar(36);index"`
|
||||
// 关系 Chunk ID,用于关联关系 Chunk 和原始文本 Chunk
|
||||
RelationChunks JSON `json:"relation_chunks" gorm:"type:json"`
|
||||
RelationChunks JSON `json:"relation_chunks" gorm:"type:json"`
|
||||
// 间接关系 Chunk ID,用于关联间接关系 Chunk 和原始文本 Chunk
|
||||
IndirectRelationChunks JSON `json:"indirect_relation_chunks" gorm:"type:json"`
|
||||
// Metadata 存储 chunk 级别的扩展信息,例如 FAQ 元数据
|
||||
Metadata JSON `json:"metadata" gorm:"type:json"`
|
||||
Metadata JSON `json:"metadata" gorm:"type:json"`
|
||||
// ContentHash 存储内容的 hash 值,用于快速匹配(主要用于 FAQ)
|
||||
ContentHash string `json:"content_hash" gorm:"type:varchar(64);index"`
|
||||
ContentHash string `json:"content_hash" gorm:"type:varchar(64);index"`
|
||||
// 图片信息,存储为 JSON
|
||||
ImageInfo string `json:"image_info" gorm:"type:text"`
|
||||
ImageInfo string `json:"image_info" gorm:"type:text"`
|
||||
// Chunk creation time
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
// Chunk last update time
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
// Soft delete marker, supports data recovery
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
|
||||
}
|
||||
|
||||
@@ -129,10 +129,10 @@ type FAQEntry struct {
|
||||
|
||||
// FAQEntryPayload 用于创建/更新 FAQ 条目的 payload
|
||||
type FAQEntryPayload struct {
|
||||
StandardQuestion string `json:"standard_question" binding:"required"`
|
||||
StandardQuestion string `json:"standard_question" binding:"required"`
|
||||
SimilarQuestions []string `json:"similar_questions"`
|
||||
NegativeQuestions []string `json:"negative_questions"`
|
||||
Answers []string `json:"answers" binding:"required"`
|
||||
Answers []string `json:"answers" binding:"required"`
|
||||
TagID string `json:"tag_id"`
|
||||
IsEnabled *bool `json:"is_enabled,omitempty"`
|
||||
}
|
||||
@@ -144,14 +144,14 @@ const (
|
||||
|
||||
// FAQBatchUpsertPayload 批量导入 FAQ 条目
|
||||
type FAQBatchUpsertPayload struct {
|
||||
Entries []FAQEntryPayload `json:"entries" binding:"required"`
|
||||
Mode string `json:"mode" binding:"oneof=append replace"`
|
||||
Entries []FAQEntryPayload `json:"entries" binding:"required"`
|
||||
Mode string `json:"mode" binding:"oneof=append replace"`
|
||||
KnowledgeID string `json:"knowledge_id"`
|
||||
}
|
||||
|
||||
// FAQSearchRequest FAQ检索请求参数
|
||||
type FAQSearchRequest struct {
|
||||
QueryText string `json:"query_text" binding:"required"`
|
||||
QueryText string `json:"query_text" binding:"required"`
|
||||
VectorThreshold float64 `json:"vector_threshold"`
|
||||
MatchCount int `json:"match_count"`
|
||||
}
|
||||
|
||||
@@ -21,13 +21,26 @@ type AgentStreamEvent struct {
|
||||
// AgentEngine defines the interface for agent execution engine
|
||||
type AgentEngine interface {
|
||||
// Execute executes the agent with conversation history and returns a stream of events
|
||||
Execute(ctx context.Context, sessionID, messageID, query string, llmContext []chat.Message) (*types.AgentState, error)
|
||||
Execute(
|
||||
ctx context.Context,
|
||||
sessionID, messageID, query string,
|
||||
llmContext []chat.Message,
|
||||
) (*types.AgentState, error)
|
||||
}
|
||||
|
||||
// AgentService defines the interface for agent-related operations
|
||||
type AgentService interface {
|
||||
// CreateAgentEngine creates an agent engine with the given configuration, EventBus, and ContextManager
|
||||
CreateAgentEngine(ctx context.Context, config *types.AgentConfig, chatModel chat.Chat, rerankModel rerank.Reranker, eventBus *event.EventBus, contextManager ContextManager, sessionID string, sessionService SessionService) (AgentEngine, error)
|
||||
CreateAgentEngine(
|
||||
ctx context.Context,
|
||||
config *types.AgentConfig,
|
||||
chatModel chat.Chat,
|
||||
rerankModel rerank.Reranker,
|
||||
eventBus *event.EventBus,
|
||||
contextManager ContextManager,
|
||||
sessionID string,
|
||||
sessionService SessionService,
|
||||
) (AgentEngine, error)
|
||||
|
||||
// ValidateConfig validates an agent configuration
|
||||
ValidateConfig(config *types.AgentConfig) error
|
||||
|
||||
@@ -21,13 +21,22 @@ type KnowledgeService interface {
|
||||
customFileName string,
|
||||
) (*types.Knowledge, error)
|
||||
// CreateKnowledgeFromURL creates knowledge from a URL.
|
||||
CreateKnowledgeFromURL(ctx context.Context, kbID string, url string, enableMultimodel *bool) (*types.Knowledge, error)
|
||||
CreateKnowledgeFromURL(
|
||||
ctx context.Context,
|
||||
kbID string,
|
||||
url string,
|
||||
enableMultimodel *bool,
|
||||
) (*types.Knowledge, error)
|
||||
// CreateKnowledgeFromPassage creates knowledge from text passages.
|
||||
CreateKnowledgeFromPassage(ctx context.Context, kbID string, passage []string) (*types.Knowledge, error)
|
||||
// CreateKnowledgeFromPassageSync creates knowledge from text passages and waits until chunks are indexed.
|
||||
CreateKnowledgeFromPassageSync(ctx context.Context, kbID string, passage []string) (*types.Knowledge, error)
|
||||
// CreateKnowledgeFromManual creates or saves manual Markdown knowledge content.
|
||||
CreateKnowledgeFromManual(ctx context.Context, kbID string, payload *types.ManualKnowledgePayload) (*types.Knowledge, error)
|
||||
CreateKnowledgeFromManual(
|
||||
ctx context.Context,
|
||||
kbID string,
|
||||
payload *types.ManualKnowledgePayload,
|
||||
) (*types.Knowledge, error)
|
||||
// GetKnowledgeByID retrieves knowledge by ID.
|
||||
GetKnowledgeByID(ctx context.Context, id string) (*types.Knowledge, error)
|
||||
// GetKnowledgeBatch retrieves a batch of knowledge by IDs.
|
||||
@@ -49,7 +58,11 @@ type KnowledgeService interface {
|
||||
// UpdateKnowledge updates knowledge information.
|
||||
UpdateKnowledge(ctx context.Context, knowledge *types.Knowledge) error
|
||||
// UpdateManualKnowledge updates manual Markdown knowledge content.
|
||||
UpdateManualKnowledge(ctx context.Context, knowledgeID string, payload *types.ManualKnowledgePayload) (*types.Knowledge, error)
|
||||
UpdateManualKnowledge(
|
||||
ctx context.Context,
|
||||
knowledgeID string,
|
||||
payload *types.ManualKnowledgePayload,
|
||||
) (*types.Knowledge, error)
|
||||
// CloneKnowledgeBase clones knowledge to another knowledge base.
|
||||
CloneKnowledgeBase(ctx context.Context, srcID, dstID string) error
|
||||
// UpdateImageInfo updates image information for a knowledge chunk.
|
||||
|
||||
@@ -40,13 +40,28 @@ type SessionService interface {
|
||||
SearchKnowledge(ctx context.Context, knowledgeBaseID, query string) ([]*types.SearchResult, error)
|
||||
// AgentQA performs agent-based question answering with conversation history and streaming support
|
||||
// eventBus is optional - if nil, uses service's default EventBus
|
||||
AgentQA(ctx context.Context, session *types.Session, query string, assistantMessageID string, eventBus *event.EventBus) error
|
||||
AgentQA(
|
||||
ctx context.Context,
|
||||
session *types.Session,
|
||||
query string,
|
||||
assistantMessageID string,
|
||||
eventBus *event.EventBus,
|
||||
) error
|
||||
// ClearContext clears the LLM context for a session
|
||||
ClearContext(ctx context.Context, sessionID string) error
|
||||
// GetWebSearchTempKBState retrieves the temporary KB state for web search from Redis
|
||||
GetWebSearchTempKBState(ctx context.Context, sessionID string) (tempKBID string, seenURLs map[string]bool, knowledgeIDs []string)
|
||||
GetWebSearchTempKBState(
|
||||
ctx context.Context,
|
||||
sessionID string,
|
||||
) (tempKBID string, seenURLs map[string]bool, knowledgeIDs []string)
|
||||
// SaveWebSearchTempKBState saves the temporary KB state for web search to Redis
|
||||
SaveWebSearchTempKBState(ctx context.Context, sessionID string, tempKBID string, seenURLs map[string]bool, knowledgeIDs []string)
|
||||
SaveWebSearchTempKBState(
|
||||
ctx context.Context,
|
||||
sessionID string,
|
||||
tempKBID string,
|
||||
seenURLs map[string]bool,
|
||||
knowledgeIDs []string,
|
||||
)
|
||||
// DeleteWebSearchTempKBState deletes the temporary KB state for web search from Redis and cleans up associated knowledge base and knowledge items
|
||||
DeleteWebSearchTempKBState(ctx context.Context, sessionID string) error
|
||||
}
|
||||
|
||||
@@ -26,5 +26,10 @@ type KnowledgeTagRepository interface {
|
||||
ListByKB(ctx context.Context, tenantID uint64, kbID string) ([]*types.KnowledgeTag, error)
|
||||
Delete(ctx context.Context, tenantID uint64, id string) error
|
||||
// CountReferences returns number of knowledges and chunks that reference the tag.
|
||||
CountReferences(ctx context.Context, tenantID uint64, kbID string, tagID string) (knowledgeCount int64, chunkCount int64, err error)
|
||||
CountReferences(
|
||||
ctx context.Context,
|
||||
tenantID uint64,
|
||||
kbID string,
|
||||
tagID string,
|
||||
) (knowledgeCount int64, chunkCount int64, err error)
|
||||
}
|
||||
|
||||
@@ -28,13 +28,13 @@ const (
|
||||
// and references to the physical file if applicable.
|
||||
type Knowledge struct {
|
||||
// Unique identifier of the knowledge
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
// Tenant ID
|
||||
TenantID uint64 `json:"tenant_id"`
|
||||
// ID of the knowledge base
|
||||
KnowledgeBaseID string `json:"knowledge_base_id"`
|
||||
// Optional tag ID for categorization within a knowledge base
|
||||
TagID string `json:"tag_id" gorm:"type:varchar(36);index"`
|
||||
TagID string `json:"tag_id" gorm:"type:varchar(36);index"`
|
||||
// Type of the knowledge
|
||||
Type string `json:"type"`
|
||||
// Title of the knowledge
|
||||
@@ -62,7 +62,7 @@ type Knowledge struct {
|
||||
// Storage size of the knowledge
|
||||
StorageSize int64 `json:"storage_size"`
|
||||
// Metadata of the knowledge
|
||||
Metadata JSON `json:"metadata" gorm:"type:json"`
|
||||
Metadata JSON `json:"metadata" gorm:"type:json"`
|
||||
// Creation time of the knowledge
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
// Last updated time of the knowledge
|
||||
@@ -72,7 +72,7 @@ type Knowledge struct {
|
||||
// Error message of the knowledge
|
||||
ErrorMessage string `json:"error_message"`
|
||||
// Deletion time of the knowledge
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
|
||||
}
|
||||
|
||||
// GetMetadata returns the metadata as a map[string]string.
|
||||
|
||||
@@ -38,85 +38,85 @@ const (
|
||||
// KnowledgeBase represents a knowledge base entity
|
||||
type KnowledgeBase struct {
|
||||
// Unique identifier of the knowledge base
|
||||
ID string `yaml:"id" json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
ID string `yaml:"id" json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
// Name of the knowledge base
|
||||
Name string `yaml:"name" json:"name"`
|
||||
Name string `yaml:"name" json:"name"`
|
||||
// Type of the knowledge base (document, faq, etc.)
|
||||
Type string `yaml:"type" json:"type" gorm:"type:varchar(32);default:'document'"`
|
||||
Type string `yaml:"type" json:"type" gorm:"type:varchar(32);default:'document'"`
|
||||
// Whether this knowledge base is temporary (ephemeral) and should be hidden from UI
|
||||
IsTemporary bool `yaml:"is_temporary" json:"is_temporary" gorm:"default:false"`
|
||||
IsTemporary bool `yaml:"is_temporary" json:"is_temporary" gorm:"default:false"`
|
||||
// Description of the knowledge base
|
||||
Description string `yaml:"description" json:"description"`
|
||||
Description string `yaml:"description" json:"description"`
|
||||
// Tenant ID
|
||||
TenantID uint64 `yaml:"tenant_id" json:"tenant_id"`
|
||||
TenantID uint64 `yaml:"tenant_id" json:"tenant_id"`
|
||||
// Chunking configuration
|
||||
ChunkingConfig ChunkingConfig `yaml:"chunking_config" json:"chunking_config" gorm:"type:json"`
|
||||
ChunkingConfig ChunkingConfig `yaml:"chunking_config" json:"chunking_config" gorm:"type:json"`
|
||||
// Image processing configuration
|
||||
ImageProcessingConfig ImageProcessingConfig `yaml:"image_processing_config" json:"image_processing_config" gorm:"type:json"`
|
||||
// ID of the embedding model
|
||||
EmbeddingModelID string `yaml:"embedding_model_id" json:"embedding_model_id"`
|
||||
EmbeddingModelID string `yaml:"embedding_model_id" json:"embedding_model_id"`
|
||||
// Summary model ID
|
||||
SummaryModelID string `yaml:"summary_model_id" json:"summary_model_id"`
|
||||
SummaryModelID string `yaml:"summary_model_id" json:"summary_model_id"`
|
||||
// VLM config
|
||||
VLMConfig VLMConfig `yaml:"vlm_config" json:"vlm_config" gorm:"type:json"`
|
||||
VLMConfig VLMConfig `yaml:"vlm_config" json:"vlm_config" gorm:"type:json"`
|
||||
// Storage config
|
||||
StorageConfig StorageConfig `yaml:"cos_config" json:"cos_config" gorm:"column:cos_config;type:json"`
|
||||
StorageConfig StorageConfig `yaml:"cos_config" json:"cos_config" gorm:"column:cos_config;type:json"`
|
||||
// Extract config
|
||||
ExtractConfig *ExtractConfig `yaml:"extract_config" json:"extract_config" gorm:"column:extract_config;type:json"`
|
||||
ExtractConfig *ExtractConfig `yaml:"extract_config" json:"extract_config" gorm:"column:extract_config;type:json"`
|
||||
// FAQConfig stores FAQ specific configuration such as indexing strategy
|
||||
FAQConfig *FAQConfig `yaml:"faq_config" json:"faq_config" gorm:"column:faq_config;type:json"`
|
||||
FAQConfig *FAQConfig `yaml:"faq_config" json:"faq_config" gorm:"column:faq_config;type:json"`
|
||||
// Creation time of the knowledge base
|
||||
CreatedAt time.Time `yaml:"created_at" json:"created_at"`
|
||||
CreatedAt time.Time `yaml:"created_at" json:"created_at"`
|
||||
// Last updated time of the knowledge base
|
||||
UpdatedAt time.Time `yaml:"updated_at" json:"updated_at"`
|
||||
UpdatedAt time.Time `yaml:"updated_at" json:"updated_at"`
|
||||
// Deletion time of the knowledge base
|
||||
DeletedAt gorm.DeletedAt `yaml:"deleted_at" json:"deleted_at" gorm:"index"`
|
||||
DeletedAt gorm.DeletedAt `yaml:"deleted_at" json:"deleted_at" gorm:"index"`
|
||||
// Knowledge count (not stored in database, calculated on query)
|
||||
KnowledgeCount int64 `yaml:"knowledge_count" json:"knowledge_count" gorm:"-"`
|
||||
KnowledgeCount int64 `yaml:"knowledge_count" json:"knowledge_count" gorm:"-"`
|
||||
// Chunk count (not stored in database, calculated on query)
|
||||
ChunkCount int64 `yaml:"chunk_count" json:"chunk_count" gorm:"-"`
|
||||
ChunkCount int64 `yaml:"chunk_count" json:"chunk_count" gorm:"-"`
|
||||
// IsProcessing indicates if there is a processing import task (for FAQ type knowledge bases)
|
||||
IsProcessing bool `yaml:"is_processing" json:"is_processing" gorm:"-"`
|
||||
IsProcessing bool `yaml:"is_processing" json:"is_processing" gorm:"-"`
|
||||
// ProcessingCount indicates the number of knowledge items being processed (for document type knowledge bases)
|
||||
ProcessingCount int64 `yaml:"processing_count" json:"processing_count" gorm:"-"`
|
||||
ProcessingCount int64 `yaml:"processing_count" json:"processing_count" gorm:"-"`
|
||||
}
|
||||
|
||||
// KnowledgeBaseConfig represents the knowledge base configuration
|
||||
type KnowledgeBaseConfig struct {
|
||||
// Chunking configuration
|
||||
ChunkingConfig ChunkingConfig `yaml:"chunking_config" json:"chunking_config"`
|
||||
ChunkingConfig ChunkingConfig `yaml:"chunking_config" json:"chunking_config"`
|
||||
// Image processing configuration
|
||||
ImageProcessingConfig ImageProcessingConfig `yaml:"image_processing_config" json:"image_processing_config"`
|
||||
// FAQ configuration (only for FAQ type knowledge bases)
|
||||
FAQConfig *FAQConfig `yaml:"faq_config" json:"faq_config"`
|
||||
FAQConfig *FAQConfig `yaml:"faq_config" json:"faq_config"`
|
||||
}
|
||||
|
||||
// ChunkingConfig represents the document splitting configuration
|
||||
type ChunkingConfig struct {
|
||||
// Chunk size
|
||||
ChunkSize int `yaml:"chunk_size" json:"chunk_size"`
|
||||
ChunkSize int `yaml:"chunk_size" json:"chunk_size"`
|
||||
// Chunk overlap
|
||||
ChunkOverlap int `yaml:"chunk_overlap" json:"chunk_overlap"`
|
||||
// Separators
|
||||
Separators []string `yaml:"separators" json:"separators"`
|
||||
Separators []string `yaml:"separators" json:"separators"`
|
||||
}
|
||||
|
||||
// COSConfig represents the COS configuration
|
||||
type StorageConfig struct {
|
||||
// Secret ID
|
||||
SecretID string `yaml:"secret_id" json:"secret_id"`
|
||||
SecretID string `yaml:"secret_id" json:"secret_id"`
|
||||
// Secret Key
|
||||
SecretKey string `yaml:"secret_key" json:"secret_key"`
|
||||
SecretKey string `yaml:"secret_key" json:"secret_key"`
|
||||
// Region
|
||||
Region string `yaml:"region" json:"region"`
|
||||
Region string `yaml:"region" json:"region"`
|
||||
// Bucket Name
|
||||
BucketName string `yaml:"bucket_name" json:"bucket_name"`
|
||||
// App ID
|
||||
AppID string `yaml:"app_id" json:"app_id"`
|
||||
AppID string `yaml:"app_id" json:"app_id"`
|
||||
// Path Prefix
|
||||
PathPrefix string `yaml:"path_prefix" json:"path_prefix"`
|
||||
// Provider
|
||||
Provider string `yaml:"provider" json:"provider"`
|
||||
Provider string `yaml:"provider" json:"provider"`
|
||||
}
|
||||
|
||||
func (c StorageConfig) Value() (driver.Value, error) {
|
||||
@@ -176,7 +176,7 @@ func (c *ImageProcessingConfig) Scan(value interface{}) error {
|
||||
|
||||
// VLMConfig represents the VLM configuration
|
||||
type VLMConfig struct {
|
||||
Enabled bool `yaml:"enabled" json:"enabled"`
|
||||
Enabled bool `yaml:"enabled" json:"enabled"`
|
||||
ModelID string `yaml:"model_id" json:"model_id"`
|
||||
}
|
||||
|
||||
@@ -199,10 +199,10 @@ func (c *VLMConfig) Scan(value interface{}) error {
|
||||
|
||||
// ExtractConfig represents the extract configuration for a knowledge base
|
||||
type ExtractConfig struct {
|
||||
Enabled bool `yaml:"enabled" json:"enabled"`
|
||||
Text string `yaml:"text" json:"text,omitempty"`
|
||||
Tags []string `yaml:"tags" json:"tags,omitempty"`
|
||||
Nodes []*GraphNode `yaml:"nodes" json:"nodes,omitempty"`
|
||||
Enabled bool `yaml:"enabled" json:"enabled"`
|
||||
Text string `yaml:"text" json:"text,omitempty"`
|
||||
Tags []string `yaml:"tags" json:"tags,omitempty"`
|
||||
Nodes []*GraphNode `yaml:"nodes" json:"nodes,omitempty"`
|
||||
Relations []*GraphRelation `yaml:"relations" json:"relations,omitempty"`
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ func (e *ExtractConfig) Scan(value interface{}) error {
|
||||
|
||||
// FAQConfig 存储 FAQ 知识库的特有配置
|
||||
type FAQConfig struct {
|
||||
IndexMode FAQIndexMode `yaml:"index_mode" json:"index_mode"`
|
||||
IndexMode FAQIndexMode `yaml:"index_mode" json:"index_mode"`
|
||||
QuestionIndexMode FAQQuestionIndexMode `yaml:"question_index_mode" json:"question_index_mode"`
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -20,21 +20,21 @@ const (
|
||||
|
||||
// MCPService represents an MCP (Model Context Protocol) service configuration
|
||||
type MCPService struct {
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
TenantID uint64 `json:"tenant_id" gorm:"index"`
|
||||
Name string `json:"name" gorm:"type:varchar(255);not null"`
|
||||
Description string `json:"description" gorm:"type:text"`
|
||||
Enabled bool `json:"enabled" gorm:"default:true;index"`
|
||||
TransportType MCPTransportType `json:"transport_type" gorm:"type:varchar(50);not null"`
|
||||
URL *string `json:"url,omitempty" gorm:"type:varchar(512)"` // Optional: required for SSE/HTTP Streamable
|
||||
Headers MCPHeaders `json:"headers" gorm:"type:json"`
|
||||
AuthConfig *MCPAuthConfig `json:"auth_config" gorm:"type:json"`
|
||||
AdvancedConfig *MCPAdvancedConfig `json:"advanced_config" gorm:"type:json"`
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
TenantID uint64 `json:"tenant_id" gorm:"index"`
|
||||
Name string `json:"name" gorm:"type:varchar(255);not null"`
|
||||
Description string `json:"description" gorm:"type:text"`
|
||||
Enabled bool `json:"enabled" gorm:"default:true;index"`
|
||||
TransportType MCPTransportType `json:"transport_type" gorm:"type:varchar(50);not null"`
|
||||
URL *string `json:"url,omitempty" gorm:"type:varchar(512)"` // Optional: required for SSE/HTTP Streamable
|
||||
Headers MCPHeaders `json:"headers" gorm:"type:json"`
|
||||
AuthConfig *MCPAuthConfig `json:"auth_config" gorm:"type:json"`
|
||||
AdvancedConfig *MCPAdvancedConfig `json:"advanced_config" gorm:"type:json"`
|
||||
StdioConfig *MCPStdioConfig `json:"stdio_config,omitempty" gorm:"type:json"` // Required for stdio transport
|
||||
EnvVars MCPEnvVars `json:"env_vars,omitempty" gorm:"type:json"` // Environment variables for stdio
|
||||
EnvVars MCPEnvVars `json:"env_vars,omitempty" gorm:"type:json"` // Environment variables for stdio
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
|
||||
}
|
||||
|
||||
// MCPHeaders represents HTTP headers as a map
|
||||
|
||||
@@ -25,7 +25,7 @@ type History struct {
|
||||
// Messages can contain references to knowledge chunks used to generate responses
|
||||
type Message struct {
|
||||
// Unique identifier for the message
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
// ID of the session this message belongs to
|
||||
SessionID string `json:"session_id"`
|
||||
// Request identifier for tracking API requests
|
||||
@@ -35,7 +35,7 @@ type Message struct {
|
||||
// Message role: "user", "assistant", "system"
|
||||
Role string `json:"role"`
|
||||
// References to knowledge chunks used in the response
|
||||
KnowledgeReferences References `json:"knowledge_references" gorm:"type:json,column:knowledge_references"`
|
||||
KnowledgeReferences References `json:"knowledge_references" gorm:"type:json,column:knowledge_references"`
|
||||
// Agent execution steps (only for assistant messages generated by agent)
|
||||
// This contains the detailed reasoning process and tool calls made by the agent
|
||||
// Stored for user history display, but NOT included in LLM context to avoid redundancy
|
||||
@@ -47,7 +47,7 @@ type Message struct {
|
||||
// Last update timestamp
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
// Soft delete timestamp
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
|
||||
}
|
||||
|
||||
// AgentSteps represents a collection of agent execution steps
|
||||
|
||||
+17
-17
@@ -39,46 +39,46 @@ const (
|
||||
|
||||
// EmbeddingParameters represents the embedding parameters for a model
|
||||
type EmbeddingParameters struct {
|
||||
Dimension int `yaml:"dimension" json:"dimension"`
|
||||
Dimension int `yaml:"dimension" json:"dimension"`
|
||||
TruncatePromptTokens int `yaml:"truncate_prompt_tokens" json:"truncate_prompt_tokens"`
|
||||
}
|
||||
|
||||
type ModelParameters struct {
|
||||
BaseURL string `yaml:"base_url" json:"base_url"`
|
||||
APIKey string `yaml:"api_key" json:"api_key"`
|
||||
InterfaceType string `yaml:"interface_type" json:"interface_type"`
|
||||
BaseURL string `yaml:"base_url" json:"base_url"`
|
||||
APIKey string `yaml:"api_key" json:"api_key"`
|
||||
InterfaceType string `yaml:"interface_type" json:"interface_type"`
|
||||
EmbeddingParameters EmbeddingParameters `yaml:"embedding_parameters" json:"embedding_parameters"`
|
||||
ParameterSize string `yaml:"parameter_size" json:"parameter_size"` // Ollama model parameter size (e.g., "7B", "13B", "70B")
|
||||
ParameterSize string `yaml:"parameter_size" json:"parameter_size"` // Ollama model parameter size (e.g., "7B", "13B", "70B")
|
||||
}
|
||||
|
||||
// Model represents the AI model
|
||||
type Model struct {
|
||||
// Unique identifier of the model
|
||||
ID string `yaml:"id" json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
ID string `yaml:"id" json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
// Tenant ID
|
||||
TenantID uint64 `yaml:"tenant_id" json:"tenant_id"`
|
||||
TenantID uint64 `yaml:"tenant_id" json:"tenant_id"`
|
||||
// Name of the model
|
||||
Name string `yaml:"name" json:"name"`
|
||||
Name string `yaml:"name" json:"name"`
|
||||
// Type of the model
|
||||
Type ModelType `yaml:"type" json:"type"`
|
||||
Type ModelType `yaml:"type" json:"type"`
|
||||
// Source of the model
|
||||
Source ModelSource `yaml:"source" json:"source"`
|
||||
Source ModelSource `yaml:"source" json:"source"`
|
||||
// Description of the model
|
||||
Description string `yaml:"description" json:"description"`
|
||||
// Model parameters in JSON format
|
||||
Parameters ModelParameters `yaml:"parameters" json:"parameters" gorm:"type:json"`
|
||||
Parameters ModelParameters `yaml:"parameters" json:"parameters" gorm:"type:json"`
|
||||
// Whether the model is the default model
|
||||
IsDefault bool `yaml:"is_default" json:"is_default"`
|
||||
IsDefault bool `yaml:"is_default" json:"is_default"`
|
||||
// Whether the model is a builtin model (visible to all tenants)
|
||||
IsBuiltin bool `yaml:"is_builtin" json:"is_builtin" gorm:"default:false"`
|
||||
IsBuiltin bool `yaml:"is_builtin" json:"is_builtin" gorm:"default:false"`
|
||||
// Model status, default: active, possible: downloading, download_failed
|
||||
Status ModelStatus `yaml:"status" json:"status"`
|
||||
Status ModelStatus `yaml:"status" json:"status"`
|
||||
// Creation time of the model
|
||||
CreatedAt time.Time `yaml:"created_at" json:"created_at"`
|
||||
CreatedAt time.Time `yaml:"created_at" json:"created_at"`
|
||||
// Last updated time of the model
|
||||
UpdatedAt time.Time `yaml:"updated_at" json:"updated_at"`
|
||||
UpdatedAt time.Time `yaml:"updated_at" json:"updated_at"`
|
||||
// Deletion time of the model
|
||||
DeletedAt gorm.DeletedAt `yaml:"deleted_at" json:"deleted_at" gorm:"index"`
|
||||
DeletedAt gorm.DeletedAt `yaml:"deleted_at" json:"deleted_at" gorm:"index"`
|
||||
}
|
||||
|
||||
// Value implements the driver.Valuer interface, used to convert ModelParameters to database value
|
||||
|
||||
@@ -48,7 +48,7 @@ type RetrieverEngineParams struct {
|
||||
// Retriever engine type
|
||||
RetrieverEngineType RetrieverEngineType `yaml:"retriever_engine_type" json:"retriever_engine_type"`
|
||||
// Retriever type
|
||||
RetrieverType RetrieverType `yaml:"retriever_type" json:"retriever_type"`
|
||||
RetrieverType RetrieverType `yaml:"retriever_type" json:"retriever_type"`
|
||||
}
|
||||
|
||||
// IndexWithScore represents the index with score
|
||||
|
||||
+12
-12
@@ -8,29 +8,29 @@ import (
|
||||
// SearchResult represents the search result
|
||||
type SearchResult struct {
|
||||
// ID
|
||||
ID string `gorm:"column:id" json:"id"`
|
||||
ID string `gorm:"column:id" json:"id"`
|
||||
// Content
|
||||
Content string `gorm:"column:content" json:"content"`
|
||||
Content string `gorm:"column:content" json:"content"`
|
||||
// Knowledge ID
|
||||
KnowledgeID string `gorm:"column:knowledge_id" json:"knowledge_id"`
|
||||
KnowledgeID string `gorm:"column:knowledge_id" json:"knowledge_id"`
|
||||
// Chunk index
|
||||
ChunkIndex int `gorm:"column:chunk_index" json:"chunk_index"`
|
||||
ChunkIndex int `gorm:"column:chunk_index" json:"chunk_index"`
|
||||
// Knowledge title
|
||||
KnowledgeTitle string `gorm:"column:knowledge_title" json:"knowledge_title"`
|
||||
// Start at
|
||||
StartAt int `gorm:"column:start_at" json:"start_at"`
|
||||
StartAt int `gorm:"column:start_at" json:"start_at"`
|
||||
// End at
|
||||
EndAt int `gorm:"column:end_at" json:"end_at"`
|
||||
EndAt int `gorm:"column:end_at" json:"end_at"`
|
||||
// Seq
|
||||
Seq int `gorm:"column:seq" json:"seq"`
|
||||
Seq int `gorm:"column:seq" json:"seq"`
|
||||
// Score
|
||||
Score float64 `json:"score"`
|
||||
Score float64 ` json:"score"`
|
||||
// Match type
|
||||
MatchType MatchType `json:"match_type"`
|
||||
MatchType MatchType ` json:"match_type"`
|
||||
// SubChunkIndex
|
||||
SubChunkID []string `json:"sub_chunk_id"`
|
||||
SubChunkID []string ` json:"sub_chunk_id"`
|
||||
// Metadata
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
Metadata map[string]string ` json:"metadata"`
|
||||
|
||||
// Chunk 类型
|
||||
ChunkType string `json:"chunk_type"`
|
||||
@@ -78,7 +78,7 @@ func (c *SearchResult) Scan(value interface{}) error {
|
||||
// Pagination represents the pagination parameters
|
||||
type Pagination struct {
|
||||
// Page
|
||||
Page int `form:"page" json:"page" binding:"omitempty,min=1"`
|
||||
Page int `form:"page" json:"page" binding:"omitempty,min=1"`
|
||||
// Page size
|
||||
PageSize int `form:"page_size" json:"page_size" binding:"omitempty,min=1,max=100"`
|
||||
}
|
||||
|
||||
+17
-17
@@ -72,30 +72,30 @@ type ContextConfig struct {
|
||||
// Session represents the session
|
||||
type Session struct {
|
||||
// ID
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
// Title
|
||||
Title string `json:"title"`
|
||||
// Description
|
||||
Description string `json:"description"`
|
||||
// Tenant ID
|
||||
TenantID uint64 `json:"tenant_id" gorm:"index"`
|
||||
TenantID uint64 `json:"tenant_id" gorm:"index"`
|
||||
|
||||
// Strategy configuration
|
||||
KnowledgeBaseID string `json:"knowledge_base_id"` // 关联的知识库ID
|
||||
MaxRounds int `json:"max_rounds"` // 多轮保持轮数
|
||||
EnableRewrite bool `json:"enable_rewrite"` // 多轮改写开关
|
||||
FallbackStrategy FallbackStrategy `json:"fallback_strategy"` // 兜底策略
|
||||
FallbackResponse string `json:"fallback_response"` // 固定回复内容
|
||||
EmbeddingTopK int `json:"embedding_top_k"` // 向量召回TopK
|
||||
KeywordThreshold float64 `json:"keyword_threshold"` // 关键词召回阈值
|
||||
VectorThreshold float64 `json:"vector_threshold"` // 向量召回阈值
|
||||
RerankModelID string `json:"rerank_model_id"` // 排序模型ID
|
||||
RerankTopK int `json:"rerank_top_k"` // 排序TopK
|
||||
RerankThreshold float64 `json:"rerank_threshold"` // 排序阈值
|
||||
SummaryModelID string `json:"summary_model_id"` // 总结模型ID
|
||||
SummaryParameters *SummaryConfig `json:"summary_parameters" gorm:"type:json"` // 总结模型参数
|
||||
AgentConfig *SessionAgentConfig `json:"agent_config" gorm:"type:jsonb"` // Agent 配置(会话级别,仅存储enabled和knowledge_bases)
|
||||
ContextConfig *ContextConfig `json:"context_config" gorm:"type:jsonb"` // 上下文管理配置(可选)
|
||||
KnowledgeBaseID string `json:"knowledge_base_id"` // 关联的知识库ID
|
||||
MaxRounds int `json:"max_rounds"` // 多轮保持轮数
|
||||
EnableRewrite bool `json:"enable_rewrite"` // 多轮改写开关
|
||||
FallbackStrategy FallbackStrategy `json:"fallback_strategy"` // 兜底策略
|
||||
FallbackResponse string `json:"fallback_response"` // 固定回复内容
|
||||
EmbeddingTopK int `json:"embedding_top_k"` // 向量召回TopK
|
||||
KeywordThreshold float64 `json:"keyword_threshold"` // 关键词召回阈值
|
||||
VectorThreshold float64 `json:"vector_threshold"` // 向量召回阈值
|
||||
RerankModelID string `json:"rerank_model_id"` // 排序模型ID
|
||||
RerankTopK int `json:"rerank_top_k"` // 排序TopK
|
||||
RerankThreshold float64 `json:"rerank_threshold"` // 排序阈值
|
||||
SummaryModelID string `json:"summary_model_id"` // 总结模型ID
|
||||
SummaryParameters *SummaryConfig `json:"summary_parameters" gorm:"type:json"` // 总结模型参数
|
||||
AgentConfig *SessionAgentConfig `json:"agent_config" gorm:"type:jsonb"` // Agent 配置(会话级别,仅存储enabled和knowledge_bases)
|
||||
ContextConfig *ContextConfig `json:"context_config" gorm:"type:jsonb"` // 上下文管理配置(可选)
|
||||
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
@@ -7,17 +7,17 @@ import "time"
|
||||
// Knowledge (documents) and FAQ Chunks.
|
||||
type KnowledgeTag struct {
|
||||
// Unique identifier of the tag (UUID)
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
// Tenant ID
|
||||
TenantID uint64 `json:"tenant_id"`
|
||||
// Knowledge base ID that this tag belongs to
|
||||
KnowledgeBaseID string `json:"knowledge_base_id" gorm:"type:varchar(36);index"`
|
||||
// Tag name, unique within the same knowledge base
|
||||
Name string `json:"name" gorm:"type:varchar(128);not null"`
|
||||
Name string `json:"name" gorm:"type:varchar(128);not null"`
|
||||
// Optional display color
|
||||
Color string `json:"color" gorm:"type:varchar(32)"`
|
||||
Color string `json:"color" gorm:"type:varchar(32)"`
|
||||
// Sort order within the same knowledge base
|
||||
SortOrder int `json:"sort_order" gorm:"default:0"`
|
||||
SortOrder int `json:"sort_order" gorm:"default:0"`
|
||||
// Creation time
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
// Last updated time
|
||||
|
||||
+15
-15
@@ -11,37 +11,37 @@ import (
|
||||
// Tenant represents the tenant
|
||||
type Tenant struct {
|
||||
// ID
|
||||
ID uint64 `yaml:"id" json:"id" gorm:"primaryKey"`
|
||||
ID uint64 `yaml:"id" json:"id" gorm:"primaryKey"`
|
||||
// Name
|
||||
Name string `yaml:"name" json:"name"`
|
||||
Name string `yaml:"name" json:"name"`
|
||||
// Description
|
||||
Description string `yaml:"description" json:"description"`
|
||||
Description string `yaml:"description" json:"description"`
|
||||
// API key
|
||||
APIKey string `yaml:"api_key" json:"api_key"`
|
||||
APIKey string `yaml:"api_key" json:"api_key"`
|
||||
// Status
|
||||
Status string `yaml:"status" json:"status" gorm:"default:'active'"`
|
||||
Status string `yaml:"status" json:"status" gorm:"default:'active'"`
|
||||
// Retriever engines
|
||||
RetrieverEngines RetrieverEngines `yaml:"retriever_engines" json:"retriever_engines" gorm:"type:json"`
|
||||
RetrieverEngines RetrieverEngines `yaml:"retriever_engines" json:"retriever_engines" gorm:"type:json"`
|
||||
// Business
|
||||
Business string `yaml:"business" json:"business"`
|
||||
Business string `yaml:"business" json:"business"`
|
||||
// Storage quota (Bytes), default is 10GB, including vector, original file, text, index, etc.
|
||||
StorageQuota int64 `yaml:"storage_quota" json:"storage_quota" gorm:"default:10737418240"`
|
||||
StorageQuota int64 `yaml:"storage_quota" json:"storage_quota" gorm:"default:10737418240"`
|
||||
// Storage used (Bytes)
|
||||
StorageUsed int64 `yaml:"storage_used" json:"storage_used" gorm:"default:0"`
|
||||
StorageUsed int64 `yaml:"storage_used" json:"storage_used" gorm:"default:0"`
|
||||
// Global Agent configuration for this tenant (default for all sessions)
|
||||
AgentConfig *AgentConfig `yaml:"agent_config" json:"agent_config" gorm:"type:jsonb"`
|
||||
AgentConfig *AgentConfig `yaml:"agent_config" json:"agent_config" gorm:"type:jsonb"`
|
||||
// Global Context configuration for this tenant (default for all sessions)
|
||||
ContextConfig *ContextConfig `yaml:"context_config" json:"context_config" gorm:"type:jsonb"`
|
||||
ContextConfig *ContextConfig `yaml:"context_config" json:"context_config" gorm:"type:jsonb"`
|
||||
// Global WebSearch configuration for this tenant
|
||||
WebSearchConfig *WebSearchConfig `yaml:"web_search_config" json:"web_search_config" gorm:"type:jsonb"`
|
||||
WebSearchConfig *WebSearchConfig `yaml:"web_search_config" json:"web_search_config" gorm:"type:jsonb"`
|
||||
// Global Conversation configuration for this tenant (default for normal mode sessions)
|
||||
ConversationConfig *ConversationConfig `yaml:"conversation_config" json:"conversation_config" gorm:"type:jsonb"`
|
||||
// Creation time
|
||||
CreatedAt time.Time `yaml:"created_at" json:"created_at"`
|
||||
CreatedAt time.Time `yaml:"created_at" json:"created_at"`
|
||||
// Last updated time
|
||||
UpdatedAt time.Time `yaml:"updated_at" json:"updated_at"`
|
||||
UpdatedAt time.Time `yaml:"updated_at" json:"updated_at"`
|
||||
// Deletion time
|
||||
DeletedAt gorm.DeletedAt `yaml:"deleted_at" json:"deleted_at" gorm:"index"`
|
||||
DeletedAt gorm.DeletedAt `yaml:"deleted_at" json:"deleted_at" gorm:"index"`
|
||||
}
|
||||
|
||||
// RetrieverEngines represents the retriever engines for a tenant
|
||||
|
||||
+12
-12
@@ -9,19 +9,19 @@ import (
|
||||
// User represents a user in the system
|
||||
type User struct {
|
||||
// Unique identifier of the user
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
// Username of the user
|
||||
Username string `json:"username" gorm:"type:varchar(100);uniqueIndex;not null"`
|
||||
Username string `json:"username" gorm:"type:varchar(100);uniqueIndex;not null"`
|
||||
// Email address of the user
|
||||
Email string `json:"email" gorm:"type:varchar(255);uniqueIndex;not null"`
|
||||
Email string `json:"email" gorm:"type:varchar(255);uniqueIndex;not null"`
|
||||
// Hashed password of the user
|
||||
PasswordHash string `json:"-" gorm:"type:varchar(255);not null"`
|
||||
PasswordHash string `json:"-" gorm:"type:varchar(255);not null"`
|
||||
// Avatar URL of the user
|
||||
Avatar string `json:"avatar" gorm:"type:varchar(500)"`
|
||||
Avatar string `json:"avatar" gorm:"type:varchar(500)"`
|
||||
// Tenant ID that the user belongs to
|
||||
TenantID uint64 `json:"tenant_id" gorm:"index"`
|
||||
TenantID uint64 `json:"tenant_id" gorm:"index"`
|
||||
// Whether the user is active
|
||||
IsActive bool `json:"is_active" gorm:"default:true"`
|
||||
IsActive bool `json:"is_active" gorm:"default:true"`
|
||||
// Creation time of the user
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
// Last updated time of the user
|
||||
@@ -36,11 +36,11 @@ type User struct {
|
||||
// AuthToken represents an authentication token
|
||||
type AuthToken struct {
|
||||
// Unique identifier of the token
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
// User ID that owns this token
|
||||
UserID string `json:"user_id" gorm:"type:varchar(36);index;not null"`
|
||||
UserID string `json:"user_id" gorm:"type:varchar(36);index;not null"`
|
||||
// Token value (JWT or other format)
|
||||
Token string `json:"token" gorm:"type:text;not null"`
|
||||
Token string `json:"token" gorm:"type:text;not null"`
|
||||
// Token type (access_token, refresh_token)
|
||||
TokenType string `json:"token_type" gorm:"type:varchar(50);not null"`
|
||||
// Token expiration time
|
||||
@@ -58,14 +58,14 @@ type AuthToken struct {
|
||||
|
||||
// LoginRequest represents a login request
|
||||
type LoginRequest struct {
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Password string `json:"password" binding:"required,min=6"`
|
||||
}
|
||||
|
||||
// RegisterRequest represents a registration request
|
||||
type RegisterRequest struct {
|
||||
Username string `json:"username" binding:"required,min=3,max=50"`
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Password string `json:"password" binding:"required,min=6"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user