Add ability to remove image from wi

This commit is contained in:
somebody
2022-11-25 22:26:28 -06:00
parent 45b24dfd9b
commit f6d3349b56

View File

@@ -8823,7 +8823,14 @@ def UI_2_set_wi_image(uid):
"", "",
) )
koboldai_vars.worldinfo_v2.image_store[str(uid)] = request.get_data(as_text=True) uid = str(uid)
data = request.get_data(as_text=True)
if not data and uid in koboldai_vars.worldinfo_v2.image_store:
# Delete if sent null image
del koboldai_vars.worldinfo_v2.image_store[uid]
else:
# Otherwise assign image
koboldai_vars.worldinfo_v2.image_store[uid] = data
return ":)" return ":)"
@app.route("/get_wi_image/<int(signed=True):uid>", methods=["GET"]) @app.route("/get_wi_image/<int(signed=True):uid>", methods=["GET"])