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