mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-05-06 08:26:45 -03:00
fix(civitai): support civitai.red URLs (#897)
This commit is contained in:
@@ -635,6 +635,39 @@ async def test_import_remote_video_recipe(monkeypatch, tmp_path: Path) -> None:
|
||||
assert call["extension"] == ".mp4"
|
||||
|
||||
|
||||
async def test_import_remote_recipe_supports_civitai_red(monkeypatch, tmp_path: Path) -> None:
|
||||
async def fake_get_default_metadata_provider():
|
||||
return SimpleNamespace(get_model_version_info=lambda id: ({}, None))
|
||||
|
||||
monkeypatch.setattr(
|
||||
"py.recipes.enrichment.get_default_metadata_provider",
|
||||
fake_get_default_metadata_provider,
|
||||
)
|
||||
|
||||
async with recipe_harness(monkeypatch, tmp_path) as harness:
|
||||
harness.civitai.image_info["126920345"] = {
|
||||
"id": 126920345,
|
||||
"url": "https://image.civitai.com/x/y/original=true/sample.jpeg",
|
||||
"type": "image",
|
||||
}
|
||||
|
||||
response = await harness.client.get(
|
||||
"/api/lm/recipes/import-remote",
|
||||
params={
|
||||
"image_url": "https://civitai.red/images/126920345",
|
||||
"name": "Red Recipe",
|
||||
"resources": json.dumps([]),
|
||||
"base_model": "Flux",
|
||||
},
|
||||
)
|
||||
|
||||
payload = await response.json()
|
||||
assert response.status == 200
|
||||
assert payload["success"] is True
|
||||
assert harness.downloader.urls
|
||||
assert "width=450,optimized=true" in harness.downloader.urls[0]
|
||||
|
||||
|
||||
async def test_analyze_uploaded_image_error_path(monkeypatch, tmp_path: Path) -> None:
|
||||
async with recipe_harness(monkeypatch, tmp_path) as harness:
|
||||
harness.analysis.raise_for_uploaded = RecipeValidationError(
|
||||
|
||||
Reference in New Issue
Block a user