feat(usage): add unified provider usage backend

This commit is contained in:
chengyongru authored and chengyongru committed 2026-08-25 01:22:25 +08:00
1 parent 8bb3828487
commit 2ac802b2d5
24 files changed
+1605 -808

No files matched your search

+6
View File
@@ -49,6 +49,7 @@ from nanobot.bus.queue import MessageBus
from nanobot.bus.runtime_events import RuntimeEventBus
from nanobot.command import CommandContext, CommandRouter, register_builtin_commands
from nanobot.config.schema import AgentDefaults, ModelPresetConfig
from nanobot.llm_usage.context import source_from_request
from nanobot.providers.base import LLMProvider, LLMUsage, ProviderConversationState
from nanobot.providers.factory import ProviderSnapshot
from nanobot.runtime_context import (
@@ -1202,6 +1203,11 @@ class AgentLoop:
message_metadata=metadata,
),
provider_state=provider_state,
llm_usage_source=source_from_request(
active_session_key,
channel=channel,
metadata=metadata,
),
))
finally:
turn_scope_stack.close()