mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-16 06:16:53 +08:00
Fix : Workflow "start" paste url not support s3 pre-signed URL (#6855)
Co-authored-by: Yuanbo Li <ybalbert@amazon.com>
This commit is contained in:
@@ -379,8 +379,12 @@ class BedrockLargeLanguageModel(LargeLanguageModel):
|
||||
if not message_content.data.startswith("data:"):
|
||||
# fetch image data from url
|
||||
try:
|
||||
image_content = requests.get(message_content.data).content
|
||||
mime_type, _ = mimetypes.guess_type(message_content.data)
|
||||
url = message_content.data
|
||||
image_content = requests.get(url).content
|
||||
if '?' in url:
|
||||
url = url.split('?')[0]
|
||||
mime_type, _ = mimetypes.guess_type(url)
|
||||
base64_data = base64.b64encode(image_content).decode('utf-8')
|
||||
except Exception as ex:
|
||||
raise ValueError(f"Failed to fetch image data from url {message_content.data}, {ex}")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user