Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@ def patch(module) -> None:
容器:凡走 anthropic 原厂的模型一律不发 temperature。LiteLLMAIHandler.__init__ 里
`self.no_support_temperature_models = NO_SUPPORT_TEMPERATURE_MODELS` 取的是模块全局名,故重绑
全局即对之后创建的 handler 生效;只动成员判定、不碰 system/user 合并。"""
# 抑制 litellm 往 **stdout** 打的「Provider List: …」等装饰性提示(ANSI 红字)。编排 chat 通道以子进程
# stdout 作模型回复:litellm 在 cost/token 计量里对未进本地 model_cost 表的新模型(如 claude-opus-4-8)
# 调 get_llm_provider 失败时会先 print 该提示再抛错(错误被上游吞掉、不影响最终结果),但 print 已污染
# stdout、漏进评审总结。置 suppress_debug_info=True 关掉这些 print(真实 usage 由我们自己的 hook 采集,
# 不依赖这些输出)。全局生效、与 pr-agent 版本无关,故放在版本守卫与 CLI 分支之前。
try:
import litellm

litellm.suppress_debug_info = True
except Exception: # noqa: BLE001 - litellm 未就绪等,纯装饰性抑制失败不致命
pass
# (0) CLI 模式:换 chat_completion 直接调本机 CLI,绕过 litellm。放在版本守卫之前,
# 因为它只依赖 base_ai_handler 的稳定契约,跟 pr-agent 内部实现无关。装好即 return。
if os.environ.get("MEEBOX_CLI_MODE"):
Expand Down
5 changes: 4 additions & 1 deletion docs/arch/04-pragent-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ inline 包 pr-agent 的 `_get_completion`,从返回的 `response.usage` 取 `p
以哨兵行 `@@MEEBOX_USAGE@@ {json}` 打到 **stderr**;主进程逐行捕获、按前缀累加、落到 run(见 [05](05-review-workflow.md))。
**为什么 inline 而非 litellm callback**:litellm 的 async 回调走后台 logging worker,短命 CLI 退出过快会被丢;
inline 在 await 链里必在退出前执行,可靠。只取 token、不取 cost → 统一设 `LITELLM_LOCAL_MODEL_COST_MAP=True`
关掉 litellm 的远端价格表联网(弱网会 SSL 超时)。
关掉 litellm 的远端价格表联网(弱网会 SSL 超时)。另在 patch 时置 `litellm.suppress_debug_info=True`:编排 chat
通道以子进程 **stdout** 作模型回复,而 litellm 对未进本地 `model_cost` 表的新模型(如 `claude-opus-4-8`)在 cost/token
计量里调 `get_llm_provider` 失败时会先 `print` 装饰性的「Provider List: …」(ANSI 红字)再抛错(错误被吞、不影响结果),
该 print 会污染 stdout、漏进评审总结——置此开关关掉这些 print。

### 本地 CLI provider

Expand Down
100 changes: 70 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading