parent
27c8912dfb
commit
8e335093b1
@ -0,0 +1,29 @@
|
|||||||
|
import json
|
||||||
|
import requests
|
||||||
|
from Config import *
|
||||||
|
|
||||||
|
# 消息ID
|
||||||
|
message_id = '18b68391-e4ae-4bfb-b141-bf84f108da30'
|
||||||
|
|
||||||
|
# Dify API 配置
|
||||||
|
url = DIFY_URL + "/messages/" + message_id + "/feedbacks"
|
||||||
|
headers = {
|
||||||
|
'Authorization': 'Bearer ' + DIFY_API_KEY,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
|
||||||
|
# 请求数据
|
||||||
|
payload = {
|
||||||
|
"rating": "like",
|
||||||
|
"user": "abc-123",
|
||||||
|
"content": "message feedback information"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 发送 POST 请求
|
||||||
|
response = requests.post(url, headers=headers, data=json.dumps(payload))
|
||||||
|
response.raise_for_status() # 检查请求是否成功
|
||||||
|
|
||||||
|
# 解析并打印响应
|
||||||
|
json_data = response.json()
|
||||||
|
print(json.dumps(json_data, indent=2, ensure_ascii=False))
|
||||||
|
|
Loading…
Reference in new issue