3.31 上传 dm rewrite
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
"""
|
||||
===================================
|
||||
@Auther:WenZ
|
||||
@Company: BooWay
|
||||
@project:dify_lab
|
||||
===================================
|
||||
"""
|
||||
|
||||
import requests
|
||||
import json
|
||||
|
||||
import urllib3
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
|
||||
def info_input(input_str):
|
||||
|
||||
# API 端点
|
||||
url = "https://172.20.0.145/v1/chat-messages"
|
||||
|
||||
# 确保 API Key 正确(去掉大括号)
|
||||
api_key = "app-ziMDuhVoATbd5vF3Lb7iyjVD"
|
||||
|
||||
# 认证信息
|
||||
headers = {
|
||||
"Authorization": f"Bearer {api_key}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
# 请求数据
|
||||
payload = {
|
||||
"inputs": {},
|
||||
"query": "",
|
||||
"response_mode": "blocking",
|
||||
"conversation_id": "",
|
||||
"user": "abc-123",
|
||||
"files": [
|
||||
{
|
||||
"type": "image",
|
||||
"transfer_method": "remote_url",
|
||||
"url": "https://cloud.dify.ai/logo/logo-site.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
payload["query"] = input_str
|
||||
|
||||
# 发送 POST 请求
|
||||
response = requests.post(url, headers=headers, data=json.dumps(payload), verify=False) # verify=False 忽略 SSL 证书验证
|
||||
|
||||
response_dict = json.loads(response.text)
|
||||
|
||||
return response_dict['conversation_id']
|
||||
|
||||
# print(info_input("多个工程需要统一修改定额中材料的单价是否可以呢"))
|
||||
# print(info_input("多个工程需要统一修改定额中材料的单价是否可以呢"))
|
||||
Reference in New Issue
Block a user