feat: 统一 max_input_tokens API,所有引擎必须返回最大输入 token 数
- openai/ollama/manual 三引擎均暴露 max_input_tokens 属性(统一契约) - ollama 额外上报 prompt_eval_count 到 last_prompt_tokens,使本地模型也走 token 感知压缩 - should_compress 改用 max_input_tokens,系统依当前引擎上限的 70%(compress_ratio)自动触发 - 压缩始终调用当前引擎(current_engine)做总结,符合"调用当前引擎总结压缩" - 新增 tests/test_max_input_tokens.py 覆盖契约 + 70% 触发 + 消息数兜底 Co-Authored-By: WorkBuddy <workbuddy@tencent.com>
This commit is contained in:
1 parent
c87a07706e
commit
5fe1a7c868
6 files changed
+104
-7
No files matched your search
@@ -582,6 +582,11 @@ OpenAI 兼容格式引擎帮助信息
|
||||
return win
|
||||
return 128000
|
||||
|
||||
@property
|
||||
def max_input_tokens(self):
|
||||
"""当前引擎支持的最大输入 token 数(统一 API,供上下文压缩使用)。"""
|
||||
return self.context_window()
|
||||
|
||||
def list_models(self):
|
||||
"""列出可用模型(调用 API 的 /models 端点)"""
|
||||
if not self.base_url:
|
||||
|
||||
Reference in new issue
Block a user