mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 07:09:20 +08:00
feat: 支持 Completions/Responses 双协议,并在同选型下续链加速
This commit is contained in:
@@ -9,6 +9,7 @@ import redis.asyncio as redis
|
||||
from config.settings import Settings
|
||||
from domain.models import LlmRuntimeConfig
|
||||
from domain.ports import LlmRuntimeCache
|
||||
from infrastructure.llm.api_style import normalize_api_style
|
||||
|
||||
|
||||
class RedisLlmRuntimeCache(LlmRuntimeCache):
|
||||
@@ -43,6 +44,7 @@ class RedisLlmRuntimeCache(LlmRuntimeCache):
|
||||
provider_id=_optional_int(data.get("provider_id")) or provider_id,
|
||||
extra_headers=data.get("extra_headers") or {},
|
||||
context_window=_optional_int(data.get("context_window")),
|
||||
api_style=normalize_api_style(data.get("api_style")),
|
||||
)
|
||||
if model and cfg.model and cfg.model != model:
|
||||
return None
|
||||
@@ -63,6 +65,7 @@ class RedisLlmRuntimeCache(LlmRuntimeCache):
|
||||
"model": config.model,
|
||||
"extra_headers": config.extra_headers,
|
||||
"context_window": config.context_window,
|
||||
"api_style": normalize_api_style(config.api_style),
|
||||
}
|
||||
await self._r.set(
|
||||
self._key(company_id, config.provider_id, config.model),
|
||||
|
||||
Reference in New Issue
Block a user