You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
696 B
26 lines
696 B
import json
|
|
import requests
|
|
from Config import *
|
|
|
|
# 会话ID
|
|
conversation_id = '37a742e4-013d-4466-8a5e-fe64bb3b4e1d'
|
|
|
|
# Dify API 配置
|
|
url = DIFY_URL + "/conversations/" + conversation_id
|
|
headers = {
|
|
'Authorization': 'Bearer ' + DIFY_API_KEY,
|
|
'Content-Type': 'application/json'
|
|
}
|
|
|
|
# 请求体数据
|
|
data = {
|
|
'user': 'abc-123' # 用户标识,需与发送消息接口保持一致
|
|
}
|
|
|
|
# 发送 DELETE 请求
|
|
response = requests.delete(url, headers=headers, json=data)
|
|
response.raise_for_status() # 检查请求是否成功
|
|
|
|
# 解析并打印响应
|
|
json_data = response.json()
|
|
print("删除会话成功:", json.dumps(json_data, indent=2, ensure_ascii=False)) |