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
@@ -297,7 +297,10 @@ def test_file_check_tool_accepts_any_valid_task(app, client, monkeypatch):
|
||||
def start(self):
|
||||
return None
|
||||
|
||||
monkeypatch.setattr('app.api.file_check_tools.threading.Thread', _Thread)
|
||||
def _enqueue(*_args, **_kwargs):
|
||||
return 1
|
||||
|
||||
monkeypatch.setattr('app.api.file_check_tools.enqueue', _enqueue)
|
||||
with app.app_context():
|
||||
app.config['INTEGRATION_API_KEY'] = 'secret'
|
||||
admin = _mk_admin()
|
||||
@@ -382,7 +385,10 @@ def test_file_check_tool_start_records_chat_log_bind_context(app, client, monkey
|
||||
def start(self):
|
||||
return None
|
||||
|
||||
monkeypatch.setattr('app.api.file_check_tools.threading.Thread', _Thread)
|
||||
def _enqueue(*_args, **_kwargs):
|
||||
return 1
|
||||
|
||||
monkeypatch.setattr('app.api.file_check_tools.enqueue', _enqueue)
|
||||
|
||||
with app.app_context():
|
||||
app.config['INTEGRATION_API_KEY'] = 'secret'
|
||||
@@ -619,7 +625,10 @@ def test_file_check_tool_running_conflict_is_per_task(app, client, monkeypatch):
|
||||
def start(self):
|
||||
return None
|
||||
|
||||
monkeypatch.setattr('app.api.file_check_tools.threading.Thread', _Thread)
|
||||
def _enqueue(*_args, **_kwargs):
|
||||
return 1
|
||||
|
||||
monkeypatch.setattr('app.api.file_check_tools.enqueue', _enqueue)
|
||||
with app.app_context():
|
||||
app.config['INTEGRATION_API_KEY'] = 'secret'
|
||||
admin = _mk_admin()
|
||||
@@ -1224,18 +1233,13 @@ def test_file_check_tool_excel_download_uses_signed_token(app, client):
|
||||
|
||||
|
||||
def test_file_check_tool_runs_disabled_schedule_immediately(app, client, monkeypatch):
|
||||
started_threads = []
|
||||
enqueued = []
|
||||
|
||||
class _Thread:
|
||||
def __init__(self, *, target, daemon, name):
|
||||
self.target = target
|
||||
self.daemon = daemon
|
||||
self.name = name
|
||||
def _enqueue(*args, **kwargs):
|
||||
enqueued.append({"args": args, "kwargs": kwargs})
|
||||
return 1
|
||||
|
||||
def start(self):
|
||||
started_threads.append(self.name)
|
||||
|
||||
monkeypatch.setattr('app.api.file_check_tools.threading.Thread', _Thread)
|
||||
monkeypatch.setattr('app.api.file_check_tools.enqueue', _enqueue)
|
||||
|
||||
with app.app_context():
|
||||
app.config['INTEGRATION_API_KEY'] = 'secret'
|
||||
@@ -1254,7 +1258,7 @@ def test_file_check_tool_runs_disabled_schedule_immediately(app, client, monkeyp
|
||||
assert data['ok'] is True
|
||||
assert data['run']['task_id'] == task_id
|
||||
assert data['run']['status'] == 'running'
|
||||
assert started_threads == [f"file-check-run-{data['run']['run_id']}"]
|
||||
assert enqueued and enqueued[0]['kwargs'].get('domain') == 'file_check'
|
||||
|
||||
|
||||
def test_serialize_file_judgement_reads_file_key():
|
||||
@@ -1816,7 +1820,10 @@ def test_file_check_turn_registry_binds_run_without_http_turn_id(app, client, mo
|
||||
def start(self):
|
||||
return None
|
||||
|
||||
monkeypatch.setattr('app.api.file_check_tools.threading.Thread', _Thread)
|
||||
def _enqueue(*_args, **_kwargs):
|
||||
return 1
|
||||
|
||||
monkeypatch.setattr('app.api.file_check_tools.enqueue', _enqueue)
|
||||
|
||||
with app.app_context():
|
||||
app.config['INTEGRATION_API_KEY'] = 'secret'
|
||||
@@ -1860,7 +1867,7 @@ def test_file_check_turn_registry_binds_run_without_http_turn_id(app, client, mo
|
||||
) == run_id
|
||||
|
||||
chat_log_id = None
|
||||
from app.services.dify import DifyService
|
||||
from app.services.integrations.dify import DifyService
|
||||
|
||||
result = DifyService._persist_stream_chat_record(
|
||||
data={'conversation_id': 'sess-registry-001'},
|
||||
@@ -1998,7 +2005,10 @@ def _stub_file_check_thread(monkeypatch):
|
||||
def start(self):
|
||||
return None
|
||||
|
||||
monkeypatch.setattr('app.api.file_check_tools.threading.Thread', _Thread)
|
||||
def _enqueue(*_args, **_kwargs):
|
||||
return 1
|
||||
|
||||
monkeypatch.setattr('app.api.file_check_tools.enqueue', _enqueue)
|
||||
|
||||
|
||||
def _file_check_agent_proxy(task_id: int):
|
||||
@@ -2049,7 +2059,7 @@ def test_chat_tool_runs_tool_first_then_chat_log(app, client, monkeypatch):
|
||||
assert res.status_code == 200
|
||||
run_id = res.get_json()['run']['run_id']
|
||||
|
||||
from app.services.dify import DifyService
|
||||
from app.services.integrations.dify import DifyService
|
||||
|
||||
with app.app_context():
|
||||
result = DifyService._persist_stream_chat_record(
|
||||
@@ -2094,7 +2104,7 @@ def test_chat_tool_runs_chat_log_first_then_tool(app, client, monkeypatch):
|
||||
admin_id = admin.id
|
||||
|
||||
from app.services.file_check_tools.chat_tool_run_binding import register_pending_turn
|
||||
from app.services.dify import DifyService
|
||||
from app.services.integrations.dify import DifyService
|
||||
|
||||
with app.app_context():
|
||||
register_pending_turn(
|
||||
@@ -2219,7 +2229,7 @@ def test_chat_tool_runs_same_message_does_not_cross_runs(app, client, monkeypatc
|
||||
run_b = res_b.get_json()['run']['run_id']
|
||||
assert run_b == run_a
|
||||
|
||||
from app.services.dify import DifyService
|
||||
from app.services.integrations.dify import DifyService
|
||||
|
||||
with app.app_context():
|
||||
result_b = DifyService._persist_stream_chat_record(
|
||||
@@ -2279,7 +2289,7 @@ def test_chat_tool_runs_without_turn_id_same_message_skips_ambiguous_bind(app, c
|
||||
from app.models import ChatToolRun
|
||||
from app.services.file_check_tools.chat_tool_run_binding import register_pending_turn
|
||||
from app.services.file_check_tools.chat_turn_registry import clear_registry_for_tests
|
||||
from app.services.dify import DifyService
|
||||
from app.services.integrations.dify import DifyService
|
||||
|
||||
with app.app_context():
|
||||
register_pending_turn(
|
||||
|
||||
Reference in new issue
Block a user