From 041ffbf2b55a6b215fc74b3d2113c50ceac24835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=BD=E6=B7=BC=20=E5=91=A8?= Date: Thu, 5 Mar 2026 18:11:43 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20Claude=20Sonne?= =?UTF-8?q?t=204.6=20=E5=92=8C=20Opus=204.6=20=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- claude_converter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/claude_converter.py b/claude_converter.py index cb94719..92332be 100644 --- a/claude_converter.py +++ b/claude_converter.py @@ -115,7 +115,7 @@ def map_model_name(claude_model: str) -> str: DEFAULT_MODEL = "claude-sonnet-4.5" # Available models in the service (with KIRO_CLI origin) - VALID_MODELS = {"auto", "claude-sonnet-4", "claude-sonnet-4.5", "claude-haiku-4.5", "claude-opus-4.5"} + VALID_MODELS = {"auto", "claude-sonnet-4", "claude-sonnet-4.5", "claude-haiku-4.5", "claude-opus-4.5", "claude-sonnet-4.6", "claude-opus-4.6"} # Mapping from canonical names to short names CANONICAL_TO_SHORT = { From a35e98023dad5e9732e4f20993849f5a8e0669d2 Mon Sep 17 00:00:00 2001 From: toby Date: Sun, 15 Mar 2026 14:39:30 +0800 Subject: [PATCH 2/6] Add org Start URL support and fix multi-worker auth session issue - auth_flow.py: make start_url configurable (default personal Q URL) - app.py: add start_url field to AuthStartBody, pass to device_authorize - frontend/index.html: add Start URL input field in login section - docker-compose.yml: set workers=1 to fix in-memory session loss across workers Co-Authored-By: Claude Sonnet 4.6 --- app.py | 3 ++- auth_flow.py | 6 +++--- docker-compose.yml | 2 +- frontend/index.html | 4 +++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index 1f632d9..8443317 100644 --- a/app.py +++ b/app.py @@ -1271,6 +1271,7 @@ def _load_auth_flow_module(): class AuthStartBody(BaseModel): label: Optional[str] = None enabled: Optional[bool] = True + start_url: Optional[str] = None class AdminLoginRequest(BaseModel): password: str @@ -1353,7 +1354,7 @@ async def auth_start(body: AuthStartBody, _: bool = Depends(verify_admin_passwor """ try: cid, csec = await register_client_min() - dev = await device_authorize(cid, csec) + dev = await device_authorize(cid, csec, start_url=body.start_url) except httpx.HTTPError as e: raise HTTPException(status_code=502, detail=f"OIDC error: {str(e)}") diff --git a/auth_flow.py b/auth_flow.py index 45cc226..e5412a3 100644 --- a/auth_flow.py +++ b/auth_flow.py @@ -18,7 +18,7 @@ def _get_proxies() -> Optional[Dict[str, str]]: REGISTER_URL = f"{OIDC_BASE}/client/register" DEVICE_AUTH_URL = f"{OIDC_BASE}/device_authorization" TOKEN_URL = f"{OIDC_BASE}/token" -START_URL = "https://view.awsapps.com/start" +DEFAULT_START_URL = "https://view.awsapps.com/start" USER_AGENT = "aws-sdk-rust/1.3.9 os/windows lang/rust/1.87.0" X_AMZ_USER_AGENT = "aws-sdk-rust/1.3.9 ua/2.1 api/ssooidc/1.88.0 os/windows lang/rust/1.87.0 m/E app/AmazonQ-For-CLI" @@ -72,7 +72,7 @@ async def register_client_min() -> Tuple[str, str]: return data["clientId"], data["clientSecret"] -async def device_authorize(client_id: str, client_secret: str) -> Dict: +async def device_authorize(client_id: str, client_secret: str, start_url: Optional[str] = None) -> Dict: """ Start device authorization. Returns dict that includes: - deviceCode @@ -84,7 +84,7 @@ async def device_authorize(client_id: str, client_secret: str) -> Dict: payload = { "clientId": client_id, "clientSecret": client_secret, - "startUrl": START_URL, + "startUrl": start_url or DEFAULT_START_URL, } proxies = _get_proxies() mounts = None diff --git a/docker-compose.yml b/docker-compose.yml index 52e1ddb..6294aff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: volumes: - ./:/app restart: unless-stopped - command: uvicorn app:app --host 0.0.0.0 --port 8000 --workers 4 + command: uvicorn app:app --host 0.0.0.0 --port 8000 --workers 1 healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/healthz"] interval: 30s diff --git a/frontend/index.html b/frontend/index.html index 1d52d94..ad472be 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -266,6 +266,7 @@

创建账号

URL 登录(5分钟超时)

+
@@ -757,7 +758,8 @@

Chat 测试(/v2/chat/test)

async function startAuth(){ const body = { label: (document.getElementById('auth_label').value || '').trim() || null, - enabled: document.getElementById('auth_enabled').checked + enabled: document.getElementById('auth_enabled').checked, + start_url: (document.getElementById('auth_start_url').value || '').trim() || null, }; try { const r = await authFetch(api('/v2/auth/start'), { From ab839d01156a8e7c04c035dcfb360c25fbc2aca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=BD=E6=B7=BC=20=E5=91=A8?= Date: Fri, 17 Apr 2026 19:00:14 +0800 Subject: [PATCH 3/6] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20Claude=20Opus?= =?UTF-8?q?=204.7=20=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- claude_converter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/claude_converter.py b/claude_converter.py index 92332be..29e36cb 100644 --- a/claude_converter.py +++ b/claude_converter.py @@ -115,7 +115,7 @@ def map_model_name(claude_model: str) -> str: DEFAULT_MODEL = "claude-sonnet-4.5" # Available models in the service (with KIRO_CLI origin) - VALID_MODELS = {"auto", "claude-sonnet-4", "claude-sonnet-4.5", "claude-haiku-4.5", "claude-opus-4.5", "claude-sonnet-4.6", "claude-opus-4.6"} + VALID_MODELS = {"auto", "claude-sonnet-4", "claude-sonnet-4.5", "claude-haiku-4.5", "claude-opus-4.5", "claude-sonnet-4.6", "claude-opus-4.6", "claude-opus-4.7"} # Mapping from canonical names to short names CANONICAL_TO_SHORT = { From 1967d73e4fba8cb12dd68aeb65b9ca242d645945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=BD=E6=B7=BC=20=E5=91=A8?= Date: Mon, 27 Apr 2026 12:01:27 +0800 Subject: [PATCH 4/6] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=20GitHub=20Actions?= =?UTF-8?q?=20=E8=87=AA=E5=8A=A8=E6=9E=84=E5=BB=BA=E5=B9=B6=E6=8E=A8?= =?UTF-8?q?=E9=80=81=20Docker=20=E9=95=9C=E5=83=8F=E5=88=B0=20Docker=20Hub?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-build.yml | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/docker-build.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..5fc279a --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,31 @@ +name: Build and Push Docker Images + +on: + push: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push q2api + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: zemiaozhou/q2api:latest + + - name: Build and push account-feeder + uses: docker/build-push-action@v5 + with: + context: ./account-feeder + push: true + tags: zemiaozhou/account-feeder:latest From c8891537feff3c56a47bf103d86428ce60d1778b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=BD=E6=B7=BC=20=E5=91=A8?= Date: Mon, 27 Apr 2026 14:11:18 +0800 Subject: [PATCH 5/6] =?UTF-8?q?ci:=20=E7=A7=BB=E9=99=A4=20account-feeder?= =?UTF-8?q?=20=E9=95=9C=E5=83=8F=E6=9E=84=E5=BB=BA=EF=BC=8C=E4=BB=85?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E4=B8=BB=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-build.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 5fc279a..923ebff 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -23,9 +23,3 @@ jobs: push: true tags: zemiaozhou/q2api:latest - - name: Build and push account-feeder - uses: docker/build-push-action@v5 - with: - context: ./account-feeder - push: true - tags: zemiaozhou/account-feeder:latest From cf0a8d331e5b6705b47d5812f23bd57545927b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=BD=E6=B7=BC=20=E5=91=A8?= Date: Mon, 27 Apr 2026 14:40:19 +0800 Subject: [PATCH 6/6] =?UTF-8?q?chore:=20=E6=94=B9=E7=94=A8=E9=A2=84?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E9=95=9C=E5=83=8F=E9=83=A8=E7=BD=B2=EF=BC=8C?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=9C=AC=E5=9C=B0=20build=20=E5=92=8C?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8C=82=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6294aff..740ee4a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,16 +2,12 @@ version: '3.8' services: q2api: - build: - context: . - dockerfile: Dockerfile + image: zemiaozhou/q2api:latest container_name: q2api ports: - "${PORT:-8000}:8000" env_file: - .env - volumes: - - ./:/app restart: unless-stopped command: uvicorn app:app --host 0.0.0.0 --port 8000 --workers 1 healthcheck: