首次提交:初始化项目代码

This commit is contained in:
sunct
2026-07-31 14:44:48 +08:00
commit a4fe393571
119 changed files with 29105 additions and 0 deletions
+95
View File
@@ -0,0 +1,95 @@
package model
// Document 上传文档模型,记录文档元数据和原始内容
type Document struct {
ID string `json:"id"` // 文档唯一标识
UserID string `json:"user_id"` // 关联的用户ID
Name string `json:"name"` // 文档名称
Type string `json:"type"` // 文件类型(扩展名)
Size int64 `json:"size"` // 文件大小(字节)
MIMEType string `json:"mime_type"` // MIME类型
Content string `json:"content"` // 文档原始内容
Status string `json:"status"` // 处理状态:uploading/processing/processed/failed
ErrorMsg string `json:"error_msg,omitempty"` // 处理失败的错误信息
CreatedAt string `json:"created_at"` // 创建时间
UpdatedAt string `json:"updated_at"` // 更新时间
}
// DocumentChunk 文档切片模型,用于向量检索的文本块
type DocumentChunk struct {
ID string `json:"id"` // 切片唯一标识
DocumentID string `json:"document_id"` // 关联的文档ID
ChunkIndex int `json:"chunk_index"` // 切片序号
Content string `json:"content"` // 切片文本内容
Embedding string `json:"embedding"` // 向量嵌入(JSON格式)
Metadata string `json:"metadata"` // 元数据(JSON格式)
CreatedAt string `json:"created_at"` // 创建时间
}
// ChatHistory 聊天历史记录模型
type ChatHistory struct {
ID string `json:"id"` // 记录唯一标识
UserID string `json:"user_id"` // 关联的用户ID
Question string `json:"question"` // 用户问题
Answer string `json:"answer"` // AI回答
Context string `json:"context"` // 参考的文档上下文
CreatedAt string `json:"created_at"` // 创建时间
}
// Menu 后台菜单模型
type Menu struct {
ID string `json:"id"` // 菜单唯一标识
Name string `json:"name"` // 菜单名称
Icon string `json:"icon"` // 图标类名
Path string `json:"path"` // 路由路径
ParentID string `json:"parent_id"` // 父菜单ID
SortOrder int `json:"sort_order"` // 排序权重
IsFixed bool `json:"is_fixed"` // 是否固定菜单(不可删除)
IsEnabled bool `json:"is_enabled"` // 是否启用
CreatedAt string `json:"created_at"` // 创建时间
UpdatedAt string `json:"updated_at"` // 更新时间
}
// SystemConfig 系统配置模型,存储网站全局设置
type SystemConfig struct {
ID string `json:"id"` // 配置唯一标识
WebsiteDomain string `json:"website_domain"` // 网站域名
WebsiteLogo string `json:"website_logo"` // 网站LogoBase64
LogoPath string `json:"logo_path"` // Logo文件路径
WebsiteTitle string `json:"website_title"` // 网站标题
WebsiteDesc string `json:"website_desc"` // 网站简介(短)
WebsiteDescription string `json:"website_description"` // 网站描述(长)
WebsiteKeywords string `json:"website_keywords"` // 网站关键词
AdminEmail string `json:"admin_email"` // 管理员邮箱
AdminName string `json:"admin_name"` // 管理员名称
SEOKeywords string `json:"seo_keywords"` // SEO关键词
SEODescription string `json:"seo_description"` // SEO描述
DatabasePath string `json:"database_path"` // 数据库文件路径
AdminPageSize int `json:"admin_page_size"` // 后台列表分页大小
CreatedAt string `json:"created_at"` // 创建时间
UpdatedAt string `json:"updated_at"` // 更新时间
}
// LoginHistory 登录历史记录模型
type LoginHistory struct {
ID string `json:"id"` // 记录唯一标识
UserID string `json:"user_id"` // 关联的用户ID
UserName string `json:"user_name"` // 用户名
IP string `json:"ip"` // 登录IP
Location string `json:"location"` // 登录地点
UserAgent string `json:"user_agent"` // 浏览器UA
Success bool `json:"success"` // 是否登录成功
Message string `json:"message"` // 结果消息
CreatedAt string `json:"created_at"` // 创建时间
}
// Notification 系统通知模型
type Notification struct {
ID string `json:"id"`
Type string `json:"type"` // 通知类型:user/resume/portfolio/quiz/system
Title string `json:"title"` // 通知标题
Message string `json:"message"` // 通知内容
URL string `json:"url"` // 点击跳转链接
IsRead bool `json:"is_read"` // 是否已读
CreatedAt string `json:"created_at"` // 创建时间
}