feat(provider): show cache hit rate in /status (#2645)

This commit is contained in:
chengyongru authored and Xubin Ren committed 2026-04-02 12:51:45 +08:00
1 parent 42fa8fa933
commit da08dee144
9 files changed
+445 -14

No files matched your search

+9
View File
@@ -97,6 +97,15 @@ class _LoopHook(AgentHook):
logger.info("Tool call: {}({})", tc.name, args_str[:200])
self._loop._set_tool_context(self._channel, self._chat_id, self._message_id)
async def after_iteration(self, context: AgentHookContext) -> None:
u = context.usage or {}
logger.debug(
"LLM usage: prompt={} completion={} cached={}",
u.get("prompt_tokens", 0),
u.get("completion_tokens", 0),
u.get("cached_tokens", 0),
)
def finalize_content(self, context: AgentHookContext, content: str | None) -> str | None:
return self._loop._strip_think(content)