Feat: v0.27.0 model provider (#16604)

This commit is contained in:
Lynn
2026-07-08 09:47:29 +08:00
committed by GitHub
parent cb93883f3f
commit 0ae5961e1c
94 changed files with 7539 additions and 3044 deletions

View File

@@ -45,7 +45,7 @@ class _AwaitableValue:
class _DummyKB:
def __init__(self, tenant_id="tenant-1", embd_id="embd-1", tenant_embd_id=1):
def __init__(self, tenant_id="tenant-1", embd_id="embd-1", tenant_embd_id="tm-embd-1"):
self.tenant_id = tenant_id
self.embd_id = embd_id
self.tenant_embd_id = tenant_embd_id
@@ -221,7 +221,7 @@ def _load_dify_retrieval_module(monkeypatch):
}
def _get_model_config_by_id(
tenant_model_id: int,
tenant_model_id: str,
allowed_tenant_ids=None,
requester_tenant_id=None,
) -> dict:

View File

@@ -447,7 +447,7 @@ def _load_doc_module(monkeypatch, module_basename="chunk_api"):
}
def _get_model_config_by_id(
tenant_model_id: int,
tenant_model_id: str,
allowed_tenant_ids=None,
requester_tenant_id=None,
) -> dict:
@@ -989,7 +989,7 @@ class TestDocRoutesUnit:
monkeypatch.setattr(module.rag_tokenizer, "fine_grained_tokenize", lambda text: text or "")
monkeypatch.setattr(module.rag_tokenizer, "is_chinese", lambda _text: False)
monkeypatch.setattr(module.DocumentService, "get_embd_id", lambda _doc_id: "embd")
monkeypatch.setattr(module.DocumentService, "get_tenant_embd_id", lambda _doc_id: 1)
monkeypatch.setattr(module.DocumentService, "get_tenant_embd_id", lambda _doc_id: "tm-embd-1")
class _EmbedModel:
def encode(self, _texts):
@@ -1079,8 +1079,8 @@ class TestDocRoutesUnit:
"get_request_json",
lambda: _AwaitableValue({"dataset_ids": ["ds-1"], "question": "q", "highlight": "True"}),
)
monkeypatch.setattr(module.KnowledgebaseService, "get_by_ids", lambda _ids: [SimpleNamespace(embd_id="m1", tenant_id="tenant-1", tenant_embd_id=1)])
monkeypatch.setattr(module.KnowledgebaseService, "get_by_id", lambda _id: (True, SimpleNamespace(tenant_id="tenant-1", embd_id="m1", tenant_embd_id=1)))
monkeypatch.setattr(module.KnowledgebaseService, "get_by_ids", lambda _ids: [SimpleNamespace(embd_id="m1", tenant_id="tenant-1", tenant_embd_id="tm-embd-1")])
monkeypatch.setattr(module.KnowledgebaseService, "get_by_id", lambda _id: (True, SimpleNamespace(tenant_id="tenant-1", embd_id="m1", tenant_embd_id="tm-embd-1")))
class _Retriever:
async def retrieval(self, *_args, **_kwargs):
@@ -1203,7 +1203,7 @@ class TestDocRoutesUnit:
}
),
)
monkeypatch.setattr(module.KnowledgebaseService, "get_by_id", lambda _id: (True, SimpleNamespace(tenant_id="tenant-1", embd_id="m1", tenant_embd_id=1)))
monkeypatch.setattr(module.KnowledgebaseService, "get_by_id", lambda _id: (True, SimpleNamespace(tenant_id="tenant-1", embd_id="m1", tenant_embd_id="tm-embd-1")))
monkeypatch.setattr(module, "cross_languages", _cross_languages)
monkeypatch.setattr(module, "keyword_extraction", _keyword_extraction)
monkeypatch.setattr(module.settings, "retriever", _FeatureRetriever())

View File

@@ -455,7 +455,7 @@ def _load_session_module(monkeypatch):
}
def _get_model_config_by_id(
tenant_model_id: int,
tenant_model_id: str,
allowed_tenant_ids=None,
requester_tenant_id=None,
) -> dict: