Skip to content

一些系统优化#4

Merged
ZyphrZero merged 90 commits into
ZyphrZero:devfrom
sofs2005:dev
May 20, 2026
Merged

一些系统优化#4
ZyphrZero merged 90 commits into
ZyphrZero:devfrom
sofs2005:dev

Conversation

@sofs2005

Copy link
Copy Markdown

页面画图历史上下文保留,日志显示优化,限流刷新逻辑优化,增加账号token刷新,等等

sofs2005 and others added 30 commits May 3, 2026 15:53
…EG/WebP output, custom aspect ratio, Codex Responses image generation
…e handling, add jshook docs

Upstream commits:
- 478b9c2 refactor(image): remove paid account gating and let upstream handle resolution
- cdeffe1 refactor(image): extract responses image handling to dedicated module
- da50905 Refactor image generation request handling and introduce authenticated image fetching
- 4e7f871 feat(image): route official and codex generation
…optimization

- Add server-side pagination for managed users list with page/pageSize params
- Redesign users page UI with pagination controls and role management
- Add announcement-markdown component for rich announcement rendering
- Refactor image response handling with improved concurrency and error handling
- Add backend and HTTP API tests for pagination and image endpoints
- Set GOMEMLIMIT=1GiB in Dockerfile to prevent OOM during source builds
… migrate to oxlint

- Move Dockerfiles and compose file into deploy/ directory
- Relocate main.go from cmd/chatgpt2api to internal/
- Remove goreleaser simple release path and .goreleaser.simple.yaml
- Add resource-limited Docker build script (deploy/docker-build-limited.sh)
- Add Docker deployment file validation to CI workflow
- Refactor image response handling in backend
- Migrate frontend linting from ESLint to Oxlint
- Add backend tests for update service and image responses
Image generation can return text clarification responses instead of image assets, so the backend now preserves those responses and the admin UI can surface them consistently. Build resource detection is updated in the same branch because the image response flow depends on current frontend resource metadata.

Constraint: Keep test fixtures neutral and free of real-person prompt examples

Rejected: Preserve the two original commits | their fixture text should not remain in branch history

Confidence: high

Scope-risk: moderate

Tested: go test ./internal/httpapi

Tested: go test ./internal/backend
This intentionally rolls back the image-generation text-response handling added on the current branch while leaving the build resource detection changes intact.

The reverted path converted upstream assistant text into successful creation-task output and expanded per-output terminal statuses. That behavior needs to be removed for now so the branch returns to the previous image task semantics.

Constraint: User explicitly requested a rollback commit and asked the commit to state that it is revertive.

Rejected: git revert 896f525 wholesale | that commit also contains build resource detection work that should remain.

Confidence: high

Scope-risk: narrow

Directive: Reintroduce upstream text-response handling only after the desired API/UI contract is agreed and covered by tests.

Tested: go test ./internal/httpapi ./internal/backend ./internal/protocol ./internal/service

Tested: npm run build

Tested: npm run lint

Tested: go test ./...
…e-build-auto

Feat/image text response build auto
- Rename shared symbols in responses_image.go for reuse (officialPreparePath, officialStreamPath, officialHeaders)
- Add textModelSlug, prepareTextConversation, startTextConversation to backend.go
- Modify StreamConversation to use prepare+conduit flow for auth users, fallback to old endpoint on failure
- Anonymous users keep old /backend-anon/conversation unchanged
Support image upload for LLM visual understanding through official
ChatGPT API prepare+conduit flow. Build and push Docker image to
ghcr.io on dev branch pushes.
StreamMultimodalConversation was sending raw JSON payloads to the output
channel, causing garbled output. Added iterMultimodalSSEPayloads that
parses each SSE event and extracts only string text from the "v" field.
Remove forced composer mode switch and image clearing when in
conversation mode. Chat mode now allows image uploads without
switching to image generation mode.
When images are uploaded in chat mode on the creation page, build
image_url content blocks in the messages payload so the backend
can route them to the vision understanding API.
Remove the composerMode === "image" condition from the thumbnail
display so uploaded images are visible regardless of the current mode.
- Rewrite GetTextAccessToken with pool-based selection
  (non-Free priority rotation, Free fallback with cooldown)
- Fix iterSSEPayloads and iterMultimodalSSEPayloads
  discarding buffered data on EOF
…runcation

The multimodal SSE parser was correctly extracting text from all event
formats, but the startMultimodalConversation payload lacked force_use_sse
which could cause the ChatGPT API to switch away from SSE streaming mode,
resulting in truncated responses.
IsAccountInvalidErrorMessage now matches "token expired" and
"authentication token is expired" so expired tokens are properly
marked as "异常" and can be auto-removed.
The build-docker-dev job was using deploy/Dockerfile which is a
release-only runtime wrapper that copies a pre-built binary without
building the frontend. Changed to deploy/Dockerfile.release which
performs full multi-stage builds (web-deps → web-build → go-build → app),
ensuring frontend changes are included in Docker images.
…ript

The local development build script was still referencing deploy/Dockerfile
which is a release-only wrapper without frontend/Go build stages. Changed
to deploy/Dockerfile.release to match the CI build job.
…-stage builds

deploy/Dockerfile is the complete multi-stage build (frontend + Go + runtime),
while deploy/Dockerfile.release is a release-only wrapper for GoReleaser that
expects a pre-built binary. Both CI build-docker-dev and docker-build-limited.sh
must use the full build Dockerfile.
Three fixes in backend.go:
1. Add is_complete guard in iterMultimodalSSEPayloads to filter out completion events
2. Type-check map values in extractMultimodalText []any branch instead of using fmt.Sprint
3. Type-check event["v"] in extractMultimodalText append branch
…ed login flow

Add two new mail providers (inbucket and yyds_mail) with full create/fetch
support. Refactor login to submit email separately before password verification,
with automatic re-authorization on 409 Conflict. Normalize message response
fields (provider, mailbox, message_id, sender, received_at) across all providers.
Simplify duckmail CreateMailbox by removing redundant domain list fetch.
Add UI config fields for the new providers in register-card.
ZyphrZero and others added 29 commits May 12, 2026 21:08
- Replace `format` with `formats` (list syntax) per v2.6 deprecation.
- Replace `dockers` + `docker_manifests` with `dockers_v2`, consolidating
  4 image entries and 6 manifest entries into 2 multi-platform entries.
- Update Dockerfile.release to use ARG TARGETPLATFORM for multi-arch COPY.
Admin users viewing the public gallery scope should see all images
regardless of visibility, matching the expected admin experience.
Remove externalEnvKeys tracking that preserved stale process env vars
over saved .env values. Now settingValue checks data store first, then
falls back to env, and Update() always persists to both .env and process
env unconditionally.
- Add user created hook so billing defaults only apply to newly created
  users, not retroactively when admin changes default billing settings.
- Add POST /api/admin/users/*/billing-adjustments/bulk endpoint to apply
  billing adjustments to multiple users at once (by user IDs or by role).
- Improve users page, settings card, logs page, and select component UI.
Add lightweight shared tool-call parsing and wire OpenAI/Anthropic tool responses while preserving image-generation routes.
Merge latest dev changes and keep LLM tool calling wired through the token-retry streaming paths.
The release tightens the admin user list path by sorting before pagination, exposing user IDs in the UI, and loading usage/billing data only when the list needs it. It also removes the local JSON file storage backend so runtime state now goes through the database backend only.

Constraint: User requested v0.2.1 release commit from the staged fixes

Constraint: Local JSON storage support is intentionally removed

Rejected: Keep STORAGE_BACKEND=json as a compatibility path | project no longer needs JSON backend support

Rejected: Sort only in the browser | pagination needs backend ordering to stay stable

Confidence: high

Scope-risk: moderate

Directive: Do not reintroduce local JSON file storage without an explicit product decision

Tested: go test ./...

Tested: go vet ./...

Tested: cd web && npm run build

Tested: cd web && npm run lint
GoReleaser failed after creating the v0.2.1 release because the release already contained checksums and Linux archives from a previous attempt. Enabling release.replace_existing_artifacts makes repeated release runs replace matching GitHub assets instead of failing on 422 already_exists.

Constraint: v0.2.1 release workflow must be rerunnable after a partial asset upload

Rejected: Manually delete release assets for this run only | leaves the next rerun with the same failure mode

Rejected: Change archive names to make each run unique | would publish duplicate assets for the same release

Confidence: high

Scope-risk: narrow

Directive: Keep release artifact names stable; rely on GoReleaser replacement for reruns

Tested: go test ./...

Tested: go vet ./...

Tested: cd web && npm run build

Tested: cd web && npm run lint

Not-tested: goreleaser check unavailable locally
Limit official conversation polling to the newest image tool messages so continued edits do not re-save or redisplay historical outputs.
Prefer assistant-linked image tool outputs and replace replayed SSE asset pointers so continued edits do not intermittently surface older images.
Keep the seeded old log inside the default retention window so the background cleaner cannot race the governance endpoint assertion.
When an official image turn has an assistant message id, wait for that message in the conversation mapping and use its linked tool output instead of stale SSE pointers.
Use SSE image pointers immediately for new turns, while only doing a non-blocking conversation lookup to correct continued edits when a current assistant mapping is already available.
Revert the continued-image result selection experiments that caused official image turns to time out, while keeping the earlier baseline result filtering fix.
Prefer code interpreter image assets from the current SSE turn so continued drawing responses do not fall back to stale file pointers.
Only trust top-level interpreter assets from the current SSE turn so continued drawing does not reuse stale assets from historical messages.
Use configured log views to hide low-value successful GET audit logs by default, and skip limited account refresh checks until restore time.
The PR added account refresh and diagnostic test comments in Chinese, while the repository contract requires code comments to remain English. This keeps the branch behavior unchanged and only normalizes comments around account map fields, session refresh flow, and diagnostic image tests.

Constraint: Repository AGENTS.md requires code comments to be English

Rejected: Leave mixed-language comments in the PR | it would keep a known style violation in reviewed code

Confidence: high

Scope-risk: narrow

Tested: npm run build

Tested: npm run lint

Tested: go test ./...

Tested: go vet ./...
@ZyphrZero ZyphrZero merged commit d8d8984 into ZyphrZero:dev May 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants