Delay index generation message until toggle tag is triggered

pull/77/head
zanllp 2023-05-03 23:19:23 +08:00
parent 74c7590f46
commit 5ef09be155
1 changed files with 8 additions and 6 deletions

View File

@ -373,12 +373,7 @@ def infinite_image_browsing_api(_: Any, app: FastAPI, **kwargs):
img = DbImg.get(conn, path)
if not img:
if DbImg.count(conn) == 0:
raise HTTPException(
400,
"你需要先通过图像搜索页生成索引"
if locale == "zh"
else "You need to generate an index through the image search page first.",
)
return []
update_image_data([os.path.dirname(path)])
img = DbImg.get(conn, path)
assert img
@ -401,6 +396,13 @@ def infinite_image_browsing_api(_: Any, app: FastAPI, **kwargs):
else "Tag toggleing is not supported outside the Stable Diffusion webui folder. Please open an issue if you have any questions.",
)
img = DbImg.get(conn, path)
if not img:
raise HTTPException(
400,
"你需要先通过图像搜索页生成索引"
if locale == "zh"
else "You need to generate an index through the image search page first.",
)
tags = ImageTag.get_tags_for_image(
conn=conn, image_id=img.id, type="custom", tag_id=req.tag_id
)