mirror of
https://gitee.com/qqtt-ah/ai-crm.git
synced 2026-11-24 23:49:20 +08:00
init
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""会话链选型匹配。"""
|
||||
|
||||
from domain.models import LlmResponseChain, LlmRuntimeConfig
|
||||
from application.chat_service import _usable_chain_id
|
||||
|
||||
|
||||
def test_usable_chain_id_matches():
|
||||
llm = LlmRuntimeConfig(
|
||||
base_url="https://api.openai.com/v1",
|
||||
api_key="k",
|
||||
model="gpt-4o-mini",
|
||||
provider_id=3,
|
||||
api_style="auto",
|
||||
)
|
||||
chain = LlmResponseChain(
|
||||
provider_id=3, model="gpt-4o-mini", previous_response_id="resp_abc"
|
||||
)
|
||||
assert _usable_chain_id(chain, llm) == "resp_abc"
|
||||
|
||||
|
||||
def test_usable_chain_id_clears_on_model_switch():
|
||||
llm = LlmRuntimeConfig(
|
||||
base_url="https://api.openai.com/v1",
|
||||
api_key="k",
|
||||
model="gpt-4o",
|
||||
provider_id=3,
|
||||
api_style="auto",
|
||||
)
|
||||
chain = LlmResponseChain(
|
||||
provider_id=3, model="gpt-4o-mini", previous_response_id="resp_abc"
|
||||
)
|
||||
assert _usable_chain_id(chain, llm) is None
|
||||
Reference in New Issue
Block a user