fawney19
a0ffc2c406
refactor(metrics): rename model_alias_* to model_mapping_* for clarity
2025-12-15 20:39:32 +08:00
fawney19
a7bfab1475
debug: add logging for model support checking and refactor cache resolution priority
...
- 在 aware_scheduler.py 中添加调试日志,用于跟踪模型支持检查过程
- 重构 model_cache.py 的别名解析逻辑:调整优先级为 alias > provider_model_name > direct_match
- 优化缓存命中路径,将直接匹配逻辑移到别名匹配失败后执行
2025-12-15 18:52:34 +08:00
fawney19
84d4db0f8d
feat(model): include alias info in cache invalidation
...
- Pass provider_model_name to invalidate_model_cache() when creating models
- Pass provider_model_aliases to invalidate_model_cache() when updating models
- Ensures alias-based resolve cache keys are properly cleared on model changes
2025-12-15 18:27:49 +08:00
fawney19
903b182fdf
fix(scheduler): correct whitelist validation logic
...
- Use 'is not None' instead of truthiness check for allowed_api_formats
- Use 'is not None' instead of truthiness check for allowed_models
- Use 'is not None' instead of truthiness check for allowed_providers
- Use 'is not None' check for allowed_endpoints to distinguish empty list from None
- Fixes issue where empty whitelist (empty list) was incorrectly treated as no restriction
2025-12-15 18:27:41 +08:00
fawney19
d9bd0790fe
feat(cache): improve model cache invalidation for alias resolution
...
- Add provider_model_name and provider_model_aliases to invalidate_model_cache()
- Clear resolve cache keys for both model name and aliases when invalidating
- Also clear resolve cache in invalidate_global_model_cache() for GlobalModel names
- Handle SQLite gracefully by catching OperationalError and ProgrammingError
- Optimize fallback query to pre-filter by provider_model_name when JSONB fails
2025-12-15 18:27:31 +08:00
fawney19
c6fcc7982d
fix(database): optimize model alias resolution indexes
...
- Fix table name casing (use lowercase 'models' instead of 'Model')
- Convert provider_model_aliases to jsonb for better performance and GIN index support
- Use jsonb_path_ops for more efficient JSONB GIN indexing
- Add dialect check to only apply jsonb conversion on PostgreSQL
- Improve downgrade migration to properly restore json column type
2025-12-15 18:27:25 +08:00
fawney19
aaa6a8f60d
database: add indexes for model alias resolution
...
- Create indexes on provider_model_name and provider_model_aliases
- Optimize model lookup performance for direct match and alias resolution
- Support efficient JSONB queries on provider_model_aliases
2025-12-15 18:13:49 +08:00
fawney19
11774c69b6
refactor(mapper): use model alias resolution service
...
- Replace direct GlobalModel.name lookup with ModelCacheService.resolve_global_model_by_name_or_alias()
- Support model aliases in source_model parameter
- Leverage model resolution caching for better performance
2025-12-15 18:13:41 +08:00
fawney19
8f0a0cbdb1
refactor(scheduler): integrate model alias resolution
...
- Use ModelCacheService.resolve_global_model_by_name_or_alias() for model lookups
- Support both requested model name and resolved GlobalModel name in validation
- Track resolved_model_name for proper allow_models checking
- Improve model availability checks to handle alias resolution
- Fix transient/detached object handling in global_model merge
- Add more descriptive debug logs for alias resolution mismatches
- Clean up code formatting (line length, imports organization)
2025-12-15 18:13:35 +08:00
fawney19
51b85915d2
feat(cache): implement model alias resolution with caching
...
- Add resolve_global_model_by_name_or_alias() supporting direct match and alias lookup
- Support both provider_model_name and provider_model_aliases matching
- Implement caching for resolved models with TTL
- Add conflict detection when alias maps to multiple GlobalModels
- Record resolution metrics: method, cache hits, duration, conflicts
- Fallback to Python-level filtering for non-PostgreSQL databases
- Add cache invalidation methods for GlobalModel
2025-12-15 18:13:28 +08:00
fawney19
b0d295c6c9
feat(metrics): add model alias resolution metrics
...
- model_alias_resolution_total: track resolution methods and cache hits
- model_alias_resolution_duration_seconds: measure resolution performance
- model_alias_conflict_total: monitor alias conflicts across GlobalModels
2025-12-15 18:13:19 +08:00
fawney19
c94f011462
fix(docker): set SETUPTOOLS_SCM_PRETEND_VERSION for pip install in base image
2025-12-15 15:34:31 +08:00
fawney19
3296d026e3
fix(frontend): only show model mapping when actual model differs from requested model
2025-12-15 15:05:30 +08:00
fawney19
2e01c7cf5a
refactor(frontend): remove AliasManagement view
2025-12-15 14:31:03 +08:00
fawney19
88e37594cf
refactor(backend): update handlers, utilities and core modules after models restructure
2025-12-15 14:30:53 +08:00
fawney19
03ee6c16d9
refactor(frontend): refactor model management with aliases, remove mappings UI
2025-12-15 14:30:42 +08:00
fawney19
743f23e640
feat(frontend): add ModelAliasDialog component for alias management
2025-12-15 14:30:31 +08:00
fawney19
7068aa9130
refactor(backend): optimize cache system and model/provider services
2025-12-15 14:30:21 +08:00
fawney19
56fb6bf36c
refactor(backend): update model catalog and provider APIs after mappings removal
2025-12-15 14:30:10 +08:00
fawney19
728f9bb126
refactor(backend): remove model mappings module
2025-12-15 14:30:00 +08:00
fawney19
5319c06f0e
migrate: remove model mappings and add aliases support
2025-12-15 14:29:47 +08:00
fawney19
0ef6e04593
Merge branch 'dev'
2025-12-14 20:02:01 +08:00
fawney19
beae7a2616
feat(api): add unified Models API endpoint
...
- Add models_service.py with model query logic and caching
- Add models.py unified endpoint supporting Claude/OpenAI/Gemini formats
- Auto-detect API format based on request headers
- Support /v1/models and /v1beta/models (Gemini) paths
- Update route registration and comments
2025-12-14 20:01:19 +08:00
fawney19
b3fbe00657
feat: add version management with setuptools-scm
...
- Configure hatch-vcs for automatic version generation from git tags
- Update pyproject.toml to use dynamic versioning
- Add src/_version.py for runtime version access
- Update src/__init__.py to import version from _version
- Add __APP_VERSION__ to frontend vite config
- Add version script to frontend package.json
- Update CI workflows to trigger on version tags instead of branches
2025-12-14 00:16:03 +08:00
fawney19
2f9d943647
fix(system): fix timezone handling in dashboard and stats services
...
- Use app timezone instead of UTC for date calculations in dashboard routes
- Ensure consistency between stats_daily.date and timezone-aware comparisons
- Fix date calculations in cleanup scheduler to handle DST correctly
- Update log message in stats aggregator to use business date
2025-12-14 00:16:03 +08:00
fawney19
7d0003e61e
refactor(backend): optimize usage service and database helpers
2025-12-14 00:16:03 +08:00
fawney19
d564842c4d
refactor(frontend): optimize view pages (admin, shared, user)
2025-12-14 00:16:03 +08:00
fawney19
9ca845f9d0
refactor(frontend): optimize feature components (models, providers, usage)
2025-12-14 00:16:02 +08:00
fawney19
cb990b9018
refactor(frontend): optimize layout (remove MobileNav, enhance MainLayout)
2025-12-14 00:16:02 +08:00
fawney19
f53d3d180d
refactor(frontend): optimize UI components (ScatterChart, ActivityHeatmap, table-card)
2025-12-14 00:16:02 +08:00
fawney19
c55058758b
refactor(frontend): 补充优化剩余组件
...
- 优化 TooltipContent 组件
- 改进 ModelsTab 和 UserModelDetailDrawer 组件
2025-12-14 00:16:02 +08:00
fawney19
9fa093c96c
refactor(frontend): 优化配置和类型定义
...
- 更新 ESLint 配置
- 优化 Vue 类型声明文件
2025-12-14 00:16:02 +08:00
fawney19
380fd1c4d4
refactor(frontend): 优化工具和 API 模块
...
- 改进 sanitize 工具函数
- 优化 mocks 数据和处理器
- 优化 auth API 模块
2025-12-14 00:16:02 +08:00
fawney19
fda0bfa8de
refactor(frontend): 优化用户视图页面
...
- 改进 Announcements, ModelCatalog, MyApiKeys 页面及其组件
2025-12-14 00:16:02 +08:00
fawney19
466b8a62a7
refactor(frontend): 优化共享视图页面
...
- 改进 Dashboard 和 Usage 页面
2025-12-14 00:16:02 +08:00
fawney19
5ec1af0907
refactor(frontend): 优化管理后台视图
...
- 改进 AliasManagement, ApiKeys, AuditLogs, CacheMonitoring, ModelManagement, SystemSettings, Users 页面
2025-12-14 00:16:02 +08:00
fawney19
79089debe4
refactor(frontend): 优化可组合函数
...
- 改进 useClipboard, useFormDialog, useTTLAnalysis composables
2025-12-14 00:16:02 +08:00
fawney19
113441780e
refactor(frontend): 优化 Users 功能模块
...
- 改进 UserFormDialog 组件
2025-12-14 00:16:02 +08:00
fawney19
a75b983419
refactor(frontend): 优化 Usage 功能模块可组合函数
...
- 改进 useUsageData 和 useUsageFilters composables
2025-12-14 00:16:02 +08:00
fawney19
63e1a0d823
refactor(frontend): 优化 Usage 功能模块组件
...
- 改进 HorizontalRequestTimeline, IntervalTimelineCard, RequestDetailDrawer 等组件
- 优化表格展示组件
2025-12-14 00:16:02 +08:00
fawney19
737ab3b530
refactor(frontend): 优化 Providers 功能模块
...
- 改进 ProviderFormDialog, KeyFormDialog, EndpointFormDialog 等组件
- 优化 ModelsTab 组件
2025-12-14 00:16:02 +08:00
fawney19
730209acc6
refactor(frontend): 优化 Models 功能模块
...
- 改进 ModelDetailDrawer 和 AliasDialog 组件
2025-12-14 00:16:02 +08:00
fawney19
3f82b6d7c6
refactor(frontend): 优化 API Keys 功能模块
...
- 改进 StandaloneKeyFormDialog 组件
2025-12-14 00:16:02 +08:00
fawney19
504ef471c4
refactor(frontend): 优化统计组件
...
- 改进 ActivityHeatmap 组件
2025-12-14 00:16:02 +08:00
fawney19
48196d94ea
refactor(frontend): 优化图表组件
...
- 改进 BarChart, LineChart, ScatterChart 组件
- 优化响应式布局和类型定义
2025-12-14 00:16:02 +08:00
fawney19
a49834d87d
refactor(frontend): 优化布局组件
...
- 改进 CardSection 和 Section 组件
- 优化布局结构和样式
2025-12-14 00:16:02 +08:00
fawney19
ffc798c41d
refactor(frontend): 优化公共组件
...
- 改进 EmptyState 和 LoadingState 组件
- 优化 CodeHighlight 样式和功能
2025-12-14 00:16:02 +08:00
fawney19
c2eaa9181a
refactor(frontend): 优化 UI 基础组件
...
- 添加默认 class 属性支持
- 改进组件类型定义
- 优化属性配置
2025-12-14 00:16:02 +08:00
fawney19
ca60202636
fix: 修复链路追踪密钥显示和默认选中逻辑
...
1. 修复密钥脱敏显示问题:先解密再脱敏,避免显示加密后的 base64 数据
2. 优化详情默认选中逻辑:优先显示最后一个有效结果(成功/失败),而非未执行/跳过
2025-12-14 00:16:02 +08:00
fawney19
21eedbe331
feat: add version management with setuptools-scm
...
- Configure hatch-vcs for automatic version generation from git tags
- Update pyproject.toml to use dynamic versioning
- Add src/_version.py for runtime version access
- Update src/__init__.py to import version from _version
- Add __APP_VERSION__ to frontend vite config
- Add version script to frontend package.json
- Update CI workflows to trigger on version tags instead of branches
2025-12-14 00:12:37 +08:00
fawney19
393d4d13ff
fix(system): fix timezone handling in dashboard and stats services
...
- Use app timezone instead of UTC for date calculations in dashboard routes
- Ensure consistency between stats_daily.date and timezone-aware comparisons
- Fix date calculations in cleanup scheduler to handle DST correctly
- Update log message in stats aggregator to use business date
2025-12-13 23:50:59 +08:00
fawney19
77613795ed
refactor(backend): optimize usage service and database helpers
2025-12-13 22:27:00 +08:00
fawney19
f54127cba5
refactor(frontend): optimize view pages (admin, shared, user)
2025-12-13 22:26:47 +08:00
fawney19
54370cb3f9
refactor(frontend): optimize feature components (models, providers, usage)
2025-12-13 22:26:36 +08:00
fawney19
07b81351d9
refactor(frontend): optimize layout (remove MobileNav, enhance MainLayout)
2025-12-13 22:26:23 +08:00
fawney19
5d829a100a
refactor(frontend): optimize UI components (ScatterChart, ActivityHeatmap, table-card)
2025-12-13 22:26:09 +08:00
fawney19
006cd2c3e5
refactor(frontend): 补充优化剩余组件
...
- 优化 TooltipContent 组件
- 改进 ModelsTab 和 UserModelDetailDrawer 组件
2025-12-12 20:22:27 +08:00
fawney19
90ca5065ee
refactor(frontend): 优化配置和类型定义
...
- 更新 ESLint 配置
- 优化 Vue 类型声明文件
2025-12-12 20:22:22 +08:00
fawney19
66307f8f49
refactor(frontend): 优化工具和 API 模块
...
- 改进 sanitize 工具函数
- 优化 mocks 数据和处理器
- 优化 auth API 模块
2025-12-12 20:22:22 +08:00
fawney19
fc0ca3944e
refactor(frontend): 优化用户视图页面
...
- 改进 Announcements, ModelCatalog, MyApiKeys 页面及其组件
2025-12-12 20:22:15 +08:00
fawney19
25a049d607
refactor(frontend): 优化共享视图页面
...
- 改进 Dashboard 和 Usage 页面
2025-12-12 20:22:15 +08:00
fawney19
15b4f665d1
refactor(frontend): 优化管理后台视图
...
- 改进 AliasManagement, ApiKeys, AuditLogs, CacheMonitoring, ModelManagement, SystemSettings, Users 页面
2025-12-12 20:22:15 +08:00
fawney19
36a84e19b4
refactor(frontend): 优化可组合函数
...
- 改进 useClipboard, useFormDialog, useTTLAnalysis composables
2025-12-12 20:22:09 +08:00
fawney19
1f7db361ad
refactor(frontend): 优化 Users 功能模块
...
- 改进 UserFormDialog 组件
2025-12-12 20:22:09 +08:00
fawney19
766a3280d6
refactor(frontend): 优化 Usage 功能模块可组合函数
...
- 改进 useUsageData 和 useUsageFilters composables
2025-12-12 20:22:08 +08:00
fawney19
4cbe0c38f7
refactor(frontend): 优化 Usage 功能模块组件
...
- 改进 HorizontalRequestTimeline, IntervalTimelineCard, RequestDetailDrawer 等组件
- 优化表格展示组件
2025-12-12 20:22:03 +08:00
fawney19
18ce6637b6
refactor(frontend): 优化 Providers 功能模块
...
- 改进 ProviderFormDialog, KeyFormDialog, EndpointFormDialog 等组件
- 优化 ModelsTab 组件
2025-12-12 20:22:03 +08:00
fawney19
0e1de65eb3
refactor(frontend): 优化 Models 功能模块
...
- 改进 ModelDetailDrawer 和 AliasDialog 组件
2025-12-12 20:22:03 +08:00
fawney19
b64d507c6e
refactor(frontend): 优化 API Keys 功能模块
...
- 改进 StandaloneKeyFormDialog 组件
2025-12-12 20:21:56 +08:00
fawney19
6e63116cc9
refactor(frontend): 优化统计组件
...
- 改进 ActivityHeatmap 组件
2025-12-12 20:21:56 +08:00
fawney19
9ac56662da
refactor(frontend): 优化图表组件
...
- 改进 BarChart, LineChart, ScatterChart 组件
- 优化响应式布局和类型定义
2025-12-12 20:21:55 +08:00
fawney19
624d81f453
refactor(frontend): 优化布局组件
...
- 改进 CardSection 和 Section 组件
- 优化布局结构和样式
2025-12-12 20:21:50 +08:00
fawney19
2423edec98
refactor(frontend): 优化公共组件
...
- 改进 EmptyState 和 LoadingState 组件
- 优化 CodeHighlight 样式和功能
2025-12-12 20:21:50 +08:00
fawney19
d8516e42ea
refactor(frontend): 优化 UI 基础组件
...
- 添加默认 class 属性支持
- 改进组件类型定义
- 优化属性配置
2025-12-12 20:21:50 +08:00
fawney19
a73e0d51db
fix: 修复链路追踪密钥显示和默认选中逻辑
...
1. 修复密钥脱敏显示问题:先解密再脱敏,避免显示加密后的 base64 数据
2. 优化详情默认选中逻辑:优先显示最后一个有效结果(成功/失败),而非未执行/跳过
2025-12-12 18:15:46 +08:00
fawney19
9629e9be0d
Merge pull request #13 from fawney19/dev
...
Dev
2025-12-12 16:21:44 +08:00
fawney19
39ea9e8e86
refactor(frontend): 优化布局和视图页面
...
- 更新 MainLayout 布局组件
- 优化 admin 视图: 用户、模型、Provider、API Keys 等管理页面
- 改进 shared 视图: Dashboard、Usage 页面
- 调整 user 视图: ModelCatalog、MyApiKeys、Settings、Announcements 页面
- 更新 public 视图: Home、CliSection、LogoColorDemo 页面
2025-12-12 16:15:54 +08:00
fawney19
06c0a47b21
refactor(frontend): 优化功能模块组件
...
- 更新 api-keys 模块: StandaloneKeyFormDialog
- 改进 auth 模块: LoginDialog
- 优化 models 模块: AliasDialog, GlobalModelFormDialog, ModelDetailDrawer, TieredPricingEditor
- 重构 providers 模块: 多个表单和对话框组件
- 更新 usage 模块: 时间线、表格和详情组件
- 调整 users 模块: UserFormDialog
2025-12-12 16:15:36 +08:00
fawney19
e9a6233655
refactor(frontend): 优化公共组件和布局组件
...
- 更新 Logo 相关组件 (AetherLogo, HeaderLogo, RippleLogo 等)
- 优化图表组件 (BarChart, LineChart, ScatterChart)
- 改进公共组件 (AlertDialog, EmptyState, LoadingState)
- 调整布局组件 (AppShell, SidebarNav, PageHeader 等)
- 优化 ActivityHeatmap 统计组件
2025-12-12 16:15:16 +08:00
fawney19
44e7117d4a
refactor(frontend): 优化 UI 基础组件
...
- 更新 avatar-image, badge, checkbox, input, switch 等组件
- 优化 dialog, pagination, select-item, tabs 等组件
- 调整 table-card, refresh-button 组件
2025-12-12 16:15:07 +08:00
fawney19
e902595d58
refactor(frontend): 优化工具函数和 mock handler
...
- 更新 format.ts 工具函数
- 调整 mock handler 和 useDateRange composable
2025-12-12 16:14:49 +08:00
fawney19
738a8459c9
feat(frontend): 新增 API 错误类型定义,优化错误处理
...
- 新增 api-error.ts 定义标准错误类型和工具函数
- 重构 error.ts 和 errorParser.ts 使用新类型
- 更新 api client 的类型定义
2025-12-12 16:14:33 +08:00
fawney19
348b454e1e
refactor(frontend): 迁移 ESLint 到 flat config 格式
...
- 移除旧版 .eslintrc.cjs 和 .eslintignore
- 新增 eslint.config.js 使用 flat config 格式
- 更新相关依赖版本
2025-12-12 16:14:15 +08:00
fawney19
06bd178244
fix: TieredPricingEditor 缓存价格处理优化
...
- 缓存价格计算精度从 2 位小数改为 4 位,支持更精细的价格
- 分离 syncToParent 和 getFinalTiers 职责:
- syncToParent: 只同步用户实际输入的值
- getFinalTiers: 提交时获取包含自动计算的最终数据
- GlobalModelFormDialog 和 ProviderModelFormDialog 提交时调用 getFinalTiers
2025-12-12 15:43:00 +08:00
fawney19
53bf74429e
refactor: 重构流式处理模块,提取 StreamContext/Processor/Telemetry
...
- 将 chat_handler_base.py 中的流式处理逻辑拆分为三个独立模块:
- StreamContext: 类型安全的流式上下文数据类,替代原有的 ctx dict
- StreamProcessor: SSE 解析、预读、嵌套错误检测
- StreamTelemetryRecorder: 统计记录(Usage/Audit/Candidate)
- 将硬编码配置外置到 settings.py,支持环境变量覆盖:
- HTTP 超时配置(connect/write/pool)
- 流式处理配置(预读行数、统计延迟)
- 并发控制配置(槽位 TTL、缓存预留比例)
2025-12-12 15:42:45 +08:00
fawney19
0154e2f6b6
Merge pull request #12 from fawney19/dev
...
Dev
2025-12-12 10:23:09 +08:00
fawney19
39defce71c
fix: 修复统计聚合的时区问题,启动时自动回填缺失数据
...
- 统计聚合使用业务时区(APP_TIMEZONE)计算日期,而非UTC
- 新增 _get_business_day_range() 将业务日期转换为UTC时间范围
- 启动时检查并自动回填因容器重启等原因缺失的统计数据
- 修复 aggregate_daily_stats/update_summary/get_today_realtime_stats 等方法的时区计算
2025-12-12 10:06:07 +08:00
fawney19
5722b1422e
fix: 启动时自动回填缺失的统计数据
2025-12-12 09:48:17 +08:00
fawney19
677598eaf3
Merge pull request #11 from fawney19/dev
...
Dev
2025-12-11 21:40:00 +08:00
fawney19
93eeedfcfa
fix: 限制散点图图例显示数量,防止溢出
2025-12-11 21:36:39 +08:00
fawney19
0e8bf0a23b
feat: 请求间隔散点图按模型区分颜色
...
- 后端 get_interval_timeline 接口返回数据添加 model 字段
- 前端散点图按模型分组显示不同颜色的数据点
- 横线统计信息支持按模型分别显示统计数据
- 管理员视图保持按用户分组,用户视图按模型分组
- 更新 mock 数据支持模型字段
2025-12-11 21:33:39 +08:00
fawney19
c43195e510
Merge pull request #10 from fawney19/dev
...
fix: 添加 404.html 支持 SPA 路由刷新
2025-12-11 20:13:27 +08:00
fawney19
2dce4102b0
fix: 添加 404.html 支持 SPA 路由刷新
2025-12-11 20:10:01 +08:00
fawney19
bdce2865bd
Merge pull request #9 from fawney19/dev
...
feat(mock): 添加缓存分析相关接口的 mock 数据
2025-12-11 20:05:09 +08:00
fawney19
f1ae49d2f7
feat(mock): 添加缓存分析相关接口的 mock 数据
...
- interval-timeline: 请求间隔时间线散点图数据
- ttl-analysis: TTL 推荐分析数据
- hit-analysis: 缓存命中分析数据
2025-12-11 19:58:14 +08:00
fawney19
2661f13286
Merge pull request #8 from fawney19/dev
...
Dev
2025-12-11 19:43:51 +08:00
fawney19
859c699e90
fix: 调整 interval-timeline 接口 limit 上限
...
- 管理员接口 limit 上限从 5000 调整为 50000
- 用户接口 limit 上限从 5000 调整为 20000
- 默认 hours 从 168 改为 24
2025-12-11 19:39:51 +08:00
fawney19
6e8107e340
fix: 修复管理员散点图只显示部分用户的问题
...
- 改为按比例采样,保持各用户数据量比例不变
- 散点图默认时间从7天改为当天(24小时)
- limit 从 2000 提高到 10000
2025-12-11 19:34:56 +08:00
fawney19
3dcc2a1c27
Merge pull request #7 from fawney19/dev
...
Dev
2025-12-11 18:52:42 +08:00
fawney19
3b05f0b269
ci: 更新 Docker 镜像名称配置
2025-12-11 18:52:13 +08:00