parent
c2b2fb715a
commit
02f5ac24b8
@ -1,10 +1,11 @@
|
|||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
|
from Config import *
|
||||||
|
|
||||||
# Dify API 配置
|
# Dify API 配置
|
||||||
url = "http://10.10.14.207/v1/chat-messages"
|
url = DIFY_URL + "/chat-messages"
|
||||||
headers = {
|
headers = {
|
||||||
'Authorization': 'Bearer app-E0r9SOtMQ14P9OHrPCbIHvJ5',
|
'Authorization': 'Bearer ' + DIFY_API_KEY,
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
from Config import *
|
||||||
|
|
||||||
|
url = DIFY_URL + "/files/upload"
|
||||||
|
|
||||||
|
payload = {'user': 'abc-123'}
|
||||||
|
files = [
|
||||||
|
('file', ('1.png', open(r'D:\KeCheng\BaiHu\TestImage\1.png', 'rb'), 'image/png'))
|
||||||
|
]
|
||||||
|
headers = {
|
||||||
|
'Authorization': 'Bearer ' + DIFY_API_KEY
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.request("POST", url, headers=headers, data=payload, files=files)
|
||||||
|
|
||||||
|
json_data = json.loads(response.text)
|
||||||
|
print(json_data)
|
||||||
|
print(json_data['id'])
|
Binary file not shown.
Loading…
Reference in new issue