coding-proxy 0.2.0a2__tar.gz → 0.2.1__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.2.1/.github/workflows/release.yml +326 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/.gitignore +3 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/CHANGELOG.md +5 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/PKG-INFO +3 -3
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/README.md +1 -1
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/docs/zh-CN/README.md +1 -1
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/pyproject.toml +2 -2
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/cli/__init__.py +8 -1
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/config/config.default.yaml +21 -2
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/config/server.py +12 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/config/vendors.py +1 -0
- coding_proxy-0.2.1/src/coding/proxy/logging/__init__.py +188 -0
- coding_proxy-0.2.1/src/coding/proxy/logging/formatters.py +27 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/routing/circuit_breaker.py +30 -7
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/routing/executor.py +59 -5
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/routing/quota_guard.py +9 -2
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/routing/tier.py +24 -2
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/routing/usage_recorder.py +1 -1
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/server/app.py +5 -6
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/server/factory.py +4 -1
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/server/request_normalizer.py +2 -117
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/antigravity.py +214 -10
- coding_proxy-0.2.1/tests/test_antigravity.py +781 -0
- coding_proxy-0.2.1/tests/test_logging_dual_write.py +330 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_token_logger.py +18 -4
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/uv.lock +1 -1
- coding_proxy-0.2.0a2/.github/workflows/promote.yml +0 -176
- coding_proxy-0.2.0a2/.github/workflows/release.yml +0 -159
- coding_proxy-0.2.0a2/src/coding/proxy/logging/__init__.py +0 -50
- coding_proxy-0.2.0a2/tests/test_antigravity.py +0 -360
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/.github/workflows/ci.yml +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/.github/workflows/coverage.yml +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/AGENTS.md +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/CLAUDE.md +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/LICENSE +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/docs/ci-cd.md +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/docs/framework.md +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/docs/user-guide.md +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/__init__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/__init__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/__main__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/auth/__init__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/auth/providers/__init__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/auth/providers/base.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/auth/providers/github.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/auth/providers/google.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/auth/runtime.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/auth/store.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/cli/auth_commands.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/cli/banner.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/compat/__init__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/compat/canonical.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/compat/session_store.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/config/__init__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/config/auth_schema.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/config/loader.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/config/resiliency.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/config/routing.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/config/schema.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/convert/__init__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/convert/anthropic_to_gemini.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/convert/anthropic_to_openai.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/convert/gemini_sse_adapter.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/convert/gemini_to_anthropic.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/convert/openai_to_anthropic.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/logging/db.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/logging/stats.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/model/__init__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/model/auth.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/model/compat.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/model/constants.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/model/pricing.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/model/token.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/model/vendor.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/pricing.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/routing/__init__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/routing/error_classifier.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/routing/model_mapper.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/routing/rate_limit.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/routing/retry.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/routing/router.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/routing/session_manager.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/routing/usage_parser.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/server/__init__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/server/responses.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/server/routes.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/streaming/__init__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/streaming/anthropic_compat.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/__init__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/alibaba.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/anthropic.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/base.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/copilot.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/copilot_models.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/copilot_token_manager.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/copilot_urls.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/doubao.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/kimi.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/minimax.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/mixins.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/native_anthropic.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/token_manager.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/xiaomi.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/src/coding/proxy/vendors/zhipu.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/__init__.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_app_routes.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_auto_login.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_banner.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_circuit_breaker.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_cli_usage.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_compat.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_config_init.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_config_loader.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_convert_request.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_convert_response.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_convert_sse.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_copilot.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_copilot_convert_request.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_copilot_convert_response.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_copilot_models.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_copilot_urls.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_currency.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_error_classifier.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_mixins.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_model_auth.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_model_compat.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_model_constants.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_model_mapper.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_model_pricing.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_model_token.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_model_vendor.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_native_vendors.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_parse_usage.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_pricing.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_quota_guard.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_rate_limit.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_request_normalizer.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_router_chain.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_router_executor.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_runtime_reauth.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_schema.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_streaming_anthropic_compat.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_tier.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_tiers_config.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_time_range.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_token_manager.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_types.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_vendor_streaming.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_vendors.py +0 -0
- {coding_proxy-0.2.0a2 → coding_proxy-0.2.1}/tests/test_zhipu.py +0 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# coding-proxy: PyPI Publishing Pipeline (4-Stage Unified Pipeline)
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Trigger: GitHub Release publication event (release.types: [published])
|
|
5
|
+
#
|
|
6
|
+
# Architecture: 4-Stage Serial Pipeline (prerelease only — 所有生产发布均走预发布)
|
|
7
|
+
#
|
|
8
|
+
# Stage 1 (build): 矩阵构建 3.12/3.13/3.14,上传 artifacts
|
|
9
|
+
# Stage 2 (publish-testpypi): 发布到 TestPyPI 供验证
|
|
10
|
+
# Stage 3 (publish-to-pypi): ⏸ Production Approval Gate (environment: pypi)
|
|
11
|
+
# 审批通过后自动:Promote Release + Publish to PyPI
|
|
12
|
+
# Stage 4 (update-changelog): 从 Release notes 生成 Changelog PR → master
|
|
13
|
+
#
|
|
14
|
+
# 设计决策 — Stage 3 合并审批与发布的理由:
|
|
15
|
+
# pypa/gh-action-pypi-publish@release/v1 始终优先尝试 OIDC Trusted Publishing。
|
|
16
|
+
# 若将审批与发布拆分为两个 job,则无法同时满足:
|
|
17
|
+
# - 单一人工审批(不能两个 job 都声明 environment: pypi 触发二次审批)
|
|
18
|
+
# - OIDC 需要 environment: pypi 声明才能匹配 PyPI Trusted Publisher 配置
|
|
19
|
+
# 因此将 Approval Gate 与实际发布操作合并为同一 job,审批通过后顺序执行。
|
|
20
|
+
#
|
|
21
|
+
# Pre-requisites — 需要在 GitHub Settings 一次性手动配置:
|
|
22
|
+
# 1. repo → Settings → Environments → "pypi"
|
|
23
|
+
# → Required reviewers: 添加审批人员(Production Approval Gate 所需)
|
|
24
|
+
# 2. repo → Settings → Actions → General → Workflow permissions
|
|
25
|
+
# → "Read and write permissions"(Stage 4 推分支所需)
|
|
26
|
+
# → 勾选 "Allow GitHub Actions to create and approve pull requests"
|
|
27
|
+
#
|
|
28
|
+
# Authentication:
|
|
29
|
+
# - TEST_PYPI_API_TOKEN: TestPyPI API Token(repository secret)
|
|
30
|
+
# - PYPI Trusted Publisher: 已配置 OIDC(无需 API Token,通过 environment: pypi 自动认证)
|
|
31
|
+
#
|
|
32
|
+
# References:
|
|
33
|
+
# [1] https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
|
|
34
|
+
# [2] https://github.com/pypa/gh-action-pypi-publish
|
|
35
|
+
# [3] https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
|
|
36
|
+
# =============================================================================
|
|
37
|
+
|
|
38
|
+
name: Release / Publish Pipeline
|
|
39
|
+
|
|
40
|
+
on:
|
|
41
|
+
release:
|
|
42
|
+
types: [published]
|
|
43
|
+
|
|
44
|
+
permissions:
|
|
45
|
+
contents: read # 全局最低权限,各 job 按需 override
|
|
46
|
+
|
|
47
|
+
env:
|
|
48
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
49
|
+
|
|
50
|
+
concurrency:
|
|
51
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
52
|
+
cancel-in-progress: false # 发布流水线不可被中断
|
|
53
|
+
|
|
54
|
+
jobs:
|
|
55
|
+
# ===========================================================================
|
|
56
|
+
# Stage 1: BUILD -- 矩阵构建,产出 sdist + wheel artifacts
|
|
57
|
+
# ===========================================================================
|
|
58
|
+
build:
|
|
59
|
+
name: Build distributions (py${{ matrix.python-version }})
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
timeout-minutes: 10
|
|
62
|
+
strategy:
|
|
63
|
+
matrix:
|
|
64
|
+
python-version: ["3.12", "3.13", "3.14"]
|
|
65
|
+
|
|
66
|
+
steps:
|
|
67
|
+
- name: Checkout repository
|
|
68
|
+
uses: actions/checkout@v4
|
|
69
|
+
with:
|
|
70
|
+
persist-credentials: false
|
|
71
|
+
|
|
72
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
73
|
+
uses: actions/setup-python@v5
|
|
74
|
+
with:
|
|
75
|
+
python-version: ${{ matrix.python-version }}
|
|
76
|
+
|
|
77
|
+
- name: Set up uv
|
|
78
|
+
uses: astral-sh/setup-uv@v4
|
|
79
|
+
with:
|
|
80
|
+
enable-cache: true
|
|
81
|
+
|
|
82
|
+
- name: Install build dependencies
|
|
83
|
+
run: uv pip install --system build twine
|
|
84
|
+
|
|
85
|
+
- name: Build sdist and wheel
|
|
86
|
+
run: python -m build
|
|
87
|
+
|
|
88
|
+
- name: Check package metadata
|
|
89
|
+
run: twine check dist/*
|
|
90
|
+
|
|
91
|
+
- name: Upload build artifacts
|
|
92
|
+
uses: actions/upload-artifact@v4
|
|
93
|
+
with:
|
|
94
|
+
name: dist-py${{ matrix.python-version }}
|
|
95
|
+
path: dist/
|
|
96
|
+
retention-days: 14
|
|
97
|
+
|
|
98
|
+
# ===========================================================================
|
|
99
|
+
# Stage 2: PUBLISH TO TESTPYPI -- prerelease 路径专用
|
|
100
|
+
# ===========================================================================
|
|
101
|
+
publish-testpypi:
|
|
102
|
+
name: Publish to TestPyPI
|
|
103
|
+
runs-on: ubuntu-latest
|
|
104
|
+
needs: build
|
|
105
|
+
if: github.event.release.prerelease == true
|
|
106
|
+
timeout-minutes: 10
|
|
107
|
+
environment:
|
|
108
|
+
name: testpypi
|
|
109
|
+
url: https://test.pypi.org/p/coding-proxy
|
|
110
|
+
permissions:
|
|
111
|
+
contents: read
|
|
112
|
+
|
|
113
|
+
steps:
|
|
114
|
+
- name: Download build artifacts
|
|
115
|
+
uses: actions/download-artifact@v4
|
|
116
|
+
with:
|
|
117
|
+
pattern: dist-py*
|
|
118
|
+
path: dist/
|
|
119
|
+
merge-multiple: true
|
|
120
|
+
|
|
121
|
+
- name: List artifacts
|
|
122
|
+
run: ls -la dist/
|
|
123
|
+
|
|
124
|
+
- name: Publish to TestPyPI
|
|
125
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
126
|
+
with:
|
|
127
|
+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
|
128
|
+
repository-url: https://test.pypi.org/legacy/
|
|
129
|
+
skip-existing: true
|
|
130
|
+
attestations: false # TestPyPI 不支持 attestations,必须显式禁用
|
|
131
|
+
verbose: true
|
|
132
|
+
|
|
133
|
+
# ===========================================================================
|
|
134
|
+
# Stage 3: PUBLISH TO PYPI -- Production Approval Gate + Promote + Publish
|
|
135
|
+
# ===========================================================================
|
|
136
|
+
# 设计决策:将 Approval Gate 与实际发布操作合并为同一 job。
|
|
137
|
+
#
|
|
138
|
+
# 原因:pypa/gh-action-pypi-publish@release/v1 始终优先尝试 OIDC Trusted Publishing,
|
|
139
|
+
# 需要 id-token: write + environment: pypi 同时满足才能通过 PyPI 认证。
|
|
140
|
+
# 若拆分为两个 job,则无法避免二次审批或 OIDC 认证失败。
|
|
141
|
+
#
|
|
142
|
+
# 工作流程:
|
|
143
|
+
# 1. GitHub Actions pre-job 机制检测到 environment: pypi → 挂起等待审批
|
|
144
|
+
# 2. 审批人点击 Approve → job 开始执行
|
|
145
|
+
# 3. 顺序执行:Promote Release → Download Artifacts → Publish to PyPI
|
|
146
|
+
# ===========================================================================
|
|
147
|
+
publish-to-pypi:
|
|
148
|
+
name: "⏸ Production Approval Gate → Publish to PyPI"
|
|
149
|
+
runs-on: ubuntu-latest
|
|
150
|
+
needs: publish-testpypi
|
|
151
|
+
if: github.event.release.prerelease == true
|
|
152
|
+
timeout-minutes: 1440 # 24 小时(含审批等待 + 发布执行)
|
|
153
|
+
environment:
|
|
154
|
+
name: pypi
|
|
155
|
+
url: https://pypi.org/p/coding-proxy
|
|
156
|
+
permissions:
|
|
157
|
+
contents: write # 更新 GitHub Release 元数据(prerelease=false, make_latest=true)
|
|
158
|
+
id-token: write # PyPI OIDC Trusted Publishing 所需
|
|
159
|
+
|
|
160
|
+
steps:
|
|
161
|
+
- name: Approval granted — proceeding to PyPI production
|
|
162
|
+
run: |
|
|
163
|
+
echo "✅ Production deployment approved"
|
|
164
|
+
echo "Tag: ${{ github.ref_name }}"
|
|
165
|
+
echo "Release: ${{ github.event.release.name }}"
|
|
166
|
+
|
|
167
|
+
- name: Promote GitHub Release to stable
|
|
168
|
+
uses: actions/github-script@v7
|
|
169
|
+
with:
|
|
170
|
+
script: |
|
|
171
|
+
const { owner, repo } = context.repo;
|
|
172
|
+
const releaseId = ${{ github.event.release.id }};
|
|
173
|
+
const tagName = '${{ github.ref_name }}';
|
|
174
|
+
|
|
175
|
+
await github.rest.repos.updateRelease({
|
|
176
|
+
owner,
|
|
177
|
+
repo,
|
|
178
|
+
release_id: releaseId,
|
|
179
|
+
prerelease: false,
|
|
180
|
+
make_latest: true,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
core.notice(`✅ Release #${releaseId} (${tagName}) promoted: prerelease=false, make_latest=true`);
|
|
184
|
+
|
|
185
|
+
- name: Download all build artifacts
|
|
186
|
+
uses: actions/download-artifact@v4
|
|
187
|
+
with:
|
|
188
|
+
pattern: dist-py*
|
|
189
|
+
path: dist/
|
|
190
|
+
merge-multiple: true
|
|
191
|
+
|
|
192
|
+
- name: List artifacts
|
|
193
|
+
run: ls -la dist/
|
|
194
|
+
|
|
195
|
+
- name: Publish to PyPI (OIDC Trusted Publishing)
|
|
196
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
197
|
+
with:
|
|
198
|
+
skip-existing: true
|
|
199
|
+
verbose: true
|
|
200
|
+
|
|
201
|
+
# ===========================================================================
|
|
202
|
+
# Stage 5: UPDATE CHANGELOG -- 自动生成 Changelog PR → master
|
|
203
|
+
# ===========================================================================
|
|
204
|
+
update-changelog:
|
|
205
|
+
name: Update Changelog
|
|
206
|
+
runs-on: ubuntu-latest
|
|
207
|
+
needs: publish-to-pypi
|
|
208
|
+
if: github.event.release.prerelease == true
|
|
209
|
+
timeout-minutes: 10
|
|
210
|
+
permissions:
|
|
211
|
+
contents: write # git push 新分支
|
|
212
|
+
pull-requests: write # 创建 PR
|
|
213
|
+
|
|
214
|
+
steps:
|
|
215
|
+
- name: Checkout repository
|
|
216
|
+
uses: actions/checkout@v4
|
|
217
|
+
with:
|
|
218
|
+
fetch-depth: 0
|
|
219
|
+
persist-credentials: true
|
|
220
|
+
|
|
221
|
+
- name: Extract stable version from prerelease tag
|
|
222
|
+
id: version
|
|
223
|
+
run: |
|
|
224
|
+
PRERELEASE_TAG="${{ github.ref_name }}"
|
|
225
|
+
# v0.2.0a1 → v0.2.0(移除预发布后缀 a*/b*/rc*)
|
|
226
|
+
STABLE_VERSION=$(echo "$PRERELEASE_TAG" | sed 's/\(v[0-9]*\.[0-9]*\.[0-9]*\).*/\1/')
|
|
227
|
+
echo "prerelease_tag=$PRERELEASE_TAG" >> "$GITHUB_OUTPUT"
|
|
228
|
+
echo "stable_version=$STABLE_VERSION" >> "$GITHUB_OUTPUT"
|
|
229
|
+
echo "branch_name=chore/changelog-$STABLE_VERSION" >> "$GITHUB_OUTPUT"
|
|
230
|
+
echo "Extracted: $PRERELEASE_TAG → $STABLE_VERSION"
|
|
231
|
+
|
|
232
|
+
- name: Check if Changelog entry already exists
|
|
233
|
+
id: check
|
|
234
|
+
run: |
|
|
235
|
+
STABLE="${{ steps.version.outputs.stable_version }}"
|
|
236
|
+
if grep -qF "[$STABLE]" CHANGELOG.md; then
|
|
237
|
+
echo "exists=true" >> "$GITHUB_OUTPUT"
|
|
238
|
+
echo "ℹ️ Changelog entry for $STABLE already exists, skipping PR creation"
|
|
239
|
+
else
|
|
240
|
+
echo "exists=false" >> "$GITHUB_OUTPUT"
|
|
241
|
+
echo "✅ No existing entry for $STABLE, will create PR"
|
|
242
|
+
fi
|
|
243
|
+
|
|
244
|
+
- name: Fetch release body and update CHANGELOG.md
|
|
245
|
+
if: steps.check.outputs.exists == 'false'
|
|
246
|
+
uses: actions/github-script@v7
|
|
247
|
+
with:
|
|
248
|
+
script: |
|
|
249
|
+
const fs = require('fs');
|
|
250
|
+
const { owner, repo } = context.repo;
|
|
251
|
+
|
|
252
|
+
// 通过 API 获取 Release body,避免 shell 特殊字符注入问题
|
|
253
|
+
const release = await github.rest.repos.getReleaseByTag({
|
|
254
|
+
owner,
|
|
255
|
+
repo,
|
|
256
|
+
tag: '${{ steps.version.outputs.prerelease_tag }}',
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
const stable = '${{ steps.version.outputs.stable_version }}';
|
|
260
|
+
const date = new Date().toISOString().slice(0, 10);
|
|
261
|
+
const releaseUrl = `https://github.com/${owner}/${repo}/releases/tag/${{ steps.version.outputs.prerelease_tag }}`;
|
|
262
|
+
const body = release.data.body || '';
|
|
263
|
+
|
|
264
|
+
// 构建新条目
|
|
265
|
+
const newEntry = `\n## [${stable}](${releaseUrl}) — ${date}\n\n${body}\n`;
|
|
266
|
+
|
|
267
|
+
// 读取 CHANGELOG.md,在 ## [Unreleased] 行后插入新条目
|
|
268
|
+
let content = fs.readFileSync('CHANGELOG.md', 'utf8');
|
|
269
|
+
const marker = '## [Unreleased]';
|
|
270
|
+
const idx = content.indexOf(marker);
|
|
271
|
+
if (idx === -1) {
|
|
272
|
+
core.setFailed('CHANGELOG.md 中未找到 ## [Unreleased] 标记,无法插入条目');
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const insertPos = idx + marker.length;
|
|
276
|
+
content = content.slice(0, insertPos) + newEntry + content.slice(insertPos);
|
|
277
|
+
fs.writeFileSync('CHANGELOG.md', content, 'utf8');
|
|
278
|
+
core.info(`✅ CHANGELOG.md updated with entry for ${stable}`);
|
|
279
|
+
|
|
280
|
+
- name: Create branch and commit
|
|
281
|
+
if: steps.check.outputs.exists == 'false'
|
|
282
|
+
run: |
|
|
283
|
+
BRANCH="${{ steps.version.outputs.branch_name }}"
|
|
284
|
+
STABLE="${{ steps.version.outputs.stable_version }}"
|
|
285
|
+
|
|
286
|
+
git config user.name "github-actions[bot]"
|
|
287
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
288
|
+
|
|
289
|
+
git checkout -b "$BRANCH"
|
|
290
|
+
git add CHANGELOG.md
|
|
291
|
+
git commit -m "docs(changelog): add entry for $STABLE"
|
|
292
|
+
git push origin "$BRANCH"
|
|
293
|
+
|
|
294
|
+
- name: Create Pull Request
|
|
295
|
+
if: steps.check.outputs.exists == 'false'
|
|
296
|
+
uses: actions/github-script@v7
|
|
297
|
+
with:
|
|
298
|
+
script: |
|
|
299
|
+
const { owner, repo } = context.repo;
|
|
300
|
+
const stable = '${{ steps.version.outputs.stable_version }}';
|
|
301
|
+
const branch = '${{ steps.version.outputs.branch_name }}';
|
|
302
|
+
const prereleaseTag = '${{ steps.version.outputs.prerelease_tag }}';
|
|
303
|
+
const runUrl = `https://github.com/${owner}/${repo}/actions/runs/${{ github.run_id }}`;
|
|
304
|
+
|
|
305
|
+
const pr = await github.rest.pulls.create({
|
|
306
|
+
owner,
|
|
307
|
+
repo,
|
|
308
|
+
title: `docs(changelog): 补充 ${stable} 发版说明`,
|
|
309
|
+
body: [
|
|
310
|
+
`## 摘要`,
|
|
311
|
+
``,
|
|
312
|
+
`自动生成的 PR,为 **${stable}** 正式版补充 CHANGELOG 条目。`,
|
|
313
|
+
``,
|
|
314
|
+
`- 来源:[\`${prereleaseTag}\`](https://github.com/${owner}/${repo}/releases/tag/${prereleaseTag}) Release notes`,
|
|
315
|
+
`- 目标分支:\`master\``,
|
|
316
|
+
``,
|
|
317
|
+
`请审阅 CHANGELOG 条目后合并。`,
|
|
318
|
+
``,
|
|
319
|
+
`> 🤖 由 [发布流水线](${runUrl}) 自动生成`,
|
|
320
|
+
].join('\n'),
|
|
321
|
+
head: branch,
|
|
322
|
+
base: 'master',
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
core.notice(`✅ PR created: ${pr.data.html_url}`);
|
|
326
|
+
|
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [v0.2.1](https://github.com/ThreeFish-AI/coding-proxy/releases/tag/v0.2.1a1) — 2026-04-11
|
|
8
|
+
|
|
9
|
+
- feat(logging): 实现日志双写(控制台 + 本地文件),日志文件支持 5MB 自动轮转及 gzip 压缩备份;ModelCall 日志降级为 DEBUG 级别;
|
|
10
|
+
- feat(circuit-breaker): 补全熔断器状态转换日志的 vendor 上下文信息;
|
|
11
|
+
|
|
7
12
|
## [v0.2.0](https://github.com/ThreeFish-AI/coding-proxy/releases/tag/v0.2.0) — 2026-04-09
|
|
8
13
|
|
|
9
14
|
> [!IMPORTANT]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: coding-proxy
|
|
3
|
-
Version: 0.2.
|
|
4
|
-
Summary: A High-Availability, Transparent, and Smart Multi-Vendor Proxy for Claude Code. Support Claude Plans, GitHub Copilot, Google Antigravity, ZAI/GLM
|
|
3
|
+
Version: 0.2.1
|
|
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
|
|
7
7
|
Project-URL: Bug Tracker, https://github.com/ThreeFish-AI/coding-proxy/issues
|
|
@@ -56,7 +56,7 @@ When you're deeply immersed in your coding "zone" with **Claude Code** (or any A
|
|
|
56
56
|
|
|
57
57
|
## 🌟 Core Features
|
|
58
58
|
|
|
59
|
-
- **⛓️ N-tier Chained Failover**:
|
|
59
|
+
- **⛓️ N-tier Chained Failover**: Autonomous descending sequence, supporting Claude's official plans, as well as Coding Plans from GitHub Copilot, Z AI, MiniMax, Alibaba Qwen, Xiaomi, Kimi, Doubao, etc.
|
|
60
60
|
- **🛡️ Smart Resilience & Quota Guardians**: Every single vendor node comes fully armed with an independent **Circuit Breaker** and **Quota Guard** to proactively dodge avalanches without breaking a sweat.
|
|
61
61
|
- **👻 Phantom-like Transparency**: **100% transparent** to the client! No code tweaks required. Overwrite `ANTHROPIC_BASE_URL` with a single line, and you're good to go.
|
|
62
62
|
- **🔄 Universal Alchemy (Formats & Models)**: Native support for two-way request/streaming (SSE) translations between Anthropic ←→ Gemini. Plus, auto/DIY model name mapping (e.g., effortlessly morphing `claude-*` into `glm-*`).
|
|
@@ -29,7 +29,7 @@ When you're deeply immersed in your coding "zone" with **Claude Code** (or any A
|
|
|
29
29
|
|
|
30
30
|
## 🌟 Core Features
|
|
31
31
|
|
|
32
|
-
- **⛓️ N-tier Chained Failover**:
|
|
32
|
+
- **⛓️ N-tier Chained Failover**: Autonomous descending sequence, supporting Claude's official plans, as well as Coding Plans from GitHub Copilot, Z AI, MiniMax, Alibaba Qwen, Xiaomi, Kimi, Doubao, etc.
|
|
33
33
|
- **🛡️ Smart Resilience & Quota Guardians**: Every single vendor node comes fully armed with an independent **Circuit Breaker** and **Quota Guard** to proactively dodge avalanches without breaking a sweat.
|
|
34
34
|
- **👻 Phantom-like Transparency**: **100% transparent** to the client! No code tweaks required. Overwrite `ANTHROPIC_BASE_URL` with a single line, and you're good to go.
|
|
35
35
|
- **🔄 Universal Alchemy (Formats & Models)**: Native support for two-way request/streaming (SSE) translations between Anthropic ←→ Gemini. Plus, auto/DIY model name mapping (e.g., effortlessly morphing `claude-*` into `glm-*`).
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
## 🌟 核心特性 (Core Features)
|
|
31
31
|
|
|
32
|
-
- **⛓️ N-tier 链式故障转移 (Failover)
|
|
32
|
+
- **⛓️ N-tier 链式故障转移 (Failover)**:自主降序序列,支持 Claude 官方 Plans,以及 GitHub Copilot、智谱、MiniMax、阿里千问、小米、Kimi、豆包等的 Coding Plan。
|
|
33
33
|
- **🛡️ 智能弹性与容灾守卫**:每个供应商节点独立配备 **熔断器 (Circuit Breaker)** 与 **配额守卫 (Quota Guard)**,防雪崩、主动避险。
|
|
34
34
|
- **👻 透明无感代理机制**:对客户端 **100% 透明**!无需修改任何代码,仅需一行配置覆盖 `ANTHROPIC_BASE_URL` 即可接入。
|
|
35
35
|
- **🔄 跨模型与全格式转换**:原生支持 Anthropic ←→ Gemini 的请求与流式响应(SSE)双向转换,并支持自动/自助映射模型名称(如 `claude-*` 至 `glm-*`)。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "coding-proxy"
|
|
3
|
-
version = "0.2.
|
|
4
|
-
description = "A High-Availability, Transparent, and Smart Multi-Vendor Proxy for Claude Code. Support Claude Plans, GitHub Copilot, Google Antigravity, ZAI/GLM
|
|
3
|
+
version = "0.2.1"
|
|
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"
|
|
7
7
|
authors = [{ name = "ThreeFish-AI", email = "threefish.ai@gmail.com" }]
|
|
@@ -104,11 +104,18 @@ def start(
|
|
|
104
104
|
# 打印启动品牌横幅
|
|
105
105
|
print_banner(console, host=cfg.server.host, port=cfg.server.port)
|
|
106
106
|
|
|
107
|
+
# 解析文件日志路径:未显式配置时使用默认值
|
|
108
|
+
_file_path: str | None = cfg.logging.file or "coding-proxy.log"
|
|
107
109
|
uvicorn.run(
|
|
108
110
|
fastapi_app,
|
|
109
111
|
host=cfg.server.host,
|
|
110
112
|
port=cfg.server.port,
|
|
111
|
-
log_config=build_log_config(
|
|
113
|
+
log_config=build_log_config(
|
|
114
|
+
level=cfg.logging.level,
|
|
115
|
+
file_path=_file_path,
|
|
116
|
+
max_bytes=cfg.logging.max_bytes,
|
|
117
|
+
backup_count=cfg.logging.backup_count,
|
|
118
|
+
),
|
|
112
119
|
)
|
|
113
120
|
|
|
114
121
|
|
|
@@ -8,6 +8,9 @@ server:
|
|
|
8
8
|
|
|
9
9
|
logging:
|
|
10
10
|
level: "INFO"
|
|
11
|
+
# file: "coding-proxy.log" # 文件日志路径;设为 null 或空字符串禁用
|
|
12
|
+
# max_bytes: 5242880 # 单文件上限(5 MB),触发轮转
|
|
13
|
+
# backup_count: 5 # 保留 gzip 压缩备份文件数
|
|
11
14
|
|
|
12
15
|
# === 降级链路优先级(可选) ===
|
|
13
16
|
#
|
|
@@ -232,11 +235,15 @@ model_mapping:
|
|
|
232
235
|
# Google Antigravity 模型映射
|
|
233
236
|
- pattern: "claude-sonnet-.*"
|
|
234
237
|
vendors: ["antigravity"]
|
|
235
|
-
target: "
|
|
238
|
+
target: "Claude Sonnet 4.6"
|
|
236
239
|
is_regex: true
|
|
237
240
|
- pattern: "claude-opus-.*"
|
|
238
241
|
vendors: ["antigravity"]
|
|
239
|
-
target: "
|
|
242
|
+
target: "Claude Opus 4.6 Thinking"
|
|
243
|
+
is_regex: true
|
|
244
|
+
- pattern: "claude-haiku-.*"
|
|
245
|
+
vendors: ["antigravity"]
|
|
246
|
+
target: "Gemini 3 Flash"
|
|
240
247
|
is_regex: true
|
|
241
248
|
# 智谱 GLM 映射(官方原生 Anthropic 兼容端点)
|
|
242
249
|
# glm-5v-turbo 完整承载 Claude Code 满血能力(tool calling / thinking / 多模态)
|
|
@@ -349,6 +356,12 @@ pricing:
|
|
|
349
356
|
output_cost_per_mtok: $25.0
|
|
350
357
|
cache_write_cost_per_mtok: $6.25
|
|
351
358
|
cache_read_cost_per_mtok: $0.50
|
|
359
|
+
- vendor: copilot
|
|
360
|
+
model: Claude Opus 4.6
|
|
361
|
+
input_cost_per_mtok: $5.0
|
|
362
|
+
output_cost_per_mtok: $25.0
|
|
363
|
+
cache_write_cost_per_mtok: $6.25
|
|
364
|
+
cache_read_cost_per_mtok: $0.50
|
|
352
365
|
- vendor: copilot
|
|
353
366
|
model: Claude Sonnet 4.6
|
|
354
367
|
input_cost_per_mtok: $3.0
|
|
@@ -373,6 +386,12 @@ pricing:
|
|
|
373
386
|
output_cost_per_mtok: $5
|
|
374
387
|
cache_write_cost_per_mtok: $1.25
|
|
375
388
|
cache_read_cost_per_mtok: $0.10
|
|
389
|
+
- vendor: copilot
|
|
390
|
+
model: Claude Haiku 4.5
|
|
391
|
+
input_cost_per_mtok: $1
|
|
392
|
+
output_cost_per_mtok: $5
|
|
393
|
+
cache_write_cost_per_mtok: $1.25
|
|
394
|
+
cache_read_cost_per_mtok: $0.10
|
|
376
395
|
# ── Google Antigravity(参照 Anthropic 定价估算) ──
|
|
377
396
|
- vendor: antigravity
|
|
378
397
|
model: claude-opus-4-6-thinking
|
|
@@ -17,8 +17,20 @@ class DatabaseConfig(BaseModel):
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class LoggingConfig(BaseModel):
|
|
20
|
+
"""日志配置.
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
level: 控制台日志级别(INFO / WARNING / DEBUG 等)。
|
|
24
|
+
file: 文件日志路径。为 ``None`` 时使用默认值 ``coding-proxy.log``;
|
|
25
|
+
设为空字符串可禁用文件日志。
|
|
26
|
+
max_bytes: 单个日志文件最大字节数(触发轮转)。默认 5 MB。
|
|
27
|
+
backup_count: 保留的已压缩备份文件数。默认 5。
|
|
28
|
+
"""
|
|
29
|
+
|
|
20
30
|
level: str = "INFO"
|
|
21
31
|
file: str | None = None
|
|
32
|
+
max_bytes: int = 5 * 1024 * 1024
|
|
33
|
+
backup_count: int = 5
|
|
22
34
|
|
|
23
35
|
|
|
24
36
|
__all__ = ["ServerConfig", "DatabaseConfig", "LoggingConfig"]
|
|
@@ -34,6 +34,7 @@ class AntigravityConfig(BaseModel):
|
|
|
34
34
|
model_endpoint: str = "models/claude-sonnet-4-20250514"
|
|
35
35
|
timeout_ms: int = 300000
|
|
36
36
|
safety_settings: dict[str, str] | None = None
|
|
37
|
+
project_id: str = "" # GCP Project ID(v1internal 协议必填)
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
class ZhipuConfig(BaseModel):
|