mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 09:56:06 +08:00
fix: comfyui output image's format (#12121)
This commit is contained in:
parent
a3293b154e
commit
309fd76ddf
@ -125,7 +125,7 @@ class ComfyUiClient:
|
|||||||
for output in history["outputs"].values():
|
for output in history["outputs"].values():
|
||||||
for img in output.get("images", []):
|
for img in output.get("images", []):
|
||||||
image_data = self.get_image(img["filename"], img["subfolder"], img["type"])
|
image_data = self.get_image(img["filename"], img["subfolder"], img["type"])
|
||||||
images.append(image_data)
|
images.append((image_data, img["filename"]))
|
||||||
return images
|
return images
|
||||||
finally:
|
finally:
|
||||||
ws.close()
|
ws.close()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
|
import mimetypes
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from core.file import FileType
|
from core.file import FileType
|
||||||
@ -75,10 +76,12 @@ class ComfyUIWorkflowTool(BuiltinTool):
|
|||||||
|
|
||||||
images = comfyui.generate_image_by_prompt(prompt)
|
images = comfyui.generate_image_by_prompt(prompt)
|
||||||
result = []
|
result = []
|
||||||
for img in images:
|
for image_data, filename in images:
|
||||||
result.append(
|
result.append(
|
||||||
self.create_blob_message(
|
self.create_blob_message(
|
||||||
blob=img, meta={"mime_type": "image/png"}, save_as=self.VariableKey.IMAGE.value
|
blob=image_data,
|
||||||
|
meta={"mime_type": mimetypes.guess_type(filename)[0]},
|
||||||
|
save_as=self.VariableKey.IMAGE.value,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
|
Loading…
x
Reference in New Issue
Block a user