refactor: centralize llm provider transport
This commit is contained in:
@@ -44,7 +44,7 @@ class MentorStreamTests(unittest.TestCase):
|
||||
captured["accept"] = request.headers.get("Accept")
|
||||
return FakeStreamResponse(self.lines)
|
||||
|
||||
with patch("mentor_agent.urllib.request.urlopen", side_effect=open_request):
|
||||
with patch("backend.llm.transport.urllib.request.urlopen", side_effect=open_request):
|
||||
chunks = list(
|
||||
stream_with_mentor(
|
||||
self.skill, {"data_trade_date": "20260723"}, "怎么看?", [],
|
||||
@@ -58,7 +58,7 @@ class MentorStreamTests(unittest.TestCase):
|
||||
|
||||
def test_non_streaming_compatibility_wrapper_collects_chunks(self):
|
||||
with patch(
|
||||
"mentor_agent.urllib.request.urlopen",
|
||||
"backend.llm.transport.urllib.request.urlopen",
|
||||
return_value=FakeStreamResponse(self.lines),
|
||||
):
|
||||
result = chat_with_mentor(
|
||||
@@ -74,7 +74,7 @@ class MentorStreamTests(unittest.TestCase):
|
||||
b"data: [DONE]\n",
|
||||
]
|
||||
with patch(
|
||||
"mentor_agent.urllib.request.urlopen",
|
||||
"backend.llm.transport.urllib.request.urlopen",
|
||||
return_value=FakeStreamResponse(lines),
|
||||
):
|
||||
chunks = list(
|
||||
@@ -92,7 +92,7 @@ class MentorStreamTests(unittest.TestCase):
|
||||
b"data: [DONE]\n",
|
||||
]
|
||||
with patch(
|
||||
"mentor_agent.urllib.request.urlopen",
|
||||
"backend.llm.transport.urllib.request.urlopen",
|
||||
return_value=FakeStreamResponse(lines),
|
||||
):
|
||||
chunks = list(
|
||||
|
||||
Reference in New Issue
Block a user