Commit Graph
100 Commits
Author SHA1 Message Date
fawney19 c42ebdd0ee test(handler): add comprehensive stream processor unit tests 2025-12-16 02:40:26 +08:00
fawney19 f1e3c2ab11 feat(frontend-usage): enhance usage UI with first byte latency metrics
- Update usage records table to display first_byte_time_ms metrics
- Improve request timeline visualization for latency tracking
- Extend usage types for new timing information
2025-12-16 02:39:54 +08:00
fawney19 4e2ba0e57f feat(usage): add first_byte_time_ms tracking to usage statistics
- Enhance usage service to capture and store first byte latency metrics
- Update usage API routes to include new timing information
2025-12-16 02:39:36 +08:00
fawney19 a3df41d63d refactor(cli-handler): improve stream handling and response processing
- Refactor CLI handler base for better stream context management
- Optimize request/response handling for Claude, OpenAI, and Gemini CLI adapters
- Enhance telemetry tracking across CLI handlers
2025-12-16 02:39:20 +08:00
fawney19 ad1c8c394c refactor(handler): optimize stream processing and telemetry pipeline
- Enhance stream context for better token and latency tracking
- Refactor stream processor for improved performance metrics
- Improve telemetry integration with first_byte_time_ms support
- Add comprehensive stream context unit tests
2025-12-16 02:39:03 +08:00
fawney19 9b496abb73 feat(db): add first_byte_time_ms column to usage table 2025-12-16 02:38:43 +08:00
fawney19 f3a69a6160 refactor(handler): implement defensive token update strategy and extract cache creation token utility
- Add extract_cache_creation_tokens utility to handle new/old cache creation token formats
- Implement defensive update strategy in StreamContext to prevent zero values overwriting valid data
- Simplify cache creation token parsing in Claude handler using new utility
- Add comprehensive test suite for cache creation token extraction
- Improve type hints in handler classes
2025-12-16 00:02:49 +08:00
fawney19 adcdb73d29 feat(frontend): enhance cache monitoring UI and API integration 2025-12-15 23:12:58 +08:00
fawney19 cf67160821 feat(cache): enhance cache monitoring endpoints and handler integrations 2025-12-15 23:12:48 +08:00
fawney19 718f56ba75 refactor(cache): optimize cache service architecture and provider transport 2025-12-15 23:12:34 +08:00
fawney19 d87de10f62 refactor(docker): remove exposed ports for postgres and redis services 2025-12-15 23:12:23 +08:00
fawney19 c6b9582978 refactor(migration): merge index creation into main aliases migration 2025-12-15 20:47:30 +08:00
fawney19 3d583b0a8d refactor(ui): rename alias to mapping terminology for consistency 2025-12-15 20:41:56 +08:00
fawney19 f849a54027 feat(ui): add model mapping cache monitoring panel in admin 2025-12-15 20:39:57 +08:00
fawney19 f2cd96c34c feat(api): add model mapping cache management endpoints 2025-12-15 20:39:51 +08:00
fawney19 34d480910a feat(frontend): add model mapping cache management API client 2025-12-15 20:39:46 +08:00
fawney19 f16fb28405 feat(model): improve cache invalidation for model updates and deletion
- Handle both old and new aliases when invalidating cache during model updates
- Preserve cache info before deletion to properly invalidate after deletion
- Clear both Redis and in-memory caches on model changes
2025-12-15 20:39:39 +08:00
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