mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-13 22:20:58 +00:00
fix: Fix the file URL processing logic to support complete URLs (#1950)
This commit is contained in:
@@ -289,6 +289,10 @@ class DifyServiceAPIRunner(runner.RequestRunner):
|
|||||||
yield msg
|
yield msg
|
||||||
if chunk['event'] == 'message_file':
|
if chunk['event'] == 'message_file':
|
||||||
if chunk['type'] == 'image' and chunk['belongs_to'] == 'assistant':
|
if chunk['type'] == 'image' and chunk['belongs_to'] == 'assistant':
|
||||||
|
# 检查URL是否已经是完整的连接
|
||||||
|
if chunk['url'].startswith('http://') or chunk['url'].startswith('https://'):
|
||||||
|
image_url = chunk['url']
|
||||||
|
else:
|
||||||
base_url = self.dify_client.base_url
|
base_url = self.dify_client.base_url
|
||||||
|
|
||||||
if base_url.endswith('/v1'):
|
if base_url.endswith('/v1'):
|
||||||
@@ -559,6 +563,10 @@ class DifyServiceAPIRunner(runner.RequestRunner):
|
|||||||
if chunk['event'] == 'message_file':
|
if chunk['event'] == 'message_file':
|
||||||
message_idx += 1
|
message_idx += 1
|
||||||
if chunk['type'] == 'image' and chunk['belongs_to'] == 'assistant':
|
if chunk['type'] == 'image' and chunk['belongs_to'] == 'assistant':
|
||||||
|
# 检查URL是否已经是完整的连接
|
||||||
|
if chunk['url'].startswith('http://') or chunk['url'].startswith('https://'):
|
||||||
|
image_url = chunk['url']
|
||||||
|
else:
|
||||||
base_url = self.dify_client.base_url
|
base_url = self.dify_client.base_url
|
||||||
|
|
||||||
if base_url.endswith('/v1'):
|
if base_url.endswith('/v1'):
|
||||||
|
|||||||
Reference in New Issue
Block a user