mirror of
https://github.com/NCBM/plyngent.git
synced 2026-07-23 05:55:16 +08:00
core/cli: show estimated context tokens and usage source tags
/status adds context_tokens~=(est); docs note api/estimate/mixed labels.
This commit is contained in:
@@ -60,8 +60,11 @@ def _cmd_status(state: ReplState) -> None:
|
||||
pending_disp = "yes" if pending else "no"
|
||||
ctx_chars = estimate_messages_chars(state.agent.messages)
|
||||
ctx_budget = state.agent.max_context_chars
|
||||
from plyngent.agent.usage import chars_to_tokens
|
||||
|
||||
session_u = state.agent.session_usage
|
||||
last_u = state.agent.last_turn_usage
|
||||
ctx_est_tokens = chars_to_tokens(ctx_chars)
|
||||
click.echo(
|
||||
f"provider={state.provider_name} model={state.model}\n"
|
||||
f"session={state.session_id} messages={len(state.agent.messages)} "
|
||||
@@ -69,6 +72,7 @@ def _cmd_status(state: ReplState) -> None:
|
||||
f"tools={'on' if state.tools_enabled else 'off'} "
|
||||
f"rounds={state.max_rounds} stream={'on' if state.agent.stream else 'off'}\n"
|
||||
f"context_chars={ctx_chars}/{ctx_budget} "
|
||||
f"context_tokens~={ctx_est_tokens} (est) "
|
||||
f"tool_result_max={state.agent.max_tool_result_chars}\n"
|
||||
f"usage_session={session_u.format_line()}\n"
|
||||
f"usage_last_turn={last_u.format_line()}\n"
|
||||
|
||||
Reference in New Issue
Block a user