mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-08-31 20:29:56 +02:00
[eric] deadcode: remove unused _approx_tokens
This commit is contained in:
@@ -50,7 +50,6 @@ from backend.apps.agents.tool_catalog import (
|
||||
)
|
||||
from backend.apps.agents.aux_llm import _safe_resp_text
|
||||
from backend.apps.agents.history_compaction import (
|
||||
_approx_tokens,
|
||||
_build_history_prefix,
|
||||
_get_branch_messages,
|
||||
_summarize_message_block,
|
||||
|
||||
@@ -62,14 +62,6 @@ def _build_history_prefix(messages) -> str:
|
||||
return "<prior_conversation>\n" + "\n".join(lines) + "\n</prior_conversation>"
|
||||
|
||||
|
||||
def _approx_tokens(text: str) -> int:
|
||||
"""Conservative chars/4 estimate. Used for the pre-send guard
|
||||
and the compaction trigger when a precise count_tokens isn't
|
||||
cheap (or the route isn't Anthropic). Errs slightly high so we
|
||||
compact a touch earlier than strictly necessary."""
|
||||
return max(1, len(text or "") // 4)
|
||||
|
||||
|
||||
def _summarize_message_block(messages: list) -> str:
|
||||
"""Programmatic, no-LLM summary of a message slice. Mirrors the
|
||||
shape of browser_agent._summarize_messages: extracts the original
|
||||
|
||||
@@ -48,7 +48,6 @@ requests_delta
|
||||
# This task is tooling-only and must not edit backend source, so these stay
|
||||
# whitelisted rather than deleted. They have zero call sites today; a future
|
||||
# non-additive cleanup pass should remove the definitions and these lines.
|
||||
_approx_tokens
|
||||
_summarize_message_block
|
||||
thinking_params_for
|
||||
_resolve_model
|
||||
|
||||
Reference in New Issue
Block a user