86568660a4
feat: 重构模型配置存储与 API Key 加密管理
...
主要修改点:
1. 遗留密码格式兼容 (server/src/app/core/admin_secret.py)
- 新增 legacy_admin_secret_to_password_hash(): 将旧版 admin secret 记录转换为标准 scrypt 哈希格式
2. Scrypt 密码验证增强 (server/src/app/core/security.py)
- verify_password(): 新增 scrypt$ 前缀检测,分流到专用验证函数
- 新增 verify_scrypt_password(): 解析 scrypt$ 格式哈希并验证
3. 模型配置存储重构 (server/src/app/models/system_model_setting.py)
- 新增 SystemModelSetting 模型(slot 为 PK)
- 字段: slot, provider, model_name, endpoint, capability, priority, enabled, api_key_encrypted, created_at, updated_at
4. Settings Repository 扩展 (server/src/app/repositories/settings.py)
- 新增 get_model_settings(): 获取所有模型配置
- 新增 get_model_setting(slot): 按 slot 获取单个模型配置
5. Settings Service 重构 (server/src/app/services/settings.py)
- 新增 ModelSlotConfig dataclass: 封装单个模型槽位的配置属性
- 新增 MODEL_SLOT_CONFIGS 字典: main/backup/vlm/embedding 四个槽位配置
- 重构 save_model_settings(): 批量保存模型配置到 SystemModelSetting 表
- 新增 load_model_settings(): 从 SystemModelSetting 表加载所有模型配置
- read_settings(): 整合 legacy secrets 与新的 SystemModelSetting 表数据
- write_settings(): 拆分 model secrets 到 SystemModelSetting 表
- decrypt_model_secret(): 新增从数据库读取加密的 API Key
6. 数据库模型注册 (server/src/app/db/base.py)
- 注册 SystemModelSetting 模型
7. 前端 API URL 智能解析 (web/src/services/api.js)
- 新增 isLoopbackHost(): 判断是否为回环地址
- 新增 resolveBrowserReachableApiBaseUrl(): 当后端配置为回环地址但浏览器非回环时,自动替换为浏览器 host
- 改进错误信息: "无法连接 FastAPI 后端服务,请确认后端已启动且浏览器可访问后端端口。"
8. 前端 Session 导航增强 (web/src/composables/useSystemState.js)
- installSessionNavigation(): 调用 fetchBootstrapState 后设置运行时 API Base URL
9. Settings 视图增强 (web/src/views/SettingsView.vue)
- API Key 输入框: 新增 @focus="clearModelSecretMask('xxx')" 清除遮罩
- 新增 .secret-bound-state 提示: 显示"已从数据库加密加载,测试会使用已保存密钥"
10. Settings 脚本增强 (web/src/views/scripts/SettingsView.js)
- 新增 clearModelSecretMask(slot): 清除指定槽位的 API Key 遮罩状态
11. CSS 样式 (web/src/assets/styles/views/settings-view.css)
- 新增 .secret-bound-state 样式: 显示数据库已加载密钥的提示样式
2026-05-08 11:14:04 +08:00
c5486dd3d3
feat: 启用后端自动启动与 Setup 引导流程增强
...
主要修改点:
1. 网络绑定扩展至 Server
- .env.example: SERVER_HOST/VITE_SERVER_HOST 从 127.0.0.1 改为 0.0.0.0
- server/src/app/core/config.py: 默认 app_host 从 127.0.0.1 改为 0.0.0.0
2. 启动脚本重构(重命名以区分职责)
- server/start.sh → server/server_start.sh
- web/start.sh → web/web_start.sh
- 根目录 start.sh: 更新调用路径(./start.sh → ./server_start.sh, ./web_start.sh)
- 根目录 start.sh: 新增 setup_ready() 检测函数
- 根目录 start.sh: server_probe_host() 支持 0.0.0.0 探测转换为 127.0.0.1
- 根目录 start.sh: start_setup_web() 新增 X_FINANCIAL_FORCE_SETUP=true
3. API URL 动态化 (web/src/services/api.js)
- 从 localStorage 持久化读取 API Base URL
- 新增 setRuntimeApiBaseUrl() / getRuntimeApiBaseUrl() 导出函数
- buildUrl() 改用运行时 runtimeApiBaseUrl
4. 浏览器 Host 智能解析 (web/vite.config.js)
- 新增 resolveBrowserApiHost(): 根据 server_host/web_host 配置决定浏览器端使用的 API Host
- buildApiBaseUrl() 改用 resolveBrowserApiHost()
- 新增后端启动状态管理: backendStartState / cloneBackendStartState() / updateBackendStep()
- 后端启动分 5 步追踪: config → deps → server → health → done
- 新增 backendStartPromise 避免重复启动
5. Setup 表单逻辑增强 (web/src/composables/useSetupView.js)
- 新增 shouldExposeServerHost(): 判断浏览器 host 是否非本地
- 新增 resolveInitialServerHost(): 当浏览器访问且 server_host 为本地时暴露 0.0.0.0
- buildPayload(): 根据 shouldExposeServerHost() 自动将 127.0.0.1/localhost 转为 0.0.0.0
6. Bootstrap API 扩展 (web/src/services/bootstrap.js)
- 新增 startBootstrapBackend(): POST /bootstrap/backend 触发后端启动
- 新增 fetchBootstrapBackendStatus(): GET /bootstrap/backend 查询后端状态
7. Session 导航增强 (web/src/composables/useSystemState.js)
- 新增 resolveBrowserApiBaseUrl(): 智能解析浏览器端 API Base URL
- installSessionNavigation(): 调用 fetchBootstrapState() 同步引导状态
- 新增 reconcileEntryRoute(): 根据引导状态协调路由
- VITE_SERVER_HOST 默认值从 127.0.0.1 改为 0.0.0.0
8. Setup 视图增强 (web/src/views/SetupRouteView.vue)
- 向 SetupView 传递启动进度相关 props: startupCountdownSeconds, startupLog, startupSteps, startupVisible, progressMessage
9. CSS 新增 (web/src/assets/styles/views/setup-view.css)
- .setup-complete-progress: 进度文字样式
- .setup-modal-backdrop: 模态框遮罩
- .setup-startup-modal: 启动模态框容器
- .setup-startup-head / .setup-startup-body / .setup-startup-spinner: 模态框头部/内容/加载动画
- .setup-startup-steps / .setup-startup-step: 步骤列表及单个步骤
- .setup-startup-step.is-running / .is-success / .is-failed: 步骤状态样式
- .setup-startup-log: 启动日志区域
2026-05-08 10:52:54 +08:00
828e8f5aaf
feat: 优化网络绑定配置支持外部访问
...
主要修改点:
1. 网络绑定调整
- .env.example: WEB_HOST/VITE_WEB_HOST 从 127.0.0.1 改为 0.0.0.0
- server/src/app/core/config.py: 默认 web_host 从 127.0.0.1 改为 0.0.0.0
- web/package.json: Vite 脚本 host 从 127.0.0.1 改为 0.0.0.0
- web/vite.config.js: normalizeState 中 WEB_HOST 默认值从 127.0.0.1 改为 0.0.0.0
2. CORS 配置扩展
- .env.example: CORS_ORIGINS 添加 http://0.0.0.0:5173
3. Shell 脚本权限修复
- server/start.sh, start.sh: 添加可执行权限 (644 -> 755)
4. Setup 表单与验证逻辑简化
- web/src/composables/useSetupView.js:
- 新增 readCurrentWebEndpoint() 从 window.location 自动检测当前 web host/port
- 简化 runtimeInputsReady: 移除 web_host/web_port 必填验证,仅保留 server_host/server_port
- 简化 buildRuntimeFingerprint(): 移除 web_host/web_port
- buildPayload() 改用 readCurrentWebEndpoint() 解析 web 配置
- web/vite.config.js:
- 新增 resolveRuntimePayload(): 运行时解析 web_host/web_port
- 移除 validateRuntimePayload() 中的 web_host/web_port 字段验证
- 移除 testRuntimePorts() 中 web 端口冲突检测逻辑
- 移除 canReuseCurrentWebPort() 函数
5. CSS 清理
- web/src/assets/styles/views/setup-view.css: 移除未使用的 .setup-summary-grid 和 .setup-summary-item 样式
2026-05-08 09:27:45 +08:00
adda87a01d
feat: add system settings with model connectivity and encrypted storage
2026-05-08 08:56:52 +08:00
b8ba0ea6a0
feat: add auth module with login and access control
2026-05-07 14:34:42 +08:00
2d56bc2889
feat: enhance employee CRUD with search, filters, and security module
2026-05-07 13:48:00 +08:00
c00db75c13
feat: add employee management, backend health check, and UI improvements
2026-05-07 11:50:10 +08:00
ae63766c91
Add vue-router, login/setup flow and backend logging
...
Refactor frontend to route-based navigation with vue-router, add
system setup and login pages with API integration. Add structured
logging, access-log middleware and startup lifecycle to FastAPI
backend.
2026-05-06 22:23:42 +08:00
83d7da3d62
feat: add FastAPI backend with PostgreSQL and start script fixes
...
- Add server/ directory with FastAPI backend
- Fix server/start.sh to properly handle venv on Windows/Git Bash
- Add alembic migrations and pyproject.toml
- Add server tests
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-06 17:43:47 +08:00
9785fb527b
refactor: split project into web and server directories
...
- Move frontend to web/ directory
- Add server/ directory for backend
- Restructure project for前后端分离架构
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-06 11:00:38 +08:00