fix: correct model type mappings and improve system setting persistence (#16501)

This commit is contained in:
euvre
2026-07-13 16:42:55 +08:00
committed by GitHub
parent d35e957252
commit 3bfad1f00e
44 changed files with 238 additions and 150 deletions

View File

@@ -214,8 +214,8 @@ def _load_chunk_module(monkeypatch):
EMBEDDING = SimpleNamespace(value="embedding")
CHAT = SimpleNamespace(value="chat")
RERANK = SimpleNamespace(value="rerank")
SPEECH2TEXT = SimpleNamespace(value="speech2text")
IMAGE2TEXT = SimpleNamespace(value="image2text")
ASR = SimpleNamespace(value="asr")
VISION = SimpleNamespace(value="vision")
TTS = SimpleNamespace(value="tts")
OCR = SimpleNamespace(value="ocr")

View File

@@ -218,8 +218,8 @@ def _load_llm_app(monkeypatch):
constants_mod.LLMType = SimpleNamespace(
CHAT=_StrEnum("chat"),
EMBEDDING=_StrEnum("embedding"),
SPEECH2TEXT=_StrEnum("speech2text"),
IMAGE2TEXT=_StrEnum("image2text"),
ASR=_StrEnum("asr"),
VISION=_StrEnum("vision"),
RERANK=_StrEnum("rerank"),
TTS=_StrEnum("tts"),
OCR=_StrEnum("ocr"),
@@ -819,7 +819,7 @@ def test_add_llm_model_type_probe_and_persistence_matrix_unit(monkeypatch):
assert res["code"] == 0
assert "Fail to access model(FRFail/m)." in res["data"]["message"]
res = _call({"llm_factory": "FImgFail", "llm_name": "m", "model_type": module.LLMType.IMAGE2TEXT.value, "verify": True})
res = _call({"llm_factory": "FImgFail", "llm_name": "m", "model_type": module.LLMType.VISION.value, "verify": True})
assert res["code"] == 0
assert "Fail to access model(FImgFail/m)." in res["data"]["message"]
@@ -831,7 +831,7 @@ def test_add_llm_model_type_probe_and_persistence_matrix_unit(monkeypatch):
assert res["code"] == 0
assert "Fail to access model(FOcrFail/m)." in res["data"]["message"]
res = _call({"llm_factory": "FSttFail", "llm_name": "m", "model_type": module.LLMType.SPEECH2TEXT.value, "verify": True})
res = _call({"llm_factory": "FSttFail", "llm_name": "m", "model_type": module.LLMType.ASR.value, "verify": True})
assert res["code"] == 0
assert "Fail to access model(FSttFail/m)." in res["data"]["message"]

View File

@@ -375,7 +375,7 @@ def _load_user_app(monkeypatch):
settings_mod.EMBEDDING_MDL = "embd-mdl"
settings_mod.ASR_MDL = "asr-mdl"
settings_mod.PARSERS = []
settings_mod.IMAGE2TEXT_MDL = "img-mdl"
settings_mod.VISION_MDL = "img-mdl"
settings_mod.RERANK_MDL = "rerank-mdl"
settings_mod.REGISTER_ENABLED = True
monkeypatch.setitem(sys.modules, "common.settings", settings_mod)