feat(openai-images): support prompt optimization control#2495
Closed
gaoren002 wants to merge 1 commit into
Closed
Conversation
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.
变更说明
本 PR 为 OpenAI 图片生成请求增加
prompt_optimization控制项。客户端可以通过该参数显式关闭提示词改写/优化。当图片生成请求走 Responses image tool 路径时,关闭该开关会要求上游尽量按用户原始提示词执行,不进行改写、扩写、翻译或润色。
同时,直连 Images API 的转发路径会剥离该内部字段,避免官方 OpenAI 或第三方兼容上游因为未知字段报错。
主要改动
prompt_optimization/promptOptimization。prompt_optimization=false时加入“不改写提示词”的指令。验证
go test ./internal/service -run 'AccountTestService_OpenAIImage|AccountTestService_TestAccountConnection_OpenAICompact|OpenAIImages|PromptOptimization|RewriteOpenAIImagesModel'go test ./internal/handler/admin -run 'Account|Test'corepack pnpm test:run src/components/admin/account/__tests__/AccountTestModal.spec.tscorepack pnpm typecheckgit diff --check