feat(onebot): refresh expired image URLs in history and model requests

- Cache NapCat rkeys by type and refresh only when their TTL expires
- Renew image URLs through get_msg for other OneBot v11 implementations
- Refresh session views, Runner history, and each model request attempt
- Isolate caches by connection without downloading images or rewriting history
This commit is contained in:
BiFangKNT
2026-10-23 08:41:50 +08:00
parent c538e696b2
commit baddaa2b74
14 changed files with 709 additions and 7 deletions
+8 -1
View File
@@ -1371,8 +1371,9 @@ class RuntimeConnectionHandler(handler.Handler):
run_id = data.get('run_id')
caller_plugin_identity = data.get('caller_plugin_identity')
session = None
if run_id:
_, error = await _validate_run_authorization(
session, error = await _validate_run_authorization(
run_id,
'model',
llm_model_uuid,
@@ -1417,6 +1418,12 @@ class RuntimeConnectionHandler(handler.Handler):
return handler.ActionResponse.error(message='LLM provider does not support token counting')
try:
from ..platform.image_urls import refresh_model_images
query = _resolve_action_query(data, session, self.ap, action_context)
messages_obj = await refresh_model_images(
self.ap, self._execution_context(action_context), query, messages_obj
)
tokens = await count_tokens_method(
model=llm_model,
messages=messages_obj,