revert: remove Hugging Face model integration

This commit is contained in:
Hermes Agent
2026-08-28 19:30:35 +10:00
parent bc47cf8152
commit 309947d353
7 changed files with 9 additions and 423 deletions
-74
View File
@@ -89,80 +89,6 @@ class ValidationHarnessTests(unittest.TestCase):
self.assertEqual(response, {"jobs": active})
listed.assert_called_once_with(active_only=True, conversation_id="conversation", limit=20)
def test_huggingface_search_normalizes_public_model_metadata(self):
with patch.object(
api,
"_json_list_request",
return_value=[
{
"id": "Qwen/Qwen3.8-Flash-Next",
"downloads": 4810,
"likes": 3966,
"pipeline_tag": "image-text-to-text",
"library_name": "transformers",
"lastModified": "2026-08-27T00:00:00.000Z",
"sha": "abc123",
"tags": ["qwen", "conversational"],
}
],
):
results = api._search_huggingface("Qwen3.8-Flash-Next", limit=10)
self.assertEqual(len(results), 1)
model = results[0]
self.assertEqual(model["name"], "Qwen/Qwen3.8-Flash-Next")
self.assertEqual(model["source"], "huggingface")
self.assertEqual(model["hf_url"], "https://huggingface.co/Qwen/Qwen3.8-Flash-Next")
self.assertIn("vision", model["capabilities"])
self.assertFalse(model["downloadable"])
def test_catalog_search_combines_ollama_and_huggingface_sources(self):
ollama = [{"name": "qwen3.8:latest", "source": "catalog"}]
huggingface = [{"name": "Qwen/Qwen3.8-Flash-Next", "source": "huggingface"}]
with patch.object(api, "_search_ollama_catalog", return_value=ollama) as ollama_search, patch.object(
api, "_search_huggingface", return_value=huggingface
) as hf_search:
response = api.catalog_search("Qwen3.8", limit=10, include_huggingface=True)
self.assertEqual(response["results"], ollama + huggingface)
self.assertEqual(response["sources"], ["ollama", "huggingface"])
ollama_search.assert_called_once_with("Qwen3.8", limit=10)
hf_search.assert_called_once_with("Qwen3.8", limit=10)
def test_huggingface_groups_split_gguf_files_into_complete_sets(self):
metadata = {
"siblings": [
{"rfilename": "Q4/Qwen-00001-of-00002.gguf"},
{"rfilename": "Q4/Qwen-00002-of-00002.gguf"},
{"rfilename": "Q8/Qwen.gguf"},
{"rfilename": "Q8/README.md"},
]
}
with patch.object(api, "_json_request", return_value=metadata):
files = api._huggingface_repo_files("owner/repository")
self.assertEqual(len(files), 2)
split = next(item for item in files if item["split"])
self.assertEqual(split["file_count"], 2)
self.assertEqual(len(split["filenames"]), 2)
single = next(item for item in files if not item["split"])
self.assertEqual(single["filename"], "Q8/Qwen.gguf")
def test_huggingface_download_rejects_non_gguf_paths(self):
with self.assertRaises(api.HTTPException):
api._valid_huggingface_filename("../model.safetensors")
with self.assertRaises(api.HTTPException):
api._valid_huggingface_filename("model.bin")
self.assertEqual(api._valid_huggingface_filename("Q4_K_M/model.gguf"), "Q4_K_M/model.gguf")
def test_huggingface_download_queues_validated_file(self):
body = api.HuggingFaceDownloadRequest(repo_id="unsloth/Qwen3.8-Flash-Next-GGUF", filename="Q4_K_M/model.gguf")
fake_thread = type("Thread", (), {"start": lambda self: None})
with patch.object(api, "_huggingface_repo_files", return_value=[{"filename": body.filename, "size": 123}]), patch.object(
api.threading, "Thread", return_value=fake_thread()
) as thread:
response = api.huggingface_download(body)
self.assertTrue(response["ok"])
self.assertEqual(response["filename"], body.filename)
thread.assert_called_once()
def test_primary_draft_validators_and_primary_compilation_produce_one_answer(self):
body = api.ChatRequest(
primary_model="primary",