main
HuangHai 5 months ago
parent c2b2fb715a
commit 02f5ac24b8

@ -24,3 +24,7 @@ DEFAULT_OUTPUT_DIR = mdWorkingPath / 'output' # 使用 / 运算符
# 请在Config.py中配置以下参数
NEO4J_URI = "neo4j://10.10.21.20:7687"
NEO4J_AUTH = ("neo4j", "DsideaL4r5t6y7u")
# Dify
DIFY_API_KEY = "app-E0r9SOtMQ14P9OHrPCbIHvJ5"
DIFY_URL='http://10.10.14.207/v1'

@ -1,10 +1,11 @@
import requests
import json
from Config import *
# Dify API 配置
url = "http://10.10.14.207/v1/chat-messages"
url = DIFY_URL + "/chat-messages"
headers = {
'Authorization': 'Bearer app-E0r9SOtMQ14P9OHrPCbIHvJ5',
'Authorization': 'Bearer ' + DIFY_API_KEY,
'Content-Type': 'application/json'
}
@ -40,4 +41,4 @@ try:
pass # 忽略解析错误
except requests.exceptions.RequestException as e:
print("请求失败:", e)
print("请求失败:", e)

@ -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'])
Loading…
Cancel
Save