feat(ai-title): 标题生成读取超时改用 4K 档 600 秒 (§19.30)
标题是「一次请求·纯提示词·生成多条」,需经中转站转发 + 大模型排队 + 整段返回,比一张图更耗时。原借 1K 档 240 秒读取超时,慢/排队型模型常在 返回前 ReadTimeout。改为借 4K 档 600 秒(resolution_timeout 512/1K/2K/4K → 180/240/360/600s),仅改标题链路,不动 generate_texts 默认 1K;模型条目 timeout_seconds>0 仍优先覆盖。 - ai_title.py:加常量 _TITLE_TIMEOUT_RESOLUTION="4K",generate_titles 显式传 resolution 借 600s - docs/11 §17.2 补读取超时说明、新增 §17.8 决策 - tests/test_ai_title:断言以 resolution="4K" 调 generate_texts - tasks.md:新增 §19.30;同时含 match_stamp §19.30–§19.34 任务段的移除 (用户回退 match_stamp 功能,本提交仅移除其 tasks.md 段落) 验证:test_ai_title / test_ai_text_service + 全套 py37(232 测试)通过, 唯一失败为无关的 test_config_service packaging 模板;离屏冒烟确认读取超时 =600s、timeout_seconds>0 优先覆盖。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,13 @@ from services.ai_text_service import AiTextClient
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# 标题是"一次请求、纯提示词、生成多条"(docs/11 §17.7):要经中转站转发、大模型
|
||||
# 排队、生成 N 条再整段返回,比一张图更耗时。纯文本请求本无"分辨率",这里只借
|
||||
# resolution_timeout 那张 {512/1K/2K/4K → 180/240/360/600 秒} 超时表的键,用 4K 档把
|
||||
# 读取超时抬到 600 秒(默认 1K 的 240 秒偏紧,慢/排队型模型会先 ReadTimeout)。见
|
||||
# docs/11 §17.8。模型条目若显式设 timeout_seconds>0 仍优先覆盖(ai_text_service._post)。
|
||||
_TITLE_TIMEOUT_RESOLUTION = "4K"
|
||||
|
||||
|
||||
def generate_titles(prompt, model_config, api_client=None):
|
||||
"""Generate a list of titles in ONE prompt-only request (docs/11 §17.1).
|
||||
@@ -18,6 +25,7 @@ def generate_titles(prompt, model_config, api_client=None):
|
||||
(AiTextClient raises in that case, so a normal return is always non-empty).
|
||||
"""
|
||||
client = api_client or AiTextClient(model_config)
|
||||
titles = client.generate_texts(prompt) # image_path=None -> text-only
|
||||
# image_path=None -> 纯文本;resolution="4K" 只为借 600s 读取超时(§17.8)
|
||||
titles = client.generate_texts(prompt, resolution=_TITLE_TIMEOUT_RESOLUTION)
|
||||
logger.info("Generated %d title(s) in one request", len(titles))
|
||||
return titles
|
||||
|
||||
Reference in New Issue
Block a user