Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ on:
type: boolean
default: false

# 环境变量:合并 workflow_dispatch 输入和 repository variable
# tag push 触发时读取 vars.SIMPLE_RELEASE,workflow_dispatch 时使用输入参数
# 环境变量:仅允许 workflow_dispatch 手动启用 simple release。
# 正式 tag 发布必须始终生成完整的二进制资产,否则安装脚本无法工作。
env:
SIMPLE_RELEASE: ${{ github.event.inputs.simple_release == 'true' || vars.SIMPLE_RELEASE == 'true' }}
SIMPLE_RELEASE: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.simple_release == 'true' || vars.SIMPLE_RELEASE == 'true') }}

permissions:
contents: write
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,5 @@ docs/*
frontend/coverage/
aicodex
output/
release.sh

3 changes: 2 additions & 1 deletion .goreleaser.simple.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 简化版 GoReleaser 配置 - 仅发布 x86_64 GHCR 镜像
# 简化版 GoReleaser 配置 - 仅用于手动触发的镜像发布。
# 不生成安装脚本依赖的二进制资产,禁止用于正式 tag 发布。
version: 2

project_name: sub2api
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# =============================================================================

ARG NODE_IMAGE=node:24-alpine
ARG GOLANG_IMAGE=golang:1.26.1-alpine
ARG GOLANG_IMAGE=golang:1.26.2-alpine
ARG ALPINE_IMAGE=alpine:3.21
ARG POSTGRES_IMAGE=postgres:18-alpine
ARG GOPROXY=https://goproxy.cn,direct
Expand Down Expand Up @@ -84,9 +84,9 @@ FROM ${POSTGRES_IMAGE} AS pg-client
FROM ${ALPINE_IMAGE}

# Labels
LABEL maintainer="Wei-Shaw <github.com/Wei-Shaw>"
LABEL maintainer="kw0ngr <github.com/kw0ngr>"
LABEL description="Sub2API - AI API Gateway Platform"
LABEL org.opencontainers.image.source="https://github.com/Wei-Shaw/sub2api"
LABEL org.opencontainers.image.source="https://github.com/kw0ngr/sub2api"

# Install runtime dependencies
RUN apk add --no-cache \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.goreleaser
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ FROM ${POSTGRES_IMAGE} AS pg-client

FROM ${ALPINE_IMAGE}

LABEL maintainer="Wei-Shaw <github.com/Wei-Shaw>"
LABEL maintainer="kw0ngr <github.com/kw0ngr>"
LABEL description="Sub2API - AI API Gateway Platform"
LABEL org.opencontainers.image.source="https://github.com/Wei-Shaw/sub2api"
LABEL org.opencontainers.image.source="https://github.com/kw0ngr/sub2api"

# Install runtime dependencies
RUN apk add --no-cache \
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ One-click installation script that downloads pre-built binaries from GitHub Rele
#### Installation Steps

```bash
curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/install.sh | sudo bash
curl -sSL https://raw.githubusercontent.com/kw0ngr/sub2api/main/deploy/install.sh | sudo bash
```

The script will:
Expand Down Expand Up @@ -156,7 +156,7 @@ sudo journalctl -u sub2api -f
sudo systemctl restart sub2api

# Uninstall
curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/install.sh | sudo bash -s -- uninstall -y
curl -sSL https://raw.githubusercontent.com/kw0ngr/sub2api/main/deploy/install.sh | sudo bash -s -- uninstall -y
```

---
Expand All @@ -179,7 +179,7 @@ Use the automated deployment script for easy setup:
mkdir -p sub2api-deploy && cd sub2api-deploy

# Download and run deployment preparation script
curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/docker-deploy.sh | bash
curl -sSL https://raw.githubusercontent.com/kw0ngr/sub2api/main/deploy/docker-deploy.sh | bash

# Start services
docker compose up -d
Expand All @@ -201,7 +201,7 @@ If you prefer manual setup:

```bash
# 1. Clone the repository
git clone https://github.com/Wei-Shaw/sub2api.git
git clone https://github.com/kw0ngr/sub2api.git
cd sub2api/deploy

# 2. Copy environment configuration
Expand Down Expand Up @@ -340,7 +340,7 @@ Build and run from source code for development or customization.

```bash
# 1. Clone the repository
git clone https://github.com/Wei-Shaw/sub2api.git
git clone https://github.com/kw0ngr/sub2api.git
cd sub2api

# 2. Install pnpm (if not already installed)
Expand Down Expand Up @@ -566,11 +566,11 @@ sub2api/

## Star History

<a href="https://star-history.com/#Wei-Shaw/sub2api&Date">
<a href="https://star-history.com/#kw0ngr/sub2api&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Wei-Shaw/sub2api&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Wei-Shaw/sub2api&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Wei-Shaw/sub2api&type=Date" />
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=kw0ngr/sub2api&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=kw0ngr/sub2api&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=kw0ngr/sub2api&type=Date" />
</picture>
</a>

Expand Down
18 changes: 9 additions & 9 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Nginx 默认会丢弃名称中含下划线的请求头(如 `session_id`),
#### 安装步骤

```bash
curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/install.sh | sudo bash
curl -sSL https://raw.githubusercontent.com/kw0ngr/sub2api/main/deploy/install.sh | sudo bash
```

脚本会自动:
Expand Down Expand Up @@ -155,7 +155,7 @@ sudo journalctl -u sub2api -f
sudo systemctl restart sub2api

# 卸载
curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/install.sh | sudo bash -s -- uninstall -y
curl -sSL https://raw.githubusercontent.com/kw0ngr/sub2api/main/deploy/install.sh | sudo bash -s -- uninstall -y
```

---
Expand All @@ -178,7 +178,7 @@ curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/install
mkdir -p sub2api-deploy && cd sub2api-deploy

# 下载并运行部署准备脚本
curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/docker-deploy.sh | bash
curl -sSL https://raw.githubusercontent.com/kw0ngr/sub2api/main/deploy/docker-deploy.sh | bash

# 启动服务
docker compose up -d
Expand All @@ -200,7 +200,7 @@ docker compose logs -f sub2api

```bash
# 1. 克隆仓库
git clone https://github.com/Wei-Shaw/sub2api.git
git clone https://github.com/kw0ngr/sub2api.git
cd sub2api/deploy

# 2. 复制环境配置文件
Expand Down Expand Up @@ -351,7 +351,7 @@ rm -rf data/ postgres_data/ redis_data/

```bash
# 1. 克隆仓库
git clone https://github.com/Wei-Shaw/sub2api.git
git clone https://github.com/kw0ngr/sub2api.git
cd sub2api

# 2. 安装 pnpm(如果还没有安装)
Expand Down Expand Up @@ -627,11 +627,11 @@ sub2api/

## Star History

<a href="https://star-history.com/#Wei-Shaw/sub2api&Date">
<a href="https://star-history.com/#kw0ngr/sub2api&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Wei-Shaw/sub2api&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Wei-Shaw/sub2api&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Wei-Shaw/sub2api&type=Date" />
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=kw0ngr/sub2api&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=kw0ngr/sub2api&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=kw0ngr/sub2api&type=Date" />
</picture>
</a>

Expand Down
18 changes: 9 additions & 9 deletions README_JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ GitHub Releases からビルド済みバイナリをダウンロードするワ
#### インストール手順

```bash
curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/install.sh | sudo bash
curl -sSL https://raw.githubusercontent.com/kw0ngr/sub2api/main/deploy/install.sh | sudo bash
```

スクリプトは以下を実行します:
Expand Down Expand Up @@ -156,7 +156,7 @@ sudo journalctl -u sub2api -f
sudo systemctl restart sub2api

# アンインストール
curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/install.sh | sudo bash -s -- uninstall -y
curl -sSL https://raw.githubusercontent.com/kw0ngr/sub2api/main/deploy/install.sh | sudo bash -s -- uninstall -y
```

---
Expand All @@ -179,7 +179,7 @@ PostgreSQL と Redis のコンテナを含む Docker Compose でデプロイし
mkdir -p sub2api-deploy && cd sub2api-deploy

# デプロイ準備スクリプトをダウンロードして実行
curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/docker-deploy.sh | bash
curl -sSL https://raw.githubusercontent.com/kw0ngr/sub2api/main/deploy/docker-deploy.sh | bash

# サービスを起動
docker compose up -d
Expand All @@ -201,7 +201,7 @@ docker compose logs -f sub2api

```bash
# 1. リポジトリをクローン
git clone https://github.com/Wei-Shaw/sub2api.git
git clone https://github.com/kw0ngr/sub2api.git
cd sub2api/deploy

# 2. 環境設定ファイルをコピー
Expand Down Expand Up @@ -340,7 +340,7 @@ rm -rf data/ postgres_data/ redis_data/

```bash
# 1. リポジトリをクローン
git clone https://github.com/Wei-Shaw/sub2api.git
git clone https://github.com/kw0ngr/sub2api.git
cd sub2api

# 2. pnpm をインストール(未インストールの場合)
Expand Down Expand Up @@ -566,11 +566,11 @@ sub2api/

## スター履歴

<a href="https://star-history.com/#Wei-Shaw/sub2api&Date">
<a href="https://star-history.com/#kw0ngr/sub2api&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Wei-Shaw/sub2api&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Wei-Shaw/sub2api&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Wei-Shaw/sub2api&type=Date" />
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=kw0ngr/sub2api&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=kw0ngr/sub2api&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=kw0ngr/sub2api&type=Date" />
</picture>
</a>

Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/server/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.106
0.1.116
11 changes: 5 additions & 6 deletions backend/ent/schema/error_passthrough_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
//
// 错误透传规则用于控制上游错误如何返回给客户端:
// - 匹配条件:错误码 + 关键词组合
// - 响应行为:透传原始信息 或 自定义错误信息
// - 响应行为:返回安全默认文案或自定义错误信息(不再透传原始上游文本)
// - 响应状态码:可指定返回给客户端的状态码
// - 平台范围:规则适用的平台(Anthropic、OpenAI、Gemini、Antigravity)
type ErrorPassthroughRule struct {
Expand Down Expand Up @@ -93,14 +93,13 @@ func (ErrorPassthroughRule) Fields() []ent.Field {
Optional().
Nillable(),

// passthrough_body: 是否透传上游原始错误信息
// true: 使用上游返回的错误信息
// false: 使用 custom_message 指定的错误信息
// passthrough_body: Deprecated.
// 该字段为历史兼容保留,运行时强制视为 false(不会透传上游原始错误信息)。
field.Bool("passthrough_body").
Default(true),
Default(false),

// custom_message: 自定义错误信息
// 当 passthrough_body=false 时使用此错误信息
// 为空时使用链路默认安全文案
field.Text("custom_message").
Optional().
Nillable(),
Expand Down
2 changes: 1 addition & 1 deletion backend/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Wei-Shaw/sub2api

go 1.26.1
go 1.26.2

require (
entgo.io/ent v0.14.5
Expand Down
Loading