sync update from LAN repo (source master-yx @ cf505220)
This commit is contained in:
1 parent
e243ec3a46
commit
19d3cb96dc
114 files changed
+14787
-451
No files matched your search
@@ -375,8 +375,10 @@ async def test_admin_can_upload_and_activate_offline_encoder(monkeypatch, tmp_pa
|
||||
class Embedding:
|
||||
def __init__(self):
|
||||
self.model_path = ""
|
||||
self.reset_calls = 0
|
||||
|
||||
async def reset_local_encoder(self, *, model_path=None):
|
||||
self.reset_calls += 1
|
||||
if model_path is not None:
|
||||
self.model_path = model_path
|
||||
|
||||
@@ -395,6 +397,17 @@ async def test_admin_can_upload_and_activate_offline_encoder(monkeypatch, tmp_pa
|
||||
monkeypatch.setattr(llmwiki_index, "load_system_settings", SystemSettings)
|
||||
monkeypatch.setattr(llmwiki_index, "save_system_settings", lambda value: saved.append(value) or value)
|
||||
embedding = Embedding()
|
||||
|
||||
async def rebuild(_app, *, force=False):
|
||||
assert force is True
|
||||
embedding.model_path = saved[-1].local_wiki_encoder.model_path
|
||||
|
||||
monkeypatch.setattr(llmwiki_index, "rebuild_local_wiki_index_runtime", rebuild)
|
||||
monkeypatch.setattr(
|
||||
llmwiki_index,
|
||||
"local_encoder_runtime_status",
|
||||
lambda _app: embedding.local_encoder_status(),
|
||||
)
|
||||
app = FastAPI()
|
||||
app.state.config = SimpleNamespace(
|
||||
llmwiki=SimpleNamespace(
|
||||
@@ -414,11 +427,15 @@ async def test_admin_can_upload_and_activate_offline_encoder(monkeypatch, tmp_pa
|
||||
paths=["onnx/model.onnx", "config.json"],
|
||||
)
|
||||
|
||||
active = tmp_path / "models" / "bge-m3"
|
||||
revision = saved[-1].local_wiki_encoder.model_revision
|
||||
active = tmp_path / "models" / "bge-m3-revisions" / revision
|
||||
assert (active / "onnx" / "model.onnx").read_bytes() == b"onnx"
|
||||
assert result["uploaded_files"] == 2
|
||||
assert saved[-1].local_wiki_encoder.model_path == str(active.resolve())
|
||||
assert saved[-1].local_wiki_encoder.mode == "local"
|
||||
assert revision
|
||||
assert embedding.model_path == str(active.resolve())
|
||||
assert embedding.reset_calls == 0
|
||||
|
||||
|
||||
def test_encoder_upload_rejects_parent_traversal():
|
||||
|
||||
Reference in new issue
Block a user