修复Chat生成预算字段兼容
Project CI / Repository checks (push) Successful in 1m14s
Project CI / Frontend tests (push) Successful in 3m57s
Project CI / Backend tests (push) Successful in 4m13s
Project CI / Native shell tests (push) Successful in 12m28s
Project CI / Repository checks (pull_request) Failing after 10s
Project CI / Backend tests (pull_request) Failing after 10s
Project CI / Frontend tests (pull_request) Successful in 3m23s
Project CI / Native shell tests (pull_request) Successful in 15m7s

新增Chat生成预算字段能力并兼容新旧网关
VectorEngine编辑器客户端改用max_completion_tokens
补充BGM请求体回归与协议文档约束
This commit is contained in:
2026-08-06 20:39:19 +08:00
parent 281c84b7bf
commit 9dab1f53b9
11 changed files with 217 additions and 55 deletions
@@ -887,6 +887,11 @@ mod tests {
requests[0].body["model"],
BACKGROUND_MUSIC_PROMPT_ASSIST_MODEL
);
assert_eq!(
requests[0].body["max_completion_tokens"],
BACKGROUND_MUSIC_PROMPT_ASSIST_MAX_OUTPUT_TOKENS
);
assert!(requests[0].body.get("max_tokens").is_none());
assert_eq!(requests[0].body["reasoning_effort"], "medium");
assert!(requests[0].body.get("tools").is_none());
assert!(requests[0].body.get("tool_choice").is_none());
+7 -2
View File
@@ -21,7 +21,7 @@ use platform_auth::{
RefreshCookieConfig, RefreshCookieError, RefreshCookieSameSite, SmsAuthConfig, SmsAuthProvider,
SmsAuthProviderKind, SmsProviderError, WechatProvider, sign_access_token, verify_access_token,
};
use platform_llm::{LlmClient, LlmConfig, LlmError, LlmProvider};
use platform_llm::{LlmClient, LlmConfig, LlmError, LlmProvider, OpenAiChatTokenBudgetField};
use platform_matting::{MattingClient, MattingConfig};
use platform_oss::{OssClient, OssConfig, OssError};
use platform_wechat::{WechatClient, WechatConfig, pay::WechatPayClient};
@@ -2187,7 +2187,8 @@ fn build_editor_agent_llm_client(
config
.llm_retry_backoff_ms
.min(EDITOR_AGENT_LLM_MAX_RETRY_BACKOFF_MS),
)?;
)?
.with_openai_chat_token_budget_field(OpenAiChatTokenBudgetField::MaxCompletionTokens);
Ok(Some(LlmClient::new(llm_config)?))
}
@@ -2508,6 +2509,10 @@ mod tests {
"https://api.vectorengine.test/v1/chat/completions"
);
assert!(!client.config().official_fallback());
assert_eq!(
client.config().openai_chat_token_budget_field(),
OpenAiChatTokenBudgetField::MaxCompletionTokens
);
assert_eq!(client.config().max_retries(), 1);
assert_eq!(client.config().retry_backoff_ms(), 60_000);
}