尝试dify读取图片!
This commit is contained in:
@@ -395,12 +395,13 @@ class DifyPlugin(MessagePluginInterface):
|
||||
form.add_field("file", f, filename=os.path.basename(file_path))
|
||||
form.add_field("user", user_id)
|
||||
response = await session.post(url, headers=headers, data=form, proxy=proxy, timeout=40)
|
||||
if response.status != 200:
|
||||
if response.status not in (200, 201):
|
||||
error_text = await response.text()
|
||||
self.LOG.error(f"Dify上传失败: {response.status} {error_text}")
|
||||
return None
|
||||
|
||||
resp_data = await response.json()
|
||||
self.LOG.debug(f"Dify上传成功: status={response.status}, keys={list(resp_data.keys())}")
|
||||
|
||||
if isinstance(resp_data, dict):
|
||||
if resp_data.get("id"):
|
||||
|
||||
Reference in New Issue
Block a user