Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
63d75ed
fix(image): remove paid account requirement for high-resolution image…
sofs2005 May 3, 2026
dfeb0d1
Merge branch 'ZyphrZero:main' into main
sofs2005 May 3, 2026
158f132
merge: sync upstream/main - feat(auth, image) session cookie auth, JP…
sofs2005 May 4, 2026
5a4ff6b
fix(image): keep local return false for RequiresPaidImageSize
sofs2005 May 4, 2026
8b9691b
fix(test): update test expectations for RequiresPaidImageSize returni…
sofs2005 May 4, 2026
f194810
fix(ci): add git authentication for Go module downloads in CI and rel…
sofs2005 May 4, 2026
b7734a1
merge: sync upstream/main — remove paid account gating, refactor imag…
sofs2005 May 8, 2026
404557b
feat(admin): add user pagination, image response refactor, and build …
ZyphrZero May 8, 2026
33ccf3a
refactor(build): restructure Docker deployment, relocate main.go, and…
ZyphrZero May 8, 2026
e8248cc
Update README.md
ZyphrZero May 8, 2026
77c2f28
Merge branch 'ZyphrZero:main' into main
sofs2005 May 8, 2026
896f525
Support image text responses and build resource detection
ZyphrZero May 8, 2026
8139724
revert(image): undo text response handling
ZyphrZero May 8, 2026
38f979d
Merge pull request #1 from ZyphrZero/feat/image-text-response-build-auto
ZyphrZero May 8, 2026
a2d4037
Merge branch 'ZyphrZero:main' into main
sofs2005 May 8, 2026
5e7b1ee
feat: align text chat path to official prepare+conduit flow
sofs2005 May 9, 2026
9cafab9
ci: add dev branch to push triggers
sofs2005 May 9, 2026
a277357
feat: add multimodal vision support and CI Docker build for dev
sofs2005 May 9, 2026
027aa59
fix: parse multimodal SSE payloads to extract text from "v" field
sofs2005 May 9, 2026
192dc33
fix: stop forcing image-generation mode when uploading images in chat
sofs2005 May 9, 2026
c5a9ee4
fix: send vision images through chat completion task pipeline
sofs2005 May 9, 2026
7d6d07a
fix: show reference images in both chat and image modes
sofs2005 May 9, 2026
d33b8c8
feat: add smart text account rotation and fix SSE EOF truncation
sofs2005 May 9, 2026
a166005
fix: add force_use_sse to multimodal conversation to prevent stream t…
sofs2005 May 10, 2026
138678f
fix: recognize token expired error as invalid account during refresh
sofs2005 May 10, 2026
668fb13
fix: use Dockerfile.release in CI build-docker-dev job
sofs2005 May 10, 2026
f7ba7f8
fix: use Dockerfile.release in docker-build-limited.sh local build sc…
sofs2005 May 11, 2026
cdf1c07
fix: revert Dockerfile references to deploy/Dockerfile for full multi…
sofs2005 May 11, 2026
ce9d9f5
fix: prevent multimodal SSE from outputting raw completion map as text
sofs2005 May 11, 2026
8aed84f
feat(register): add inbucket and yyds_mail mail providers with enhanc…
ZyphrZero May 11, 2026
c9e0d38
Merge branch 'ZyphrZero:main' into main
sofs2005 May 11, 2026
6b42ff2
feat: add IsAccountTokenExpiredErrorMessage helper and account field …
sofs2005 May 11, 2026
ea70733
feat: add SessionRefresher with uTLS-based token refresh and concurre…
sofs2005 May 11, 2026
e47a721
feat: integrate SessionRefresher into AccountService
sofs2005 May 11, 2026
64a063f
Let chat prompts with images use vision-capable accounts
ZyphrZero May 11, 2026
bf5d89c
feat: add "刷新中" and "过期待刷新" status support to account filters
sofs2005 May 11, 2026
18d6d64
feat: update ApplyAccountErrorMessage to trigger auto-refresh on toke…
sofs2005 May 11, 2026
8806393
feat: add two-phase scan to RefreshAccounts with uTLS session refresh
sofs2005 May 11, 2026
3ae6095
fix: persist refreshed session access tokens correctly
sofs2005 May 11, 2026
8172029
feat: add POST /api/accounts/session endpoint for Session JSON import
sofs2005 May 11, 2026
a3c1104
fix: redact session token from session import response
sofs2005 May 11, 2026
e40933c
fix: register session import account permission
sofs2005 May 11, 2026
c42d6f3
feat: add real-time token switch logic for 401 handling in live requests
sofs2005 May 11, 2026
d89cd59
fix: complete async session refresh state updates
sofs2005 May 11, 2026
168e14c
feat: add real-time token switch retry, session-json import frontend,…
sofs2005 May 11, 2026
880843e
fix(image-tasks): prevent text-only image tasks from failing generically
ZyphrZero May 11, 2026
60169c4
fix: validate session imports before account mutation
sofs2005 May 11, 2026
c42f9af
chore: merge upstream image and registration updates
sofs2005 May 11, 2026
aadfe15
docs: make image generation API usage discoverable
ZyphrZero May 11, 2026
3189341
perf(image): cache authenticated images in the UI
ZyphrZero May 11, 2026
e6d120d
docs: add v0.1.8 and v0.1.9 changelog
ZyphrZero May 11, 2026
616017c
fix(image): preserve upstream image diagnostics
ZyphrZero May 11, 2026
26feeff
fix(rbac): constrain permission panel scrolling
ZyphrZero May 11, 2026
eaeb661
feat(billing): enforce local user quota allocation
ZyphrZero May 11, 2026
344be1f
chore: merge upstream v0.1.9 updates
sofs2005 May 11, 2026
025f079
fix(billing): prevent unpaid image delivery
ZyphrZero May 12, 2026
a163ab6
feat(image): store reusable generation metadata and enable public ima…
ZyphrZero May 12, 2026
bae18d7
feat(image): add image storage governance with quota and retention cl…
ZyphrZero May 12, 2026
be6e847
Merge branch 'feat/user-quota-allocation' into main
ZyphrZero May 12, 2026
4120e91
docs(changelog): add v0.2.0 release notes and remove fulfilled requir…
ZyphrZero May 12, 2026
2e93002
fix(billing): use input timezone for subscription period bounds
ZyphrZero May 12, 2026
bb759f2
ci(goreleaser): migrate deprecated archives.format and dockers to v2
ZyphrZero May 12, 2026
f245231
fix(httpapi): let admin see all images when browsing public gallery
ZyphrZero May 12, 2026
1a8ac3d
fix(config): let .env file values win over stale process environment
ZyphrZero May 12, 2026
adbdef4
feat(billing): add bulk adjustments and default-only-for-new-users init
ZyphrZero May 12, 2026
064d29a
docs(changelog): update v0.2.0 notes with recent fixes and features
ZyphrZero May 12, 2026
0231ddc
fix(auth): prevent OAuth user creation when registration is disabled
ZyphrZero May 13, 2026
17ff3bc
feat: add LLM tool calling support
sofs2005 May 13, 2026
50b68ed
merge: integrate dev into llm tool calling
sofs2005 May 13, 2026
4c50a8c
fix(auth): release mutex before rejecting unauthorized OAuth user cre…
ZyphrZero May 14, 2026
a49bc38
feat: add scheduled log retention cleanup
sofs2005 May 14, 2026
7d116c0
Prepare v0.2.1 for faster user management
ZyphrZero May 14, 2026
f6f5f3c
Allow v0.2.1 release reruns to replace assets
ZyphrZero May 14, 2026
c9dfe36
merge: integrate upstream v0.2.1 updates
sofs2005 May 14, 2026
58a78d5
Merge remote-tracking branch 'upstream/main' into merge-upstream-v0.2.1
sofs2005 May 14, 2026
ade6588
feat(image): preserve upstream drawing conversations
sofs2005 May 16, 2026
d3871e2
fix(image): use latest upstream image result
sofs2005 May 17, 2026
6a4cd02
fix(image): stabilize continued image result selection
sofs2005 May 17, 2026
2eb42a9
fix(test): stabilize log governance retention case
sofs2005 May 17, 2026
57dccb8
fix(image): poll current assistant result for edits
sofs2005 May 17, 2026
7a2f914
fix(image): avoid blocking on SSE image pointers
sofs2005 May 17, 2026
8f86645
revert(image): restore non-blocking image result handling
sofs2005 May 17, 2026
e21d4b2
fix(image): download continued interpreter assets
sofs2005 May 17, 2026
968f8d6
fix(image): ignore historical interpreter assets
sofs2005 May 17, 2026
1efd273
fix(image): poll current async image task
sofs2005 May 17, 2026
0b6e72f
ci: build dev docker image for amd64 only
sofs2005 May 17, 2026
1295756
ci: reuse frontend artifact for dev docker build
sofs2005 May 17, 2026
df530e3
fix(logs): reduce audit noise by default
sofs2005 May 17, 2026
d759bc2
fix(chat): estimate vision prompt tokens
sofs2005 May 18, 2026
9167a18
Keep PR comments aligned with repo language rules
ZyphrZero May 20, 2026
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
23 changes: 21 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ CHATGPT2API_REGISTRATION_ENABLED=false
# 检查更新访问 DockerHub / Release API 的代理;未设置时复用 CHATGPT2API_PROXY
# CHATGPT2API_UPDATE_PROXY_URL=http://127.0.0.1:7890

# ============================================
# 服务器源码 Docker 构建资源控制(仅 sh deploy/docker-build-limited.sh 使用)
# ============================================

# 需要在服务器从源码构建镜像时,推荐用脚本创建受限 BuildKit builder 后再构建。
# 直接运行脚本时会按服务器资源自动选择默认值,资源充足时默认使用 2 核和更高内存。
# 如需手动覆盖,可取消下面注释。
# BUILD_CPUS=2
# BUILD_MEMORY=4g
# BUILD_MEMORY_SWAP=4g
# BUILDKIT_MAX_PARALLELISM=2
# BUILD_GOMAXPROCS=2
# BUILD_GOMEMLIMIT=2GiB
# BUILD_NODE_OPTIONS=--max-old-space-size=1024
# CHATGPT2API_LOCAL_IMAGE=chatgpt2api:local

# 限流账号检查间隔,单位:分钟
CHATGPT2API_REFRESH_ACCOUNT_INTERVAL_MINUTE=5

Expand All @@ -33,6 +49,9 @@ CHATGPT2API_USER_DEFAULT_RPM_LIMIT=0
# 服务端缓存图片保留天数
CHATGPT2API_IMAGE_RETENTION_DAYS=30

# 图片库总容量上限,单位 MB;0 表示不按容量自动清理
CHATGPT2API_IMAGE_STORAGE_LIMIT_MB=0

# 业务日志保留天数;设置页的日志数据治理会按该值清理历史日志
CHATGPT2API_LOG_RETENTION_DAYS=7

Expand Down Expand Up @@ -74,12 +93,12 @@ CHATGPT2API_AUTO_REMOVE_RATE_LIMITED_ACCOUNTS=false
# 存储后端配置
# ============================================

# 存储后端类型(可选值: json, sqlite, postgres)
# 存储后端类型(可选值: sqlite, postgres, mysql
# 默认: sqlite
STORAGE_BACKEND=sqlite

# ============================================
# 数据库配置(当 STORAGE_BACKEND=sqlite/postgres 时使用)
# 数据库配置
# ============================================

# PostgreSQL 示例
Expand Down
84 changes: 83 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ on:
push:
branches:
- main
- dev
pull_request:

permissions:
contents: read

env:
BUN_VERSION: 1.3.13

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -17,7 +21,10 @@ jobs:

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
bun-version: ${{ env.BUN_VERSION }}

- name: Clear Bun cache
run: bun pm cache rm || true

- name: Install dependencies
working-directory: web
Expand All @@ -27,6 +34,13 @@ jobs:
working-directory: web
run: bun run build

- name: Upload frontend artifact
uses: actions/upload-artifact@v7
with:
name: web-dist
path: internal/web/dist/
retention-days: 1

- uses: actions/setup-go@v6
with:
go-version-file: go.mod
Expand All @@ -35,5 +49,73 @@ jobs:
- name: Verify Go version
run: go version | grep -q 'go1.26.2'

- name: Configure git for Go modules
run: git config --global url."https://${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"

- name: Test backend
run: go test ./...

- name: Validate Docker deployment files
run: |
test -f deploy/Dockerfile
test -f deploy/Dockerfile.dev
test -f deploy/Dockerfile.release
test -f deploy/Dockerfile.dockerignore
test -f deploy/Dockerfile.dev.dockerignore
test -f deploy/docker-compose.yml
sh -n deploy/docker-build-limited.sh
test ! -e .dockerignore
test ! -e Dockerfile
test ! -e Dockerfile.goreleaser
test ! -e docker-compose.yml
test ! -e docker-compose.build.yml
test ! -e docker-compose.local.yml
test ! -e .goreleaser.simple.yaml
CHATGPT2API_ENV_FILE="$PWD/.env.example" \
CHATGPT2API_DATA_DIR="$PWD/data" \
docker compose -f deploy/docker-compose.yml config >/dev/null

build-docker-dev:
needs: [test]
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6

- name: Download frontend artifact
uses: actions/download-artifact@v8
with:
name: web-dist
path: internal/web/dist/

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
run: |
OWNER_LOWER=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')
echo "tags=ghcr.io/${OWNER_LOWER}/${{ github.event.repository.name }}:dev" >> "$GITHUB_OUTPUT"

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: deploy/Dockerfile.dev
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: |
VERSION=dev
cache-from: type=gha
cache-to: type=gha,mode=max
17 changes: 9 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,14 @@ on:
description: "Tag to release, for example v1.0.0"
required: true
type: string
simple_release:
description: "Only publish linux/amd64 GHCR image"
required: false
type: boolean
default: false

permissions:
contents: write
packages: write

env:
SIMPLE_RELEASE: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.simple_release || 'false' }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
BUN_VERSION: 1.3.13

jobs:
build-frontend:
Expand All @@ -45,7 +40,10 @@ jobs:
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
bun-version: ${{ env.BUN_VERSION }}

- name: Clear Bun cache
run: bun pm cache rm || true

- name: Install dependencies
working-directory: web
Expand Down Expand Up @@ -87,6 +85,9 @@ jobs:
- name: Verify Go version
run: go version | grep -q 'go1.26.2'

- name: Configure git for Go modules
run: git config --global url."https://${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

Expand Down Expand Up @@ -129,7 +130,7 @@ jobs:
uses: goreleaser/goreleaser-action@v7
with:
version: "~> v2"
args: release --clean --skip=validate ${{ env.SIMPLE_RELEASE == 'true' && '--config=.goreleaser.simple.yaml' || '' }}
args: release --clean --skip=validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_MESSAGE: ${{ steps.meta.outputs.body }}
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ dist/
web_dist
chatgpt2api.exe
.omx/
.codex/
venv/
.venv/
__pycache__/
docs/*
!docs/image-generation-api.md
!docs/user-quota-allocation-requirements.md
!jshook/docs/

.idea
node_modules/
Expand Down
61 changes: 0 additions & 61 deletions .goreleaser.simple.yaml

This file was deleted.

Loading