refactor(backend): dify, minio等迁移到integration,清除无效文件
This commit is contained in:
1 parent
7fe7a39384
commit
faa554ade4
90 files changed
+7540
-9649
No files matched your search
@@ -13,7 +13,7 @@ from types import SimpleNamespace
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
from app.services.dify import DifyService
|
||||
from app.services.integrations.dify import DifyService
|
||||
from app.services.file_check import FileCheckService
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ def _mock_stream_response(monkeypatch, *, status_code: int = 200, lines: list[by
|
||||
calls["count"] += 1
|
||||
return _Resp()
|
||||
|
||||
monkeypatch.setattr("app.services.dify.requests.post", _post)
|
||||
monkeypatch.setattr("app.services.integrations.dify.requests.post", _post)
|
||||
return calls
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ def test_workflow_streaming_503_retries_then_success(monkeypatch):
|
||||
|
||||
return _Resp()
|
||||
|
||||
monkeypatch.setattr("app.services.dify.requests.post", _post)
|
||||
monkeypatch.setattr("app.services.integrations.dify.requests.post", _post)
|
||||
|
||||
result = DifyService.run_workflow_streaming(agent=_Agent(), inputs={"record": "x"})
|
||||
|
||||
@@ -199,7 +199,7 @@ def test_workflow_streaming_401_does_not_retry(monkeypatch):
|
||||
resp.status_code = 401
|
||||
raise requests.HTTPError(response=resp)
|
||||
|
||||
monkeypatch.setattr("app.services.dify.requests.post", _post)
|
||||
monkeypatch.setattr("app.services.integrations.dify.requests.post", _post)
|
||||
|
||||
with pytest.raises(requests.HTTPError):
|
||||
DifyService.run_workflow_streaming(agent=_Agent(), inputs={"record": "x"})
|
||||
@@ -353,7 +353,7 @@ def test_dedupe_exact_doubled_text_fixes_historical_records():
|
||||
def test_chat_stream_error_event_keeps_persisted_chat_log_id(app, monkeypatch):
|
||||
"""连接超时的 error SSE 必须携带持久化主键,供领域 Handler 回写失败状态。"""
|
||||
monkeypatch.setattr(
|
||||
"app.services.dify.requests.post",
|
||||
"app.services.integrations.dify.requests.post",
|
||||
lambda *args, **kwargs: (_ for _ in ()).throw(requests.exceptions.ConnectTimeout("connect timed out")),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
@@ -402,7 +402,7 @@ def test_chat_stream_read_timeout_after_answer_emits_terminal_event(app, monkeyp
|
||||
yield _sse_lines({"event": "message", "answer": "partial answer"})[0]
|
||||
raise requests.exceptions.ReadTimeout("read timed out")
|
||||
|
||||
monkeypatch.setattr("app.services.dify.requests.post", lambda *args, **kwargs: _ChatResponse())
|
||||
monkeypatch.setattr("app.services.integrations.dify.requests.post", lambda *args, **kwargs: _ChatResponse())
|
||||
monkeypatch.setattr(
|
||||
DifyService,
|
||||
"_persist_stream_chat_record",
|
||||
|
||||
Reference in new issue
Block a user