Skip to content

将客户端 system prompt 透传到上游 customPersonality#2

Open
buddhism5080 wants to merge 304 commits intoXianYuDaXian:mainfrom
buddhism5080:system-prompt-upstream
Open

将客户端 system prompt 透传到上游 customPersonality#2
buddhism5080 wants to merge 304 commits intoXianYuDaXian:mainfrom
buddhism5080:system-prompt-upstream

Conversation

@buddhism5080
Copy link
Copy Markdown

摘要

  • 从 Chat Completions / Responses 请求中提取客户端传入的 system 消息,并通过上游 customPersonality 字段透传,不再把 system prompt 混入 message
  • 移除 app.custom_instruction 配置项的上游注入逻辑,并在配置加载/保存时清理旧键,避免与客户端 system prompt 冲突
  • 同步隐藏后台中的 custom_instruction 配置项及对应中英文文案

自测

  • python3 -m py_compile app/services/grok/services/chat.py app/services/reverse/app_chat.py app/core/config.py
  • 使用 AST 方式做定向 smoke test,验证 system 提取、customPersonality 透传、message 中不再包含 system、旧配置键清理
  • 真实上游联调(未在本地完成)

说明

  • 当前实现下,如果请求里只有 system 没有 user,会发送空 message 和非空 customPersonality;这是为了保证 system prompt 不再回流进 message

🤖 Generated with Claude Code

lijirou12 and others added 30 commits February 26, 2026 19:13
…-grok-superimage-1.0-pg7sej

Add grok-superimage model with server-side image config, improve SSE error handling and transient retry logic
…-grok-superimage-1.0-ql75b8

Add grok-superimage server-side image mode; improve streaming error handling and transient retry logic
…-grok-superimage-1.0-q2pii5

Add grok-superimage support, server-side image config and resilient streaming/error handling
…-grok-superimage-1.0-fxv5c7

Add grok-superimage server-side config, robust SSE streaming errors, transient retry and proxy handling
…-grok-superimage-1.0-63a3ay

Add grok-superimage server-side support, robust SSE streaming/errors, and proxy/imagine fixes
…-grok-superimage-1.0-65x674

Add grok-superimage support, safer SSE streaming, image recovery & proxy/ retry improvements
…-grok-superimage-1.0-y2p5rd

Add grok-superimage support, robust SSE streaming, image recovery and proxy/ retry fixes
…-grok-superimage-1.0-b6oi4l

Support grok-superimage and improve image streaming/retry, SSE error handling, proxy and config safety
…-grok-superimage-1.0-db29lm

Add grok-superimage support, streaming/error handling, image recovery, and config/proxy improvements
chenyme and others added 30 commits April 12, 2026 14:30
fix: 修正账号封禁分类与状态转换,支持webui配置日志等级/轮转配置等
…est-models

feat: 新增 auto/fast/expert/heavy 简洁模型,优先使用高等级号池
feat: Enhance proxy clearance management with scheduler and warm-up functionality
fix: Update invalid credentials checks and error status handling
feat: Enhance proxy management with improved failure handling and clearance refresh logic
feat: reduce webui/admin rerenders and cache header metadata
…API-Key header for enhanced compatibility with Anthropic SDK
feat: Update API key verification to support both Bearer token and X-API-Key header for enhanced compatibility with Anthropic SDK
feat: Add KaTeX support for rendering mathematical expressions
… improve SSL context handling in SQL connection
feat: Enhance SQL account repository with serverless support and initialization logic
…credential-retry

fix: Fix proxy reload and invalid-credential retries
…date

# Conflicts:
#	app/api/v1/admin_api/config.py
#	app/core/config.py
#	app/services/grok/services/image.py
#	app/services/grok/services/image_edit.py
#	app/services/grok/utils/download.py
#	app/services/grok/utils/upload.py
#	app/static/admin/js/config.js
#	config.defaults.toml
# Conflicts:
#	.github/workflows/docker.yml
#	.gitignore
#	Dockerfile
#	app/api/pages/admin.py
#	app/api/pages/public.py
#	app/api/v1/admin_api/cache.py
#	app/api/v1/admin_api/config.py
#	app/api/v1/admin_api/token.py
#	app/api/v1/chat.py
#	app/api/v1/files.py
#	app/api/v1/image.py
#	app/api/v1/public_api/__init__.py
#	app/api/v1/public_api/imagine.py
#	app/api/v1/public_api/video.py
#	app/api/v1/public_api/voice.py
#	app/core/auth.py
#	app/core/config.py
#	app/core/exceptions.py
#	app/core/logger.py
#	app/core/response_middleware.py
#	app/core/storage.py
#	app/services/grok/batch_services/nsfw.py
#	app/services/grok/batch_services/usage.py
#	app/services/grok/services/chat.py
#	app/services/grok/services/image.py
#	app/services/grok/services/image_edit.py
#	app/services/grok/services/model.py
#	app/services/grok/services/video.py
#	app/services/grok/utils/cache.py
#	app/services/grok/utils/download.py
#	app/services/grok/utils/process.py
#	app/services/grok/utils/retry.py
#	app/services/grok/utils/upload.py
#	app/services/reverse/app_chat.py
#	app/services/reverse/assets_delete.py
#	app/services/reverse/assets_download.py
#	app/services/reverse/assets_list.py
#	app/services/reverse/assets_upload.py
#	app/services/reverse/media_post.py
#	app/services/reverse/utils/headers.py
#	app/services/reverse/utils/retry.py
#	app/services/reverse/video_upscale.py
#	app/services/reverse/ws_imagine.py
#	app/services/reverse/ws_livekit.py
#	app/services/token/manager.py
#	app/services/token/models.py
#	app/services/token/service.py
#	app/static/admin/css/cache.css
#	app/static/admin/css/config.css
#	app/static/admin/css/token.css
#	app/static/admin/js/cache.js
#	app/static/admin/js/config.js
#	app/static/admin/js/token.js
#	app/static/admin/pages/cache.html
#	app/static/admin/pages/config.html
#	app/static/admin/pages/login.html
#	app/static/admin/pages/token.html
#	app/static/common/css/common.css
#	app/static/common/css/login.css
#	app/static/common/css/toast.css
#	app/static/common/html/header.html
#	app/static/common/html/public-header.html
#	app/static/common/js/admin-auth.js
#	app/static/common/js/header.js
#	app/static/common/js/public-header.js
#	app/static/common/js/toast.js
#	app/static/public/css/imagine.css
#	app/static/public/css/video.css
#	app/static/public/css/voice.css
#	app/static/public/js/imagine.js
#	app/static/public/js/login.js
#	app/static/public/js/video.js
#	app/static/public/js/voice.js
#	app/static/public/pages/imagine.html
#	app/static/public/pages/login.html
#	app/static/public/pages/video.html
#	app/static/public/pages/voice.html
#	config.defaults.toml
#	docker-compose.yml
#	docs/README.en.md
#	main.py
#	pyproject.toml
#	readme.md
#	uv.lock
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.