移除已无消费者的 toolOutputTokenLimit 配置

- main.rs/config.rs/cli.rs 删除字段、默认值、校验、patch 合并与 CLI 展示

- 默认配置 game-creator.config.json 删除该键,旧配置里多余的键会被 serde 忽略

- 前端 types/RuntimeConfigDialog 与界面测试同步移除

- 该配置在 context_compaction 删除后已无任何 prompt 构建消费者
This commit is contained in:
2026-10-02 15:08:23 +08:00
parent b18b4935e4
commit c9b4813e68
13 changed files with 0 additions and 81 deletions
@@ -13,7 +13,6 @@
"webSearchEnabled": true,
"contextWindowTokens": 128000,
"autoCompactTokenLimit": 64000,
"toolOutputTokenLimit": 12000,
"requestTimeoutMs": 180000,
"maxRetries": 10,
"retryBackoffMs": 500
@@ -6364,7 +6364,6 @@ mod tests {
web_search_enabled: false,
context_window_tokens: 128_000,
auto_compact_token_limit: 64_000,
tool_output_token_limit: 12_000,
request_timeout_ms: 10_000,
max_retries: 0,
retry_backoff_ms: 100,
@@ -5390,7 +5390,6 @@ mod tests {
web_search_enabled: false,
context_window_tokens: 128_000,
auto_compact_token_limit: 64_000,
tool_output_token_limit: 12_000,
request_timeout_ms: 10_000,
max_retries: 0,
retry_backoff_ms: 100,
@@ -295,10 +295,6 @@ pub(crate) fn game_creator_llm_status_lines(status: &GameCreatorLlmConfigStatus)
"llm.autoCompactTokenLimit={}",
status.auto_compact_token_limit
),
format!(
"llm.toolOutputTokenLimit={}",
status.tool_output_token_limit
),
format!("llm.requestTimeoutMs={}", status.request_timeout_ms),
format!("llm.maxRetries={}", status.max_retries),
format!("llm.retryBackoffMs={}", status.retry_backoff_ms),
@@ -359,10 +355,6 @@ pub(crate) fn game_creator_llm_status_lines(status: &GameCreatorLlmConfigStatus)
"llm.agent.{}.autoCompactTokenLimit={}",
agent.agent_id, agent.auto_compact_token_limit
));
lines.push(format!(
"llm.agent.{}.toolOutputTokenLimit={}",
agent.agent_id, agent.tool_output_token_limit
));
lines.push(format!(
"llm.agent.{}.requestTimeoutMs={}",
agent.agent_id, agent.request_timeout_ms
@@ -375,7 +375,6 @@ pub(crate) fn check_game_creator_llm_config_from_config() -> GameCreatorLlmConfi
web_search_enabled: true,
context_window_tokens: DEFAULT_GAME_CREATOR_LLM_CONTEXT_WINDOW_TOKENS,
auto_compact_token_limit: DEFAULT_GAME_CREATOR_LLM_AUTO_COMPACT_TOKEN_LIMIT,
tool_output_token_limit: DEFAULT_GAME_CREATOR_LLM_TOOL_OUTPUT_TOKEN_LIMIT,
request_timeout_ms: GAME_CREATOR_LLM_REQUEST_TIMEOUT_MS,
max_retries: DEFAULT_GAME_CREATOR_LLM_MAX_RETRIES,
retry_backoff_ms: DEFAULT_RETRY_BACKOFF_MS,
@@ -640,7 +639,6 @@ pub(crate) fn check_game_creator_llm_config_values(
web_search_enabled: config.web_search_enabled,
context_window_tokens: config.context_window_tokens,
auto_compact_token_limit: config.auto_compact_token_limit,
tool_output_token_limit: config.tool_output_token_limit,
request_timeout_ms: config.request_timeout_ms,
max_retries: config.max_retries,
retry_backoff_ms: config.retry_backoff_ms,
@@ -679,7 +677,6 @@ pub(crate) fn check_game_creator_agent_llm_config_values(
web_search_enabled: config.web_search_enabled,
context_window_tokens: config.context_window_tokens,
auto_compact_token_limit: config.auto_compact_token_limit,
tool_output_token_limit: config.tool_output_token_limit,
request_timeout_ms: config.request_timeout_ms,
max_retries: config.max_retries,
retry_backoff_ms: config.retry_backoff_ms,
@@ -720,11 +717,6 @@ pub(crate) fn validate_game_creator_llm_context_config(
"配置项 {config_path}.autoCompactTokenLimit 必须大于 0"
));
}
if config.tool_output_token_limit == 0 {
return Err(format!(
"配置项 {config_path}.toolOutputTokenLimit 必须大于 0"
));
}
if config
.auto_compact_token_limit
.saturating_add(CONTEXT_SAFETY_MARGIN_TOKENS)
@@ -734,11 +726,6 @@ pub(crate) fn validate_game_creator_llm_context_config(
"配置项 {config_path}.autoCompactTokenLimit 必须至少为 contextWindowTokens 预留 {CONTEXT_SAFETY_MARGIN_TOKENS} tokens"
));
}
if config.tool_output_token_limit > config.auto_compact_token_limit {
return Err(format!(
"配置项 {config_path}.toolOutputTokenLimit 不能大于 autoCompactTokenLimit"
));
}
Ok(())
}
@@ -4245,9 +4232,6 @@ pub(crate) fn merge_game_creator_llm_config(
if let Some(value) = patch.auto_compact_token_limit {
config.auto_compact_token_limit = value;
}
if let Some(value) = patch.tool_output_token_limit {
config.tool_output_token_limit = value;
}
if let Some(value) = patch.request_timeout_ms {
config.request_timeout_ms = value;
}
@@ -4296,9 +4280,6 @@ pub(crate) fn merge_game_creator_llm_patch(
if let Some(value) = patch.auto_compact_token_limit {
config.auto_compact_token_limit = Some(value);
}
if let Some(value) = patch.tool_output_token_limit {
config.tool_output_token_limit = Some(value);
}
if let Some(value) = patch.request_timeout_ms {
config.request_timeout_ms = Some(value);
}
@@ -4606,7 +4587,6 @@ pub(crate) fn normalize_game_creator_llm_patch_config(
for (field, value) in [
("contextWindowTokens", patch.context_window_tokens),
("autoCompactTokenLimit", patch.auto_compact_token_limit),
("toolOutputTokenLimit", patch.tool_output_token_limit),
] {
if value.is_some_and(|value| value == 0) {
return Err(format!("配置项 agentLlm.{agent_id}.{field} 必须大于 0"));
@@ -4627,7 +4607,6 @@ pub(crate) fn is_empty_game_creator_llm_patch(patch: &GameCreatorLlmConfigFile)
&& patch.web_search_enabled.is_none()
&& patch.context_window_tokens.is_none()
&& patch.auto_compact_token_limit.is_none()
&& patch.tool_output_token_limit.is_none()
&& patch.request_timeout_ms.is_none()
&& patch.max_retries.is_none()
&& patch.retry_backoff_ms.is_none()
@@ -790,7 +790,6 @@ struct GameCreatorLlmConfigStatus {
web_search_enabled: bool,
context_window_tokens: u64,
auto_compact_token_limit: u64,
tool_output_token_limit: u64,
request_timeout_ms: u64,
max_retries: u32,
retry_backoff_ms: u64,
@@ -812,7 +811,6 @@ struct GameCreatorAgentLlmConfigStatus {
web_search_enabled: bool,
context_window_tokens: u64,
auto_compact_token_limit: u64,
tool_output_token_limit: u64,
request_timeout_ms: u64,
max_retries: u32,
retry_backoff_ms: u64,
@@ -863,8 +861,6 @@ struct GameCreatorLlmConfigFile {
#[serde(skip_serializing_if = "Option::is_none")]
auto_compact_token_limit: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
tool_output_token_limit: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
request_timeout_ms: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
max_retries: Option<u32>,
@@ -916,8 +912,6 @@ struct GameCreatorLlmConfig {
context_window_tokens: u64,
#[serde(default = "default_game_creator_llm_auto_compact_token_limit")]
auto_compact_token_limit: u64,
#[serde(default = "default_game_creator_llm_tool_output_token_limit")]
tool_output_token_limit: u64,
request_timeout_ms: u64,
max_retries: u32,
retry_backoff_ms: u64,
@@ -1310,7 +1304,6 @@ const DEFAULT_GAME_CREATOR_LLM_API_KIND: &str = "openai_responses";
const DEFAULT_GAME_CREATOR_LLM_REASONING_EFFORT: &str = "high";
const DEFAULT_GAME_CREATOR_LLM_CONTEXT_WINDOW_TOKENS: u64 = 128_000;
const DEFAULT_GAME_CREATOR_LLM_AUTO_COMPACT_TOKEN_LIMIT: u64 = 64_000;
const DEFAULT_GAME_CREATOR_LLM_TOOL_OUTPUT_TOKEN_LIMIT: u64 = 12_000;
const DEFAULT_GAME_CREATOR_LLM_MAX_RETRIES: u32 = 10;
fn default_game_creator_agent_mode() -> String {
@@ -1329,10 +1322,6 @@ fn default_game_creator_llm_auto_compact_token_limit() -> u64 {
DEFAULT_GAME_CREATOR_LLM_AUTO_COMPACT_TOKEN_LIMIT
}
fn default_game_creator_llm_tool_output_token_limit() -> u64 {
DEFAULT_GAME_CREATOR_LLM_TOOL_OUTPUT_TOKEN_LIMIT
}
const DEFAULT_CANVAS_SYNC_API_BASE_URL: &str = "https://dev.genarrative.world";
const DEFAULT_GAME_CREATOR_APP_CONFIG_JSON: &str = include_str!("../../game-creator.config.json");
const GAME_CREATOR_LLM_MAX_OUTPUT_TOKENS: u32 = 320000;
@@ -1425,7 +1414,6 @@ impl Default for GameCreatorLlmConfig {
web_search_enabled: false,
context_window_tokens: DEFAULT_GAME_CREATOR_LLM_CONTEXT_WINDOW_TOKENS,
auto_compact_token_limit: DEFAULT_GAME_CREATOR_LLM_AUTO_COMPACT_TOKEN_LIMIT,
tool_output_token_limit: DEFAULT_GAME_CREATOR_LLM_TOOL_OUTPUT_TOKEN_LIMIT,
request_timeout_ms: GAME_CREATOR_LLM_REQUEST_TIMEOUT_MS,
max_retries: DEFAULT_GAME_CREATOR_LLM_MAX_RETRIES,
retry_backoff_ms: DEFAULT_RETRY_BACKOFF_MS,
@@ -373,7 +373,6 @@ mod tests {
web_search_enabled: false,
context_window_tokens: 128_000,
auto_compact_token_limit: 64_000,
tool_output_token_limit: 12_000,
request_timeout_ms: 10_000,
max_retries: 0,
retry_backoff_ms: 100,
@@ -547,7 +547,6 @@ export interface GameCreatorLlmConfigStatus {
webSearchEnabled: boolean;
contextWindowTokens?: number;
autoCompactTokenLimit?: number;
toolOutputTokenLimit?: number;
error: string | null;
agents?: GameCreatorAgentLlmConfigStatus[];
}
@@ -564,7 +563,6 @@ export interface GameCreatorAgentLlmConfigStatus {
webSearchEnabled: boolean;
contextWindowTokens?: number;
autoCompactTokenLimit?: number;
toolOutputTokenLimit?: number;
error: string | null;
}
@@ -599,7 +597,6 @@ export interface GameCreatorLlmConfig {
webSearchEnabled: boolean;
contextWindowTokens: number;
autoCompactTokenLimit: number;
toolOutputTokenLimit: number;
requestTimeoutMs: number;
maxRetries: number;
retryBackoffMs: number;
@@ -71,7 +71,6 @@ const defaultRuntimeConfigDraft: GameCreatorAppConfig = {
webSearchEnabled: true,
contextWindowTokens: 128000,
autoCompactTokenLimit: 64000,
toolOutputTokenLimit: 12000,
requestTimeoutMs: 180000,
maxRetries: 10,
retryBackoffMs: 500,
@@ -194,12 +193,6 @@ function normalizeRuntimeConfigDraft(
: defaultRuntimeConfigDraft.llm.autoCompactTokenLimit,
1,
),
toolOutputTokenLimit: clampRuntimeConfigNumber(
typeof config.llm.toolOutputTokenLimit === 'number'
? config.llm.toolOutputTokenLimit
: defaultRuntimeConfigDraft.llm.toolOutputTokenLimit,
1,
),
requestTimeoutMs: clampRuntimeConfigNumber(
config.llm.requestTimeoutMs,
1000,
@@ -1018,21 +1011,6 @@ export function RuntimeConfigDialog({
}
/>
</label>
<label>
工具输出上限 tokens
<input
aria-label="工具输出上限 tokens"
type="number"
min="1"
value={runtimeConfigDraft.llm.toolOutputTokenLimit}
onChange={(event) =>
updateRuntimeLlmConfig(
'toolOutputTokenLimit',
Math.max(1, Number(event.currentTarget.value) || 1),
)
}
/>
</label>
<label>
请求超时 ms
<input
@@ -57,7 +57,6 @@ function gameCreatorConfigView(reasoningEffort: string) {
webSearchEnabled: true,
contextWindowTokens: 128000,
autoCompactTokenLimit: 64000,
toolOutputTokenLimit: 12000,
requestTimeoutMs: 180000,
maxRetries: 2,
retryBackoffMs: 500,
@@ -659,7 +659,6 @@ function createProjectChatRuntimeHarness({
webSearchEnabled: true,
contextWindowTokens: 128000,
autoCompactTokenLimit: 64000,
toolOutputTokenLimit: 12000,
requestTimeoutMs: 180000,
maxRetries: 2,
retryBackoffMs: 500,
@@ -3483,7 +3483,6 @@ export function registerRecentProjectsTests() {
webSearchEnabled: false,
contextWindowTokens: 128000,
autoCompactTokenLimit: 64000,
toolOutputTokenLimit: 12000,
requestTimeoutMs: 180000,
maxRetries: 2,
retryBackoffMs: 500,
@@ -323,7 +323,6 @@ export function registerRuntimeSettingsTests() {
webSearchEnabled: false,
contextWindowTokens: 128000,
autoCompactTokenLimit: 64000,
toolOutputTokenLimit: 12000,
requestTimeoutMs: 180000,
maxRetries: 2,
retryBackoffMs: 500,
@@ -392,7 +391,6 @@ export function registerRuntimeSettingsTests() {
webSearchEnabled: false,
contextWindowTokens: 128000,
autoCompactTokenLimit: 64000,
toolOutputTokenLimit: 12000,
requestTimeoutMs: 180000,
maxRetries: 2,
retryBackoffMs: 500,
@@ -461,7 +459,6 @@ export function registerRuntimeSettingsTests() {
webSearchEnabled: false,
contextWindowTokens: 128000,
autoCompactTokenLimit: 64000,
toolOutputTokenLimit: 12000,
requestTimeoutMs: 180000,
maxRetries: 2,
retryBackoffMs: 500,
@@ -534,7 +531,6 @@ export function registerRuntimeSettingsTests() {
webSearchEnabled: false,
contextWindowTokens: 128000,
autoCompactTokenLimit: 64000,
toolOutputTokenLimit: 12000,
requestTimeoutMs: 180000,
maxRetries: 2,
retryBackoffMs: 500,
@@ -638,10 +634,6 @@ export function registerRuntimeSettingsTests() {
'value',
'64000',
);
expect(screen.getByLabelText('工具输出上限 tokens')).toHaveProperty(
'value',
'12000',
);
fireEvent.click(screen.getByRole('button', { name: '保存' }));
await waitFor(() => {