coding-proxy 0.5.2a3__tar.gz → 0.5.2a5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/CHANGELOG.md +11 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/PKG-INFO +1 -1
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/pyproject.toml +1 -1
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/config/config.default.yaml +4 -3
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/server/dashboard.py +218 -35
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/server/routes.py +48 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_app_routes.py +144 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/uv.lock +1 -1
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/.github/workflows/ci.yml +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/.github/workflows/coverage.yml +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/.github/workflows/release.yml +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/.gitignore +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/.pre-commit-config.yaml +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/AGENTS.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/CLAUDE.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/LICENSE +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/README.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/assets/dashboard-v0.4.0.png +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/assets/model-calling-v0.5.0.png +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/assets/session-v0.4.0.png +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/.agents/browser-validation.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/.agents/issue.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/.agents/knowledge-map.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/.agents/reference-specifications.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/arch/config-reference.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/arch/convert.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/arch/design-patterns.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/arch/routing.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/arch/testing.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/arch/vendors.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/framework.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/guide/api-reference.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/guide/cli-reference.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/guide/dashboard.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/guide/monitoring.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/guide/quickstart.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/guide/vendors.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/ops/ci-cd.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/user-guide.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/docs/zh-CN/README.md +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/__main__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/auth/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/auth/providers/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/auth/providers/base.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/auth/providers/github.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/auth/providers/google.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/auth/runtime.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/auth/store.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/cli/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/cli/auth_commands.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/cli/banner.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/compat/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/compat/canonical.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/compat/session_store.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/config/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/config/auth_schema.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/config/loader.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/config/resiliency.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/config/routing.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/config/schema.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/config/server.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/config/session_policy.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/config/vendors.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/convert/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/convert/anthropic_to_gemini.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/convert/anthropic_to_openai.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/convert/gemini_sse_adapter.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/convert/gemini_to_anthropic.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/convert/openai_to_anthropic.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/convert/vendor_channels.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/logging/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/logging/db.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/logging/formatters.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/logging/stats.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/model/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/model/auth.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/model/compat.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/model/constants.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/model/pricing.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/model/token.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/model/vendor.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/native_api/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/native_api/config.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/native_api/extractors/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/native_api/extractors/anthropic.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/native_api/extractors/gemini.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/native_api/extractors/openai.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/native_api/handler.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/native_api/operation.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/native_api/routes.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/native_api/usage_registry.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/pricing.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/circuit_breaker.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/error_classifier.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/executor.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/model_mapper.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/quota_guard.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/rate_limit.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/retry.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/router.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/session_manager.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/session_policy.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/tier.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/usage_parser.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/routing/usage_recorder.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/server/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/server/app.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/server/factory.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/server/responses.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/streaming/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/streaming/anthropic_compat.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/alibaba.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/anthropic.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/antigravity.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/base.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/concurrency.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/copilot.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/copilot_models.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/copilot_token_manager.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/copilot_urls.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/doubao.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/kimi.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/minimax.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/mixins.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/native_anthropic.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/token_manager.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/xiaomi.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/src/coding/proxy/vendors/zhipu.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/e2e/__init__.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/e2e/conftest.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/e2e/test_e2e_http.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/e2e/test_e2e_token.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/e2e/test_e2e_vendor.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_antigravity.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_auto_login.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_banner.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_circuit_breaker.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_cli_usage.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_compat.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_concurrency_monitor.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_config_init.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_config_loader.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_convert_request.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_convert_response.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_convert_sse.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_copilot.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_copilot_convert_request.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_copilot_convert_response.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_copilot_models.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_copilot_urls.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_currency.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_error_classifier.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_executor_in_flight_tracking.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_logging_dual_write.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_mixins.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_model_auth.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_model_compat.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_model_constants.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_model_mapper.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_model_pricing.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_model_token.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_model_vendor.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_native_api_base_url_override.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_native_api_extractors.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_native_api_handler.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_native_api_operation.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_native_api_routes.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_native_vendors.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_parse_usage.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_parse_usage_gemini.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_pricing.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_quota_guard.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_rate_limit.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_retry.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_router_chain.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_router_executor.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_runtime_reauth.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_schema.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_session_aware.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_streaming_anthropic_compat.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_tier.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_tiers_config.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_time_range.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_token_logger.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_token_logger_native_columns.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_token_manager.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_types.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_vendor_channels.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_vendor_streaming.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_vendors.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_zhipu.py +0 -0
- {coding_proxy-0.5.2a3 → coding_proxy-0.5.2a5}/tests/test_zhipu_concurrency.py +0 -0
|
@@ -4,6 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [v0.5.2a5](https://github.com/ThreeFish-AI/coding-proxy/releases/tag/v0.5.2a5) - 2026-07-04
|
|
8
|
+
|
|
9
|
+
- fix(dashboard): 供应商队列拖拽由原生 HTML5 DnD 改为 Pointer Events 实现,修复 v0.5.2a4 引入的拖拽排序功能在浏览器中无法拖动的问题;引入 4px 拖拽阈值、乐观实时重排与指针捕获机制,同步支持触屏设备;拖拽完成后顺序立即影响 cc 运行时供应商优先级调度(实机验证);为 `/dashboard` 响应增加 `Cache-Control: no-cache`,防止浏览器缓存旧内联脚本;补齐前端守卫测试断言 (#271);
|
|
10
|
+
- style(branding): 重设计 logo/favicon 为 `#f5f6fb` 淡色磨砂卡片 + 品牌渐变(`#667eea` → `#764ba2`)`>_` 笔划 + 半透明细描边环,轮廓成为视觉主角、小尺寸下更清晰(Linear/Vercel 风);抽取 `_LOGO_DEFS` 作为品牌渐变 `<defs>` 单一事实源,统一供 SVG favicon、ICO 回退与页面 logo 消费 (#272);
|
|
11
|
+
|
|
12
|
+
## [v0.5.2a4](https://github.com/ThreeFish-AI/coding-proxy/releases/tag/v0.5.2a4) - 2026-07-03
|
|
13
|
+
|
|
14
|
+
- feat(dashboard): 供应商状态模块支持拖拽调整供应商优先级,新增纯重排序端点 `PUT /api/tier-order`(复用 `router.reorder_tiers`,不重置熔断器/配额守卫/rate limit),拖拽后配额与用量统计保持当日值不变;与 `reset -v` 同源、运行时内存生效,失败自动回滚至服务端真实顺序 (#269);
|
|
15
|
+
- feat(session): 扩充标题豁免前缀,新增 `[Session]` 过滤注入式 Prompt 候选;
|
|
16
|
+
- chore(pricing): 更新智谱 GLM-5.2 模型定价配置;
|
|
17
|
+
|
|
7
18
|
## [v0.5.2a3](https://github.com/ThreeFish-AI/coding-proxy/releases/tag/v0.5.2a3) - 2026-07-02
|
|
8
19
|
|
|
9
20
|
- fix(session): 标题豁免前缀扩展至全层级兜底标题,修复 `[Session] <model>` 等 Level 4 合成标题无法豁免(原 `title_exempt_prefixes` 仅 Level 1 生效);改为在 `_extract_session_title` 编排层对 L1/L2/L3/L4 候选统一拦截,命中回退、全豁免返回空串待后续真实输入回填,默认行为零影响 (#267);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: coding-proxy
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2a5
|
|
4
4
|
Summary: A High-Availability, Transparent, and Smart Multi-Vendor Proxy for Claude Code. Support Claude Plans, GitHub Copilot, Google Antigravity, ZAI/GLM, MiniMax, Qwen, Xiaomi, Kimi, Doubao...
|
|
5
5
|
Project-URL: Source Code, https://github.com/ThreeFish-AI/coding-proxy
|
|
6
6
|
Project-URL: User Guide, https://github.com/ThreeFish-AI/coding-proxy/blob/master/docs/user-guide.md
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "coding-proxy"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.2a5"
|
|
4
4
|
description = "A High-Availability, Transparent, and Smart Multi-Vendor Proxy for Claude Code. Support Claude Plans, GitHub Copilot, Google Antigravity, ZAI/GLM, MiniMax, Qwen, Xiaomi, Kimi, Doubao..."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -534,9 +534,9 @@ pricing:
|
|
|
534
534
|
# ── 智谱 GLM ──
|
|
535
535
|
- vendor: zhipu
|
|
536
536
|
model: glm-5.2 # 待区分长短上下文定价
|
|
537
|
-
input_cost_per_mtok: ¥
|
|
538
|
-
output_cost_per_mtok: ¥
|
|
539
|
-
cache_read_cost_per_mtok: ¥
|
|
537
|
+
input_cost_per_mtok: ¥8.00
|
|
538
|
+
output_cost_per_mtok: ¥28.00
|
|
539
|
+
cache_read_cost_per_mtok: ¥2.00
|
|
540
540
|
- vendor: zhipu
|
|
541
541
|
model: glm-5.1 # 待区分长短上下文定价
|
|
542
542
|
input_cost_per_mtok: ¥6.00
|
|
@@ -713,3 +713,4 @@ session_policies:
|
|
|
713
713
|
# 写空列表即关闭豁免。加载时会自动 strip + 去空 + 去重。
|
|
714
714
|
title_exempt_prefixes:
|
|
715
715
|
- "Write the title in the language"
|
|
716
|
+
- "[Session]"
|
|
@@ -12,26 +12,36 @@ from fastapi.responses import HTMLResponse, Response
|
|
|
12
12
|
from ..logging.db import TimePeriod
|
|
13
13
|
|
|
14
14
|
# ── 品牌图标:Tabler terminal-2 核心笔划(> 与 _),不含外框 ──────────────
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
15
|
+
# 容器为「淡色磨砂卡片」(#f5f6fb 浅底 + 品牌紫描边环),> 与 _ 笔划改用品牌渐变
|
|
16
|
+
# (#667eea -> #764ba2)——色彩反转:品牌紫由背景迁移至图标笔划,轮廓成为视觉主角,
|
|
17
|
+
# 更简约、小尺寸下更清晰(Linear/Vercel 风)。保留 Tabler 原始外框笔划会双重描边、
|
|
18
|
+
# 边缘发糊,故仅取 > 与 _ 两条。
|
|
19
|
+
# 单一事实源:_TERMINAL2_PATHS 与 _LOGO_DEFS 同时供 favicon SVG(f-string)与页面
|
|
20
|
+
# logo({{TERMINAL2}} / {{LOGO_DEFS}} 模板替换)消费。
|
|
21
|
+
_BRAND_FROM, _BRAND_TO = "#667eea", "#764ba2"
|
|
22
|
+
_LOGO_DEFS = (
|
|
23
|
+
'<defs><linearGradient id="cpBrand" x1="0" y1="0" x2="1" y2="1">'
|
|
24
|
+
f'<stop offset="0" stop-color="{_BRAND_FROM}"/>'
|
|
25
|
+
f'<stop offset="1" stop-color="{_BRAND_TO}"/>'
|
|
26
|
+
"</linearGradient></defs>"
|
|
27
|
+
)
|
|
18
28
|
_TERMINAL2_PATHS = '<path d="M8 9l3 3l-3 3" /><path d="M13 15l3 0" />'
|
|
19
29
|
|
|
20
30
|
|
|
21
31
|
# ── Favicon (SVG, 现代浏览器主选) ──────────────────────────────────────────
|
|
22
32
|
def _build_favicon_svg() -> str:
|
|
23
|
-
"""生成 24×24 SVG favicon
|
|
33
|
+
"""生成 24×24 SVG favicon:淡色磨砂卡片 + 品牌渐变 terminal-2 笔划.
|
|
24
34
|
|
|
25
|
-
|
|
35
|
+
容器为 ``#f5f6fb`` 浅底圆角方块 + 品牌紫描边环;``>`` 与 ``_`` 笔划由白色改为品牌
|
|
36
|
+
渐变(``url(#cpBrand)``),使图标轮廓成为主角。独立 SVG 文档无 CSS 上下文,
|
|
37
|
+
``currentColor`` 不可靠,故颜色硬编码;``<defs>`` 复用 ``_LOGO_DEFS`` 单一事实源。
|
|
26
38
|
"""
|
|
27
39
|
return (
|
|
28
40
|
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">'
|
|
29
|
-
|
|
30
|
-
'<
|
|
31
|
-
'
|
|
32
|
-
"
|
|
33
|
-
'<rect x="1" y="1" width="22" height="22" rx="6" fill="url(#g)"/>'
|
|
34
|
-
f'<g fill="none" stroke="#ffffff" stroke-width="2" '
|
|
41
|
+
f"{_LOGO_DEFS}"
|
|
42
|
+
'<rect x="1" y="1" width="22" height="22" rx="6" fill="#f5f6fb" '
|
|
43
|
+
'stroke="#667eea" stroke-opacity=".18" stroke-width="1"/>'
|
|
44
|
+
f'<g fill="none" stroke="url(#cpBrand)" stroke-width="2" '
|
|
35
45
|
f'stroke-linecap="round" stroke-linejoin="round">{_TERMINAL2_PATHS}</g>'
|
|
36
46
|
"</svg>"
|
|
37
47
|
)
|
|
@@ -39,11 +49,12 @@ def _build_favicon_svg() -> str:
|
|
|
39
49
|
|
|
40
50
|
# ── Favicon (ICO, 32×32 光栅回退) ─────────────────────────────────────────
|
|
41
51
|
def _build_favicon() -> bytes:
|
|
42
|
-
"""程序化生成 32×32 ICO
|
|
52
|
+
"""程序化生成 32×32 ICO:淡色磨砂卡片 + 品牌渐变 terminal-2 笔划(旧浏览器/Safari 回退).
|
|
43
53
|
|
|
44
|
-
项目无 Pillow/cairosvg 等图像库,故以纯 Python
|
|
45
|
-
+
|
|
46
|
-
|
|
54
|
+
项目无 Pillow/cairosvg 等图像库,故以纯 Python 按像素光栅化:``#f5f6fb`` 浅底圆角
|
|
55
|
+
方块 + 品牌渐变(#667eea -> #764ba2)``>`` 折线与 ``_`` 下划线。沿用原实现「全零
|
|
56
|
+
AND-mask + per-pixel alpha」的圆角透明方案(现代渲染器按 alpha 通道处理透明)。
|
|
57
|
+
32px 下细描边环易锯齿,故 ICO 仅保留浅底 + 渐变笔划,精修外观由 SVG 承载。
|
|
47
58
|
"""
|
|
48
59
|
import math
|
|
49
60
|
import struct
|
|
@@ -52,8 +63,11 @@ def _build_favicon() -> bytes:
|
|
|
52
63
|
radius = 8
|
|
53
64
|
scale = width / 24.0 # SVG 24 单位 -> 像素
|
|
54
65
|
|
|
55
|
-
|
|
56
|
-
|
|
66
|
+
# 图标笔划品牌渐变:#667eea -> #764ba2(与 _LOGO_DEFS 同源)
|
|
67
|
+
r0, g0, b0 = 0x66, 0x7E, 0xEA
|
|
68
|
+
r1, g1, b1 = 0x76, 0x4B, 0xA2
|
|
69
|
+
# 容器底色:#f5f6fb(近白、极浅冷蓝紫)
|
|
70
|
+
tile_r, tile_g, tile_b = 0xF5, 0xF6, 0xFB
|
|
57
71
|
|
|
58
72
|
def inside(x: int, y: int) -> bool:
|
|
59
73
|
"""满铺圆角方块(四角半径 radius)包含判定."""
|
|
@@ -68,30 +82,34 @@ def _build_favicon() -> bytes:
|
|
|
68
82
|
[[0, 0, 0, 0] for _ in range(width)] for _ in range(height)
|
|
69
83
|
]
|
|
70
84
|
|
|
71
|
-
# 1)
|
|
85
|
+
# 1) 浅底圆角背景(扁平 #f5f6fb)
|
|
72
86
|
for y in range(height):
|
|
73
87
|
for x in range(width):
|
|
74
88
|
if not inside(x, y):
|
|
75
89
|
continue
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
90
|
+
buf[y][x] = [tile_b, tile_g, tile_r, 255]
|
|
91
|
+
|
|
92
|
+
def brand_at(px: float, py: float) -> tuple[int, int, int]:
|
|
93
|
+
"""按对角参数 t 返回 (px,py) 处的品牌渐变 RGB(与 SVG url(#cpBrand) 同向)."""
|
|
94
|
+
t = (px + py) / (width + height - 2)
|
|
95
|
+
return (
|
|
96
|
+
int(r0 + (r1 - r0) * t),
|
|
97
|
+
int(g0 + (g1 - g0) * t),
|
|
98
|
+
int(b0 + (b1 - b0) * t),
|
|
99
|
+
)
|
|
83
100
|
|
|
84
101
|
def stamp(px: float, py: float) -> None:
|
|
85
|
-
"""以 (px, py) 为中心盖 ~3px
|
|
102
|
+
"""以 (px, py) 为中心盖 ~3px 品牌渐变方块(笔划加粗,保证小尺寸可辨识)."""
|
|
86
103
|
ix, iy = int(round(px)), int(round(py))
|
|
104
|
+
cr, cg, cb = brand_at(px, py)
|
|
87
105
|
for oy in (-1, 0, 1):
|
|
88
106
|
for ox in (-1, 0, 1):
|
|
89
107
|
nx, ny = ix + ox, iy + oy
|
|
90
108
|
if 0 <= nx < width and 0 <= ny < height:
|
|
91
|
-
buf[ny][nx] = [
|
|
109
|
+
buf[ny][nx] = [cb, cg, cr, 255]
|
|
92
110
|
|
|
93
111
|
def line(x0: float, y0: float, x1: float, y1: float) -> None:
|
|
94
|
-
"""稠密采样 + stamp
|
|
112
|
+
"""稠密采样 + stamp 形成品牌渐变粗线段."""
|
|
95
113
|
dist = math.hypot(x1 - x0, y1 - y0)
|
|
96
114
|
steps = max(1, int(dist * 3))
|
|
97
115
|
for i in range(steps + 1):
|
|
@@ -204,10 +222,11 @@ _DASHBOARD_HTML = """<!DOCTYPE html>
|
|
|
204
222
|
.header-left { display: flex; align-items: center; gap: 12px; }
|
|
205
223
|
.logo {
|
|
206
224
|
width: 32px; height: 32px;
|
|
207
|
-
background:
|
|
225
|
+
background: #f5f6fb;
|
|
226
|
+
border: 1px solid rgba(102,126,234,.18);
|
|
208
227
|
border-radius: 10px;
|
|
209
228
|
display: flex; align-items: center; justify-content: center;
|
|
210
|
-
box-shadow: 0 4px 12px rgba(102,126,234,.
|
|
229
|
+
box-shadow: 0 4px 12px rgba(102,126,234,.18);
|
|
211
230
|
}
|
|
212
231
|
.logo svg { width: 20px; height: 20px; display: block; }
|
|
213
232
|
h1 { font-size: 18px; font-weight: 600; color: var(--text-primary); letter-spacing: -.3px; }
|
|
@@ -411,6 +430,17 @@ _DASHBOARD_HTML = """<!DOCTYPE html>
|
|
|
411
430
|
height: 100%; border-radius: 2px;
|
|
412
431
|
transition: width .6s cubic-bezier(.4,0,.2,1);
|
|
413
432
|
}
|
|
433
|
+
/* ── 供应商状态:拖拽排序(Pointer Events,手柄发起) ── */
|
|
434
|
+
.vendor-item.dragging { opacity: .4; }
|
|
435
|
+
.drag-handle {
|
|
436
|
+
display: flex; align-items: center; flex-shrink: 0;
|
|
437
|
+
color: var(--text-tertiary); font-size: 15px; line-height: 1;
|
|
438
|
+
cursor: grab; user-select: none; touch-action: none; padding: 0 2px;
|
|
439
|
+
opacity: 0; transition: opacity .2s ease;
|
|
440
|
+
}
|
|
441
|
+
.drag-handle:active { cursor: grabbing; }
|
|
442
|
+
.vendor-item:hover .drag-handle { opacity: .55; }
|
|
443
|
+
.drag-handle:hover { opacity: 1 !important; color: var(--text-secondary); }
|
|
414
444
|
/* ── 故障转移表 ── */
|
|
415
445
|
.ft-table-wrap { overflow-x: auto; }
|
|
416
446
|
table { width: 100%; border-collapse: collapse; }
|
|
@@ -785,7 +815,7 @@ _DASHBOARD_HTML = """<!DOCTYPE html>
|
|
|
785
815
|
<body>
|
|
786
816
|
<header>
|
|
787
817
|
<div class="header-left">
|
|
788
|
-
<div class="logo"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#
|
|
818
|
+
<div class="logo"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="url(#cpBrand)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">{{LOGO_DEFS}}{{TERMINAL2}}</svg></div>
|
|
789
819
|
<h1>Coding Proxy Dashboard</h1>
|
|
790
820
|
<span class="badge" id="version-badge">v-.-.-</span>
|
|
791
821
|
</div>
|
|
@@ -1332,12 +1362,15 @@ function renderQuotaBar(qg) {
|
|
|
1332
1362
|
}
|
|
1333
1363
|
|
|
1334
1364
|
function updateVendorStatus(status) {
|
|
1365
|
+
// 拖拽进行中 / 重排序 POST 未决时跳过重渲染,避免抢占正在操作的 DOM
|
|
1366
|
+
if (_tierDrag.active || _tierDrag.inFlight) return;
|
|
1335
1367
|
const tiers = status.tiers || [];
|
|
1336
1368
|
const list = document.getElementById('vendor-list');
|
|
1337
1369
|
if (!tiers.length) {
|
|
1338
1370
|
list.innerHTML = '<div class="empty"><div class="empty-icon">🔌</div>无供应商数据</div>';
|
|
1339
1371
|
return;
|
|
1340
1372
|
}
|
|
1373
|
+
const reorderable = tiers.length >= 2;
|
|
1341
1374
|
list.innerHTML = tiers.map(tier => {
|
|
1342
1375
|
const cb = tier.circuit_breaker || {};
|
|
1343
1376
|
const cbClass = cbStateClass(cb.state);
|
|
@@ -1351,8 +1384,13 @@ function updateVendorStatus(status) {
|
|
|
1351
1384
|
const rlInfo = tier.rate_limit || {};
|
|
1352
1385
|
const rlHtml = rlInfo.limited ? `<span class="status-badge sb-warn">限速中</span>` : '';
|
|
1353
1386
|
|
|
1354
|
-
|
|
1387
|
+
// Pointer Events 重排:仅需 data-vendor 定位;手柄作为拖拽发起点(无原生 draggable)
|
|
1388
|
+
const dragAttrs = ` data-vendor="${tier.name}"`;
|
|
1389
|
+
const handle = reorderable ? `<div class="drag-handle" title="拖拽调整优先级">⠿</div>` : '';
|
|
1390
|
+
|
|
1391
|
+
return `<div class="vendor-item"${dragAttrs}>
|
|
1355
1392
|
<div class="vendor-info">
|
|
1393
|
+
${handle}
|
|
1356
1394
|
<div class="vendor-avatar">${initial}</div>
|
|
1357
1395
|
<span class="vendor-name">${tier.name}</span>
|
|
1358
1396
|
</div>
|
|
@@ -1365,6 +1403,145 @@ function updateVendorStatus(status) {
|
|
|
1365
1403
|
}).join('');
|
|
1366
1404
|
}
|
|
1367
1405
|
|
|
1406
|
+
// ── 供应商状态:拖拽调整优先级(Pointer Events 重排,运行时生效,不重置配额) ────
|
|
1407
|
+
// 采用 Pointer Events 而非原生 HTML5 DnD:后者触屏不支持、跨浏览器易「拿不起来」,
|
|
1408
|
+
// 是业界公认脆弱的重排序方案(故 SortableJS / dnd-kit 等均改用指针事件)。
|
|
1409
|
+
const _tierDrag = {
|
|
1410
|
+
active: false, // 已越过阈值、进入拖拽
|
|
1411
|
+
srcName: null, // 被拖拽 vendor 名
|
|
1412
|
+
srcEl: null, // 被拖拽行
|
|
1413
|
+
pointerId: null, // 捕获的指针 ID
|
|
1414
|
+
startY: 0, // pointerdown 起点 Y
|
|
1415
|
+
origOrder: null, // 拖拽开始时的顺序快照(无变化则跳过 PUT)
|
|
1416
|
+
inFlight: false, // PUT 未决
|
|
1417
|
+
};
|
|
1418
|
+
const _TIER_DRAG_THRESHOLD = 4; // px,越过才判定为拖拽(否则视作点击)
|
|
1419
|
+
|
|
1420
|
+
function _tierCurrentOrder(listEl) {
|
|
1421
|
+
return Array.from(listEl.querySelectorAll('.vendor-item'))
|
|
1422
|
+
.map(function(el) { return el.dataset.vendor; })
|
|
1423
|
+
.filter(Boolean);
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
// 依据指针 Y 与各兄弟行中点比较,即时(乐观)重排 DOM
|
|
1427
|
+
function _tierDragMoveTo(listEl, clientY) {
|
|
1428
|
+
const dragged = _tierDrag.srcEl;
|
|
1429
|
+
if (!dragged) return;
|
|
1430
|
+
const siblings = Array.from(listEl.querySelectorAll('.vendor-item'))
|
|
1431
|
+
.filter(function(el) { return el !== dragged; });
|
|
1432
|
+
for (var i = 0; i < siblings.length; i++) {
|
|
1433
|
+
const rect = siblings[i].getBoundingClientRect();
|
|
1434
|
+
if (clientY < rect.top + rect.height / 2) {
|
|
1435
|
+
if (dragged !== siblings[i] && dragged.nextElementSibling !== siblings[i]) {
|
|
1436
|
+
listEl.insertBefore(dragged, siblings[i]);
|
|
1437
|
+
}
|
|
1438
|
+
return;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
if (listEl.lastElementChild !== dragged) listEl.appendChild(dragged); // 落到末尾
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
function _tierDragReset() {
|
|
1445
|
+
if (_tierDrag.srcEl) {
|
|
1446
|
+
if (_tierDrag.pointerId != null) {
|
|
1447
|
+
try { _tierDrag.srcEl.releasePointerCapture(_tierDrag.pointerId); } catch (_) {}
|
|
1448
|
+
}
|
|
1449
|
+
_tierDrag.srcEl.classList.remove('dragging');
|
|
1450
|
+
}
|
|
1451
|
+
_tierDrag.active = false;
|
|
1452
|
+
_tierDrag.srcName = null;
|
|
1453
|
+
_tierDrag.srcEl = null;
|
|
1454
|
+
_tierDrag.pointerId = null;
|
|
1455
|
+
_tierDrag.startY = 0;
|
|
1456
|
+
_tierDrag.origOrder = null;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
function initTierDrag() {
|
|
1460
|
+
// 指针事件委托绑定在静态容器 #vendor-list 上一次;子节点重渲染后仍生效
|
|
1461
|
+
const list = document.getElementById('vendor-list');
|
|
1462
|
+
if (!list || list.dataset.dndBound === '1') return;
|
|
1463
|
+
list.dataset.dndBound = '1';
|
|
1464
|
+
|
|
1465
|
+
list.addEventListener('pointerdown', function(e) {
|
|
1466
|
+
if (e.button != null && e.button !== 0) return; // 仅主指针/左键
|
|
1467
|
+
const handle = e.target && e.target.closest && e.target.closest('.drag-handle');
|
|
1468
|
+
if (!handle) return; // 仅从手柄发起,避免误触与文本选择
|
|
1469
|
+
const item = handle.closest('.vendor-item');
|
|
1470
|
+
if (!item || !item.dataset.vendor) return;
|
|
1471
|
+
if (list.querySelectorAll('.vendor-item').length < 2) return;
|
|
1472
|
+
_tierDrag.srcEl = item;
|
|
1473
|
+
_tierDrag.srcName = item.dataset.vendor;
|
|
1474
|
+
_tierDrag.pointerId = e.pointerId;
|
|
1475
|
+
_tierDrag.startY = e.clientY;
|
|
1476
|
+
try { item.setPointerCapture(e.pointerId); } catch (_) {} // 捕获后 DOM 重排不丢事件
|
|
1477
|
+
e.preventDefault(); // 阻止文本选择
|
|
1478
|
+
});
|
|
1479
|
+
|
|
1480
|
+
list.addEventListener('pointermove', function(e) {
|
|
1481
|
+
if (!_tierDrag.srcEl || e.pointerId !== _tierDrag.pointerId) return;
|
|
1482
|
+
if (!_tierDrag.active) {
|
|
1483
|
+
if (Math.abs(e.clientY - _tierDrag.startY) < _TIER_DRAG_THRESHOLD) return;
|
|
1484
|
+
_tierDrag.active = true; // 越阈值 → 正式进入拖拽
|
|
1485
|
+
_tierDrag.origOrder = _tierCurrentOrder(list);
|
|
1486
|
+
_tierDrag.srcEl.classList.add('dragging');
|
|
1487
|
+
}
|
|
1488
|
+
e.preventDefault();
|
|
1489
|
+
_tierDragMoveTo(list, e.clientY);
|
|
1490
|
+
});
|
|
1491
|
+
|
|
1492
|
+
function _tierDragFinish(commit) {
|
|
1493
|
+
if (!_tierDrag.srcEl) return;
|
|
1494
|
+
const wasActive = _tierDrag.active;
|
|
1495
|
+
const order = _tierCurrentOrder(list);
|
|
1496
|
+
const orig = _tierDrag.origOrder;
|
|
1497
|
+
_tierDragReset();
|
|
1498
|
+
if (!wasActive) return; // 仅点击手柄未拖动 → 空操作
|
|
1499
|
+
if (!commit) { _tierRevertToList(); return; } // 取消 → 回滚服务端真实顺序
|
|
1500
|
+
if (orig && order.join(',') === orig.join(',')) return; // 顺序未变 → 跳过 PUT
|
|
1501
|
+
persistTierOrder(order); // 提交新顺序(PUT + 失败回滚)
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
list.addEventListener('pointerup', function(e) {
|
|
1505
|
+
if (!_tierDrag.srcEl || e.pointerId !== _tierDrag.pointerId) return;
|
|
1506
|
+
_tierDragFinish(true);
|
|
1507
|
+
});
|
|
1508
|
+
list.addEventListener('pointercancel', function(e) {
|
|
1509
|
+
if (!_tierDrag.srcEl || e.pointerId !== _tierDrag.pointerId) return;
|
|
1510
|
+
_tierDragFinish(false);
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
function persistTierOrder(names) {
|
|
1515
|
+
if (_tierDrag.inFlight) return; // 防并发:上一次未决则忽略
|
|
1516
|
+
if (!Array.isArray(names) || names.length < 2) return;
|
|
1517
|
+
_tierDrag.inFlight = true;
|
|
1518
|
+
fetch('/api/tier-order', {
|
|
1519
|
+
method: 'PUT',
|
|
1520
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1521
|
+
body: JSON.stringify({ vendors: names })
|
|
1522
|
+
}).then(function(res) {
|
|
1523
|
+
_tierDrag.inFlight = false; // 先清守卫,允许随后的 refreshOverview 重渲染
|
|
1524
|
+
if (res.ok) {
|
|
1525
|
+
// 服务端已更新顺序;刷新以同步请求趋势图等的排序
|
|
1526
|
+
if (!_tierDrag.active) refreshOverview().catch(function() {});
|
|
1527
|
+
} else {
|
|
1528
|
+
console.error('tier-order rejected:', res.status);
|
|
1529
|
+
_tierRevertToList();
|
|
1530
|
+
}
|
|
1531
|
+
}).catch(function(e) {
|
|
1532
|
+
_tierDrag.inFlight = false;
|
|
1533
|
+
console.error('tier-order failed:', e);
|
|
1534
|
+
_tierRevertToList();
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
function _tierRevertToList() {
|
|
1539
|
+
// 回滚到服务端真实顺序(PUT 失败 → 服务端顺序未变)
|
|
1540
|
+
fetchJSON('/api/status').then(function(status) {
|
|
1541
|
+
updateVendorStatus(status);
|
|
1542
|
+
}).catch(function() {});
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1368
1545
|
// ── Model Calling 实时状态 ────────────────────────────────
|
|
1369
1546
|
function updateModelCalling(status) {
|
|
1370
1547
|
var wrap = document.getElementById('model-calling-wrap');
|
|
@@ -2200,6 +2377,7 @@ function switchTab(name) {
|
|
|
2200
2377
|
fetchJSON('/api/dashboard/summary?days=7').then(function(s) {
|
|
2201
2378
|
if (s && s.version) document.getElementById('version-badge').textContent = 'v' + s.version;
|
|
2202
2379
|
}).catch(function(){});
|
|
2380
|
+
initTierDrag(); // 绑定供应商列表拖拽(事件委托,幂等)
|
|
2203
2381
|
refresh(); // 仅加载初始页签的数据
|
|
2204
2382
|
setInterval(refresh, 600000); // 每 10 分钟刷新当前页签
|
|
2205
2383
|
if (initial === 'overview') startModelCallingPoll();
|
|
@@ -2207,7 +2385,7 @@ function switchTab(name) {
|
|
|
2207
2385
|
</script>
|
|
2208
2386
|
</body>
|
|
2209
2387
|
</html>
|
|
2210
|
-
""".replace("{{TERMINAL2}}", _TERMINAL2_PATHS)
|
|
2388
|
+
""".replace("{{TERMINAL2}}", _TERMINAL2_PATHS).replace("{{LOGO_DEFS}}", _LOGO_DEFS)
|
|
2211
2389
|
|
|
2212
2390
|
|
|
2213
2391
|
# ── 数据计算工具 ──────────────────────────────────────────────────────────
|
|
@@ -2291,8 +2469,13 @@ def register_dashboard_routes(app: Any) -> None:
|
|
|
2291
2469
|
|
|
2292
2470
|
@app.get("/dashboard", response_class=HTMLResponse, include_in_schema=False)
|
|
2293
2471
|
async def dashboard() -> HTMLResponse:
|
|
2294
|
-
"""返回 Dashboard HTML 页面.
|
|
2295
|
-
|
|
2472
|
+
"""返回 Dashboard HTML 页面.
|
|
2473
|
+
|
|
2474
|
+
内联 JS/CSS 随版本变化,禁用缓存以免浏览器留存旧内联脚本掩盖前端修复。
|
|
2475
|
+
"""
|
|
2476
|
+
return HTMLResponse(
|
|
2477
|
+
content=_DASHBOARD_HTML, headers={"Cache-Control": "no-cache"}
|
|
2478
|
+
)
|
|
2296
2479
|
|
|
2297
2480
|
@app.get("/api/dashboard/summary")
|
|
2298
2481
|
async def dashboard_summary(request: Request, days: int = 7) -> Response:
|
|
@@ -386,6 +386,53 @@ def register_admin_routes(app: Any, router: Any) -> None:
|
|
|
386
386
|
)
|
|
387
387
|
|
|
388
388
|
|
|
389
|
+
def register_tier_order_route(app: Any, router: Any) -> None:
|
|
390
|
+
"""注册运行时 N-tier 链路顺序调整路由(纯重排序,不重置熔断器/配额守卫)."""
|
|
391
|
+
|
|
392
|
+
@app.put("/api/tier-order")
|
|
393
|
+
async def update_tier_order(request: Request) -> Response:
|
|
394
|
+
"""替换整个 N-tier 链路顺序.
|
|
395
|
+
|
|
396
|
+
JSON body: ``{"vendors": ["v1", "v2", ...]}``(需覆盖所有当前启用的 vendor)。
|
|
397
|
+
与 ``/api/reset`` 的重排序语义一致,但**不会**重置熔断器/配额守卫/rate limit,
|
|
398
|
+
以保留当日用量统计(供 Web 拖拽调整优先级使用)。
|
|
399
|
+
"""
|
|
400
|
+
try:
|
|
401
|
+
body = await request.json()
|
|
402
|
+
except Exception:
|
|
403
|
+
return json_error_response(
|
|
404
|
+
400, error_type="invalid_request_error", message="body must be JSON"
|
|
405
|
+
)
|
|
406
|
+
if not isinstance(body, dict):
|
|
407
|
+
return json_error_response(
|
|
408
|
+
400,
|
|
409
|
+
error_type="invalid_request_error",
|
|
410
|
+
message="body must be a JSON object",
|
|
411
|
+
)
|
|
412
|
+
raw = body.get("vendors")
|
|
413
|
+
if not isinstance(raw, list) or not raw:
|
|
414
|
+
return json_error_response(
|
|
415
|
+
400,
|
|
416
|
+
error_type="invalid_request_error",
|
|
417
|
+
message="requires non-empty 'vendors' list",
|
|
418
|
+
)
|
|
419
|
+
vendor_names = [str(v) for v in raw]
|
|
420
|
+
try:
|
|
421
|
+
router.reorder_tiers(vendor_names)
|
|
422
|
+
except ValueError as exc:
|
|
423
|
+
return json_error_response(
|
|
424
|
+
400, error_type="invalid_request_error", message=str(exc)
|
|
425
|
+
)
|
|
426
|
+
return Response(
|
|
427
|
+
content=json.dumps(
|
|
428
|
+
{"ok": True, "tier_order": router.get_vendor_names()},
|
|
429
|
+
ensure_ascii=False,
|
|
430
|
+
).encode(),
|
|
431
|
+
status_code=200,
|
|
432
|
+
media_type="application/json",
|
|
433
|
+
)
|
|
434
|
+
|
|
435
|
+
|
|
389
436
|
def register_session_vendor_routes(app: Any, router: Any) -> None:
|
|
390
437
|
"""注册 Session-Vendor 运行时绑定路由."""
|
|
391
438
|
|
|
@@ -518,6 +565,7 @@ def register_all_routes(
|
|
|
518
565
|
register_concurrency_route(app, router)
|
|
519
566
|
register_copilot_routes(app, router)
|
|
520
567
|
register_admin_routes(app, router)
|
|
568
|
+
register_tier_order_route(app, router)
|
|
521
569
|
register_session_vendor_routes(app, router)
|
|
522
570
|
if reauth_coordinator:
|
|
523
571
|
register_reauth_routes(app, reauth_coordinator)
|
|
@@ -1091,3 +1091,147 @@ def test_reorder_tiers_shared_reference():
|
|
|
1091
1091
|
# Executor 的列表也改变了(因为是同一个对象)
|
|
1092
1092
|
assert [t.name for t in executor_tiers] == ["c", "a", "b"]
|
|
1093
1093
|
assert router.get_vendor_names() == ["c", "a", "b"]
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
# ── /api/tier-order 纯重排序测试(不重置配额/熔断器/rate limit)──────────────
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
def test_tier_order_reorder_success():
|
|
1100
|
+
"""PUT /api/tier-order → 精确替换链路顺序,返回最新 tier_order."""
|
|
1101
|
+
app = _make_reorder_app()
|
|
1102
|
+
with TestClient(app) as client:
|
|
1103
|
+
resp = client.put(
|
|
1104
|
+
"/api/tier-order", json={"vendors": ["copilot", "anthropic", "zhipu"]}
|
|
1105
|
+
)
|
|
1106
|
+
assert resp.status_code == 200
|
|
1107
|
+
data = resp.json()
|
|
1108
|
+
assert data["ok"] is True
|
|
1109
|
+
assert data["tier_order"] == ["copilot", "anthropic", "zhipu"]
|
|
1110
|
+
assert app.state.router.get_vendor_names() == ["copilot", "anthropic", "zhipu"]
|
|
1111
|
+
|
|
1112
|
+
|
|
1113
|
+
def test_tier_order_unknown_vendor_returns_400():
|
|
1114
|
+
"""未知 vendor 名称 → 400."""
|
|
1115
|
+
app = _make_reorder_app()
|
|
1116
|
+
with TestClient(app) as client:
|
|
1117
|
+
resp = client.put(
|
|
1118
|
+
"/api/tier-order",
|
|
1119
|
+
json={"vendors": ["nonexist", "anthropic", "zhipu", "copilot"]},
|
|
1120
|
+
)
|
|
1121
|
+
assert resp.status_code == 400
|
|
1122
|
+
assert "未知 vendor" in resp.json()["error"]["message"]
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
def test_tier_order_duplicate_returns_400():
|
|
1126
|
+
"""重复 vendor 名称 → 400."""
|
|
1127
|
+
app = _make_reorder_app()
|
|
1128
|
+
with TestClient(app) as client:
|
|
1129
|
+
resp = client.put(
|
|
1130
|
+
"/api/tier-order",
|
|
1131
|
+
json={"vendors": ["anthropic", "anthropic", "zhipu", "copilot"]},
|
|
1132
|
+
)
|
|
1133
|
+
assert resp.status_code == 400
|
|
1134
|
+
assert "重复" in resp.json()["error"]["message"]
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
def test_tier_order_incomplete_returns_400():
|
|
1138
|
+
"""不完整的 vendor 列表(缺少现有 tier)→ 400."""
|
|
1139
|
+
app = _make_reorder_app()
|
|
1140
|
+
with TestClient(app) as client:
|
|
1141
|
+
resp = client.put("/api/tier-order", json={"vendors": ["anthropic", "zhipu"]})
|
|
1142
|
+
assert resp.status_code == 400
|
|
1143
|
+
assert "缺少 vendor" in resp.json()["error"]["message"]
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
def test_tier_order_invalid_body_returns_400():
|
|
1147
|
+
"""非法 body(非 JSON / 缺 vendors / 非列表 / 空列表)→ 400."""
|
|
1148
|
+
app = _make_reorder_app()
|
|
1149
|
+
with TestClient(app) as client:
|
|
1150
|
+
# 非 JSON
|
|
1151
|
+
resp = client.put(
|
|
1152
|
+
"/api/tier-order",
|
|
1153
|
+
content=b"not-json",
|
|
1154
|
+
headers={"content-type": "application/json"},
|
|
1155
|
+
)
|
|
1156
|
+
assert resp.status_code == 400
|
|
1157
|
+
# body 非 dict
|
|
1158
|
+
resp = client.put("/api/tier-order", json=["anthropic", "zhipu", "copilot"])
|
|
1159
|
+
assert resp.status_code == 400
|
|
1160
|
+
# 缺 vendors
|
|
1161
|
+
resp = client.put("/api/tier-order", json={"foo": "bar"})
|
|
1162
|
+
assert resp.status_code == 400
|
|
1163
|
+
# vendors 非列表
|
|
1164
|
+
resp = client.put("/api/tier-order", json={"vendors": "zhipu"})
|
|
1165
|
+
assert resp.status_code == 400
|
|
1166
|
+
# vendors 空列表
|
|
1167
|
+
resp = client.put("/api/tier-order", json={"vendors": []})
|
|
1168
|
+
assert resp.status_code == 400
|
|
1169
|
+
|
|
1170
|
+
|
|
1171
|
+
def test_tier_order_preserves_quota_guard():
|
|
1172
|
+
"""核心:重排序不重置配额守卫的滑动窗口用量(保留当日统计)."""
|
|
1173
|
+
app = _make_reorder_app()
|
|
1174
|
+
router = app.state.router
|
|
1175
|
+
# 选用首个 tier,手动启用其配额守卫并写入用量
|
|
1176
|
+
tier = router.tiers[0]
|
|
1177
|
+
qg = tier.quota_guard
|
|
1178
|
+
assert qg is not None
|
|
1179
|
+
qg._enabled = True
|
|
1180
|
+
qg._budget = 100_000
|
|
1181
|
+
qg.record_usage(40_000)
|
|
1182
|
+
before = qg.get_info()
|
|
1183
|
+
assert before["window_usage_tokens"] == 40_000
|
|
1184
|
+
assert before["usage_percent"] == 40.0
|
|
1185
|
+
|
|
1186
|
+
with TestClient(app) as client:
|
|
1187
|
+
resp = client.put(
|
|
1188
|
+
"/api/tier-order", json={"vendors": ["zhipu", "copilot", "anthropic"]}
|
|
1189
|
+
)
|
|
1190
|
+
assert resp.status_code == 200
|
|
1191
|
+
|
|
1192
|
+
# reorder_tiers 仅重排引用、不重建对象 → 同一 QuotaGuard 实例用量保持
|
|
1193
|
+
after = qg.get_info()
|
|
1194
|
+
assert after["window_usage_tokens"] == 40_000
|
|
1195
|
+
assert after["usage_percent"] == 40.0
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
def test_tier_order_preserves_circuit_breaker_and_rate_limit():
|
|
1199
|
+
"""重排序不重置熔断器与 rate limit(与 /api/reset 行为相反)."""
|
|
1200
|
+
app = _make_reorder_app()
|
|
1201
|
+
router = app.state.router
|
|
1202
|
+
target = router.tiers[0]
|
|
1203
|
+
target.record_failure(retry_after_seconds=300)
|
|
1204
|
+
target._rate_limit_deadline = 999_999.0
|
|
1205
|
+
assert not target.can_execute()
|
|
1206
|
+
|
|
1207
|
+
with TestClient(app) as client:
|
|
1208
|
+
resp = client.put(
|
|
1209
|
+
"/api/tier-order", json={"vendors": ["zhipu", "anthropic", "copilot"]}
|
|
1210
|
+
)
|
|
1211
|
+
assert resp.status_code == 200
|
|
1212
|
+
|
|
1213
|
+
same = next(t for t in router.tiers if t.name == target.name)
|
|
1214
|
+
assert not same.can_execute() # 仍熔断
|
|
1215
|
+
assert same.is_rate_limited # 仍限速
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
def test_dashboard_serves_pointer_drag_reorder_and_no_cache():
|
|
1219
|
+
"""Dashboard 供应商拖拽已由脆弱的原生 HTML5 DnD 改为 Pointer Events,并禁用页面缓存.
|
|
1220
|
+
|
|
1221
|
+
#269 仅覆盖后端 /api/tier-order,前端拖拽机制无任何断言(拖拽从未被验证)。
|
|
1222
|
+
此处补一条轻量守卫:确保重排序 UI 机制(指针事件 + PUT /api/tier-order)随页面交付、
|
|
1223
|
+
不回退到原生 DnD,且响应带 no-cache 以免浏览器留存旧内联脚本掩盖前端修复。
|
|
1224
|
+
"""
|
|
1225
|
+
with _make_app() as client:
|
|
1226
|
+
resp = client.get("/dashboard")
|
|
1227
|
+
assert resp.status_code == 200
|
|
1228
|
+
assert resp.headers.get("cache-control") == "no-cache"
|
|
1229
|
+
html = resp.text
|
|
1230
|
+
# Pointer Events 重排机制在位
|
|
1231
|
+
assert "initTierDrag" in html
|
|
1232
|
+
assert "pointerdown" in html
|
|
1233
|
+
assert "setPointerCapture" in html
|
|
1234
|
+
assert "/api/tier-order" in html
|
|
1235
|
+
# 已移除脆弱的原生 HTML5 DnD(不再渲染 draggable 属性 / 监听 dragstart)
|
|
1236
|
+
assert 'draggable="true"' not in html
|
|
1237
|
+
assert "addEventListener('dragstart'" not in html
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|