Open
Conversation
- Added user_agent field to Account schema (backend/ent/schema/account.go) - Added user_agent to Account TypeScript interface (frontend/src/types/index.ts) - Added IMPLEMENTATION_NOTES.md with integration guide for maintainer Backend HTTP header integration is documented in IMPLEMENTATION_NOTES.md. Closes Wei-Shaw#753
- Added user_agent field to Account schema (ent auto-generated) - Updated ClaudeOAuthClient / OpenAIOAuthClient / GeminiCliCodeAssistClient interfaces - RefreshAccountToken reads account.UserAgent and passes to OAuth client - go build ./... passes Closes Wei-Shaw#753
- Repository layer: read userAgent param and set HTTP header - Frontend: add User-Agent input field in account edit form Closes Wei-Shaw#753
- Verified ent migration schema includes user_agent field - Added SQL migration 065_add_account_user_agent.sql for production deploy - Added feature documentation to README Features section - Ready for production deployment Closes Wei-Shaw#753
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Anthropic passthrough: account user_agent overrides client-forwarded UA - Anthropic OAuth: account user_agent applied when no TLS fingerprint active - OpenAI (passthrough + standard): account user_agent takes priority over legacy credentials.user_agent - Gemini: account user_agent overrides default GeminiCLIUserAgent Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
…r-agent # Conflicts: # frontend/src/types/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


背景
关联 Issue #753。
管理员希望能在账号维度配置发往上游 API 的 HTTP User-Agent,以满足不同账号使用不同客户端特征的需求。
本次改动
数据库
accounts.user_agent字段(nullable VARCHAR(200))backend/migrations/065_add_account_user_agent.sql后端
user_agent字段定义及生成代码user_agent;entity→service 映射user_agent字段,降级到旧credentials.user_agent兼容)GeminiCLIUserAgent默认值)user_agent字段GET /accounts及详情接口返回user_agent字段normalizeUserAgent()处理空字符串(清空逻辑)前端
EditAccountModal.vue新增 User-Agent 可选输入框user_agent?: string文档
优先级规则
user_agent> 客户端透传 UA > Go 默认user_agent>credentials.user_agent(旧字段兼容)> ForceCodexCLI > OAuth 兜底user_agent>GeminiCLIUserAgent默认值不覆盖: Sora(固定设备指纹 UA)
测试
go build ./...✅go test -tags unit ./...✅user_agent字段均正常 ✅