-- Clarify out_buffer_capacity semantics for AI auto-tune.
|
-- out_buffer_capacity is an outbound buffer capacity and risk reference, not an out_task_limit cap.
|
|
SET @current_db := DATABASE();
|
|
SET @out_buffer_capacity_exists := (
|
SELECT COUNT(1)
|
FROM information_schema.COLUMNS
|
WHERE TABLE_SCHEMA = @current_db
|
AND TABLE_NAME = 'asr_bas_station'
|
AND COLUMN_NAME = 'out_buffer_capacity'
|
);
|
|
SET @alter_out_buffer_capacity_comment_sql := IF(
|
@out_buffer_capacity_exists > 0,
|
'ALTER TABLE asr_bas_station MODIFY COLUMN out_buffer_capacity INT NULL COMMENT ''出库缓存容量,用于评估 out_task_limit 超过缓存后的主干道占用风险''',
|
'SELECT ''column asr_bas_station.out_buffer_capacity missing, skip comment update'' '
|
);
|
PREPARE stmt_out_buffer_capacity_comment FROM @alter_out_buffer_capacity_comment_sql;
|
EXECUTE stmt_out_buffer_capacity_comment;
|
DEALLOCATE PREPARE stmt_out_buffer_capacity_comment;
|
|
SET @prompt_template_table_exists := (
|
SELECT COUNT(1)
|
FROM information_schema.TABLES
|
WHERE TABLE_SCHEMA = @current_db
|
AND TABLE_NAME = 'sys_ai_prompt_template'
|
);
|
|
SET @prompt_block_table_exists := (
|
SELECT COUNT(1)
|
FROM information_schema.TABLES
|
WHERE TABLE_SCHEMA = @current_db
|
AND TABLE_NAME = 'sys_ai_prompt_block'
|
);
|
|
SET @old_rule_read_line := '- 必须读取 snapshot.ruleSnapshot 中的 minValue、maxValue、maxStep、cooldownMinutes、dynamicMaxValue 和 dynamicMaxSource。';
|
SET @new_rule_read_line := '- 必须读取 snapshot.ruleSnapshot 中的 minValue、maxValue、maxStep、cooldownMinutes、规则 note,以及规则明确提供的 dynamicMaxValue 和 dynamicMaxSource。';
|
|
SET @old_rule_limit_line := CONCAT(
|
'- 每个目标参数的新值必须满足对应 minValue、maxValue 或 dynamicMaxValue、maxStep、cooldownMinutes 和规则 note;找不到规则或无法证',
|
'明动态上限时禁止提交。'
|
);
|
SET @new_rule_limit_line := '- 每个目标参数的新值必须满足对应 minValue、maxValue、maxStep、cooldownMinutes 和规则 note;只有规则本身明确提供 dynamicMaxValue/dynamicMaxSource 时,才按该动态上限校验;不得把 outBufferCapacity 推导为 outTaskLimit 的动态上限;找不到规则时禁止提交。';
|
|
SET @old_decision_line := '- heuristicDirection/recommendedDirection 只是后端启发式提示,不是最终调参结论;最终是否调参必须由你结合任务阻塞、路径评分、规则步长、动态上限和冷却独立判断。';
|
SET @new_decision_line := '- heuristicDirection/recommendedDirection 只是后端启发式提示,不是最终调参结论;最终是否调参必须由你结合任务阻塞、路径评分、规则上下限、规则明确提供的动态上限和冷却独立判断。';
|
|
SET @old_increase_line := CONCAT(
|
'- 当 heuristicDirection=increase_candidate 时,仍必须检查 ruleSnapshot、outBufferCapacity、maxStep 和 cooldown,且不得突',
|
'破动态上限。'
|
);
|
SET @new_increase_line := '- 当 heuristicDirection=increase_candidate 时,仍必须检查 ruleSnapshot、outBufferCapacity、maxStep 和 cooldown;outBufferCapacity 只表示站点出库缓存容量,用于评估超出缓存后的主干道占用风险,不是 outTaskLimit 的硬上限或动态上限。';
|
|
SET @old_buffer_note := CONCAT(
|
'注意:asr_bas_station.out_buffer_capacity 是人工维护的出库缓存容量,只用于证',
|
'明 outTaskLimit 可上调上限,Agent 不允许修改该字段;增大 outTaskLimit 时建议值不得超过',
|
'对应站点 outBufferCapacity。'
|
);
|
SET @new_buffer_note := '注意:asr_bas_station.out_buffer_capacity 是人工维护的出库缓存容量,用于评估 outTaskLimit 超过缓存后任务进入主干道占用的风险,Agent 不允许修改该字段;增大 outTaskLimit 可以超过对应站点 outBufferCapacity,但必须说明超出缓存后的主干道占用风险,并遵守 ruleSnapshot 中 outTaskLimit 自身的 minValue、maxValue、maxStep、cooldownMinutes、规则 note 以及规则明确提供的 dynamicMaxValue/dynamicMaxSource。';
|
|
SET @update_prompt_block_sql := IF(
|
@prompt_template_table_exists > 0 AND @prompt_block_table_exists > 0,
|
'UPDATE sys_ai_prompt_block b
|
JOIN sys_ai_prompt_template t ON t.id = b.template_id
|
SET b.content = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(b.content,
|
@old_rule_read_line, @new_rule_read_line),
|
@old_rule_limit_line, @new_rule_limit_line),
|
@old_decision_line, @new_decision_line),
|
@old_increase_line, @new_increase_line),
|
@old_buffer_note, @new_buffer_note)
|
WHERE t.scene_code = ''wcs_auto_tune_dispatch''
|
AND t.published = 1',
|
'SELECT ''prompt template/block table missing, skip published prompt block update'' '
|
);
|
PREPARE stmt_update_prompt_block FROM @update_prompt_block_sql;
|
EXECUTE stmt_update_prompt_block;
|
DEALLOCATE PREPARE stmt_update_prompt_block;
|
|
SET @update_prompt_template_sql := IF(
|
@prompt_template_table_exists > 0,
|
'UPDATE sys_ai_prompt_template
|
SET content = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(content,
|
@old_rule_read_line, @new_rule_read_line),
|
@old_rule_limit_line, @new_rule_limit_line),
|
@old_decision_line, @new_decision_line),
|
@old_increase_line, @new_increase_line),
|
@old_buffer_note, @new_buffer_note)
|
WHERE scene_code = ''wcs_auto_tune_dispatch''
|
AND published = 1',
|
'SELECT ''prompt template table missing, skip published prompt content update'' '
|
);
|
PREPARE stmt_update_prompt_template FROM @update_prompt_template_sql;
|
EXECUTE stmt_update_prompt_template;
|
DEALLOCATE PREPARE stmt_update_prompt_template;
|