feat: 完善项目架构并增强分析页面功能
- 新增项目文档和 Docker 配置 - 添加 README.md 和 TODO.md 项目文档 - 为各服务添加 Dockerfile 和 docker-compose 配置 - 重构后端架构 - 新增 adapter 层(HTTP/Python 适配器) - 新增 repository 层(数据访问抽象) - 新增 router 模块统一管理路由 - 新增账单处理 handler - 扩展前端 UI 组件库 - 新增 Calendar、DateRangePicker、Drawer、Popover 等组件 - 集成 shadcn-svelte 组件库 - 增强分析页面功能 - 添加时间范围筛选器(支持本月默认值) - 修复 DateRangePicker 默认值显示问题 - 优化数据获取和展示逻辑 - 完善分析器服务 - 新增 FastAPI 服务接口 - 改进账单清理器实现
This commit is contained in:
@@ -18,6 +18,10 @@ type Config struct {
|
||||
UploadDir string // 上传文件目录
|
||||
OutputDir string // 输出文件目录
|
||||
|
||||
// Analyzer 服务配置 (HTTP 模式)
|
||||
AnalyzerURL string // Python 分析服务 URL
|
||||
AnalyzerMode string // 适配器模式: http 或 subprocess
|
||||
|
||||
// MongoDB 配置
|
||||
MongoURI string // MongoDB 连接 URI
|
||||
MongoDatabase string // 数据库名称
|
||||
@@ -34,6 +38,10 @@ type configFile struct {
|
||||
Path string `yaml:"path"`
|
||||
Script string `yaml:"script"`
|
||||
} `yaml:"python"`
|
||||
Analyzer struct {
|
||||
URL string `yaml:"url"`
|
||||
Mode string `yaml:"mode"` // http 或 subprocess
|
||||
} `yaml:"analyzer"`
|
||||
Directories struct {
|
||||
Upload string `yaml:"upload"`
|
||||
Output string `yaml:"output"`
|
||||
@@ -116,6 +124,10 @@ func Load() {
|
||||
Global.UploadDir = "server/uploads"
|
||||
Global.OutputDir = "server/outputs"
|
||||
|
||||
// Analyzer 默认值
|
||||
Global.AnalyzerURL = getEnvOrDefault("ANALYZER_URL", "http://localhost:8001")
|
||||
Global.AnalyzerMode = getEnvOrDefault("ANALYZER_MODE", "http")
|
||||
|
||||
// MongoDB 默认值
|
||||
Global.MongoURI = getEnvOrDefault("MONGO_URI", "mongodb://localhost:27017")
|
||||
Global.MongoDatabase = getEnvOrDefault("MONGO_DATABASE", "billai")
|
||||
@@ -148,6 +160,13 @@ func Load() {
|
||||
if cfg.Directories.Output != "" {
|
||||
Global.OutputDir = cfg.Directories.Output
|
||||
}
|
||||
// Analyzer 配置
|
||||
if cfg.Analyzer.URL != "" {
|
||||
Global.AnalyzerURL = cfg.Analyzer.URL
|
||||
}
|
||||
if cfg.Analyzer.Mode != "" {
|
||||
Global.AnalyzerMode = cfg.Analyzer.Mode
|
||||
}
|
||||
// MongoDB 配置
|
||||
if cfg.MongoDB.URI != "" {
|
||||
Global.MongoURI = cfg.MongoDB.URI
|
||||
@@ -173,6 +192,13 @@ func Load() {
|
||||
if root := os.Getenv("BILLAI_ROOT"); root != "" {
|
||||
Global.ProjectRoot = root
|
||||
}
|
||||
// Analyzer 环境变量覆盖
|
||||
if url := os.Getenv("ANALYZER_URL"); url != "" {
|
||||
Global.AnalyzerURL = url
|
||||
}
|
||||
if mode := os.Getenv("ANALYZER_MODE"); mode != "" {
|
||||
Global.AnalyzerMode = mode
|
||||
}
|
||||
// MongoDB 环境变量覆盖
|
||||
if uri := os.Getenv("MONGO_URI"); uri != "" {
|
||||
Global.MongoURI = uri
|
||||
@@ -195,4 +221,3 @@ func ResolvePath(path string) string {
|
||||
}
|
||||
return filepath.Join(Global.ProjectRoot, path)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user