Spaces:
Sleeping
Sleeping
File size: 1,457 Bytes
e28d550 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
from tianshu import AiHelperClient, generate_serial_number
def get_tianshu_response(params):
# 请求地址
base_url = "https://api-aihelper.sheincorp.cn"
# 流水号,非必填,请求幂等处理,方便后续请求跟踪
out_id = generate_serial_number()
# 应用秘钥,必填
app_secret = "120a6f8685f8652ace71f7a2b0f2d395"
# 应用id,必填
scene_id = 7180
# 业务编码,对应系统编码或工号,必填
biz_code = "10270178"
# 构建请求客户端
client = AiHelperClient(base_url, app_secret, scene_id)
# 构建请求参数
# params = {"HOA_USERINPUT": "在线表格可以 @人吗"}
response = client.post("/open/v1/chat", {
# "out_id": out_id,
"scene_id": scene_id,
"biz_code": biz_code,
"params": params
})
result = response["info"].get("info")
return result
# if response is not None:
# result = response["info"].get("info")
# try:
# json_result = json.loads(result)
# print(json_result["类别"])
# print(json_result["模块"])
# except json.JSONDecodeError:
# print("not json!")
# else:
# print("request error!")
params = {"question": "SDOC的表格,我已经建了个在线表格,我要插入一个本地EX表,从企微文档迁移过来是在的,但我在上面操作,上传不了新的"}
get_tianshu_response(params) |