itam-assistant 0.1.11__py3-none-any.whl → 0.1.12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- itam_assistant/do_ai.py +176 -104
- itam_assistant/openapi.py +135 -2
- {itam_assistant-0.1.11.dist-info → itam_assistant-0.1.12.dist-info}/METADATA +2 -2
- itam_assistant-0.1.12.dist-info/RECORD +13 -0
- it_assistant/__init__.py +0 -0
- it_assistant/ailyapp_client.py +0 -129
- it_assistant/config.py +0 -51
- it_assistant/do_ai.py +0 -928
- it_assistant/intent_detail.py +0 -289
- it_assistant/lark_client.py +0 -159
- it_assistant/logger.py +0 -53
- it_assistant/openapi.py +0 -687
- it_assistant/test.py +0 -1
- itam_assistant-0.1.11.dist-info/RECORD +0 -28
- main/__init__.py +0 -0
- main/ailyapp_client.py +0 -132
- main/do_ai.py +0 -177
- main/intent_detail.py +0 -326
- main/lark_client.py +0 -159
- main/logger.py +0 -53
- {itam_assistant-0.1.11.dist-info → itam_assistant-0.1.12.dist-info}/WHEEL +0 -0
- {itam_assistant-0.1.11.dist-info → itam_assistant-0.1.12.dist-info}/top_level.txt +0 -0
itam_assistant/do_ai.py
CHANGED
|
@@ -213,39 +213,61 @@ def do_waterlevellineres_listassetspu(res, info,hardtype):
|
|
|
213
213
|
info['label'] = [{'label': '', 'score': 0}]
|
|
214
214
|
info['rt'] = False
|
|
215
215
|
return info
|
|
216
|
-
if
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
info['
|
|
216
|
+
if hardtype != 100:
|
|
217
|
+
if res["data"].get("AiBorrowAndUseResponseList") == None:
|
|
218
|
+
info['label'] = [{'label': '', 'score': 0}, {'label': '', 'score': 0.8}]
|
|
219
|
+
info['rt'] = False
|
|
220
|
+
if info['exp'] == []:
|
|
221
|
+
info['rt'] = True
|
|
222
|
+
return info
|
|
223
|
+
reslist = res["data"]["AiBorrowAndUseResponseList"]
|
|
224
|
+
info['output']['用户输入/output'] = 'requestId:' + res['requestId']
|
|
225
|
+
aaa = {}
|
|
226
|
+
# 判断res["body"]["Results"]不为空,空则:label0 label1 为空,label默认2级
|
|
227
|
+
if reslist:
|
|
228
|
+
# 取["Results"]下前2个结果,若只有1个结果,label1为空
|
|
229
|
+
if len(reslist) > 0:
|
|
230
|
+
for j in range(len(reslist)):
|
|
231
|
+
if hardtype == 2:
|
|
232
|
+
aaa = {'label': reslist[j]['AccessoryModelScope']['AccessoryModelInfo']['Name']['ValueZh'],
|
|
233
|
+
'score': reslist[j]['Score']}
|
|
234
|
+
info['label'].append(copy.deepcopy(aaa))
|
|
235
|
+
if hardtype == 1:
|
|
236
|
+
aaa = {'label': reslist[j]['AssetModelScope']['SpuNameZh'] or reslist[j]['AssetModelScope'][
|
|
237
|
+
'NameZh'] + reslist[j]['AssetModelScope']['ModelZh'] + reslist[j]['AssetModelScope'][
|
|
238
|
+
'SpecificationZh'],
|
|
239
|
+
'score': reslist[j]['Score']}
|
|
240
|
+
info['label'].append(copy.deepcopy(aaa))
|
|
241
|
+
# 判断label0和label1是否为空,为空则:label默认2级
|
|
242
|
+
else:
|
|
243
|
+
info['label'] = [{'label': '', 'score': 0}, {'label': '', 'score': 0}]
|
|
244
|
+
info['rt'] = False
|
|
221
245
|
return info
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
# 取["Results"]下前2个结果,若只有1个结果,label1为空
|
|
228
|
-
if len(reslist) > 0:
|
|
229
|
-
for j in range(len(reslist)):
|
|
230
|
-
if hardtype==2:
|
|
231
|
-
aaa = {'label': reslist[j]['AccessoryModelScope']['AccessoryModelInfo']['Name']['ValueZh'],
|
|
232
|
-
'score': reslist[j]['Score']}
|
|
233
|
-
info['label'].append(copy.deepcopy(aaa))
|
|
234
|
-
if hardtype == 1:
|
|
235
|
-
aaa = {'label': reslist[j]['AssetModelScope']['SpuNameZh'] or reslist[j]['AssetModelScope']['NameZh']+reslist[j]['AssetModelScope']['ModelZh']+reslist[j]['AssetModelScope']['SpecificationZh'],
|
|
236
|
-
'score': reslist[j]['Score']}
|
|
237
|
-
info['label'].append(copy.deepcopy(aaa))
|
|
238
|
-
# 判断label0和label1是否为空,为空则:label默认2级
|
|
239
|
-
for a in range(len(info['exp'])):
|
|
240
|
-
if info['exp'][a]['label'] == info['label'][a]['label']:
|
|
246
|
+
elif hardtype == 100:
|
|
247
|
+
if res["data"].get("SoftwareApplyRecommendList") == None:
|
|
248
|
+
info['label'] = [{'label': '', 'score': 0}, {'label': '', 'score': 0.8}]
|
|
249
|
+
info['rt'] = False
|
|
250
|
+
if info['exp'] == []:
|
|
241
251
|
info['rt'] = True
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
252
|
+
return info
|
|
253
|
+
reslist = res["data"]["SoftwareApplyRecommendList"]
|
|
254
|
+
info['output']['用户输出/output'] = 'requestId:' + res['requestId']
|
|
255
|
+
aaa = {}
|
|
256
|
+
# 判断res["body"]["Results"]不为空,空则:label0 label1 为空,label默认2级
|
|
257
|
+
if reslist:
|
|
258
|
+
# 取["Results"]下前2个结果,若只有1个结果,label1为空
|
|
259
|
+
if len(reslist) > 0:
|
|
260
|
+
for j in range(len(reslist)):
|
|
261
|
+
aaa = {'label': reslist[j]['Data']['Name']['ValueZh'],
|
|
262
|
+
'score': reslist[j]['Score']}
|
|
263
|
+
info['label'].append(copy.deepcopy(aaa))
|
|
264
|
+
# 判断label0和label1是否为空,为空则:label默认2级
|
|
265
|
+
info['rt'] = do_businessassertionrules(info['label'], info['exp'])
|
|
266
|
+
else:
|
|
267
|
+
info['label'] = [{'label': '', 'score': 0}, {'label': '', 'score': 0}]
|
|
268
|
+
info['rt'] = False
|
|
269
|
+
return info
|
|
270
|
+
|
|
249
271
|
|
|
250
272
|
def do_waterlevellineres_listassetspu_pre(res, info,hardtype):
|
|
251
273
|
"""
|
|
@@ -303,7 +325,8 @@ def do_waterlevellineres_sr(res, info,hardtype):
|
|
|
303
325
|
if info['exp'][0]['label']=='':
|
|
304
326
|
info['rt'] = True
|
|
305
327
|
return info
|
|
306
|
-
reslist=res["data"]["AssetModels"]
|
|
328
|
+
# reslist=res["data"]["AssetModels"]
|
|
329
|
+
reslist = res["data"]["AiBorrowAndUseResponseList"]
|
|
307
330
|
aaa ={}
|
|
308
331
|
# 判断res["body"]["Results"]不为空,空则:label0 label1 为空,label默认2级
|
|
309
332
|
if reslist:
|
|
@@ -401,13 +424,13 @@ def do_scenereview_list(collections,data,score_threshold):
|
|
|
401
424
|
if i['content'] == j['用户输入/userInput']:
|
|
402
425
|
info['input']['用户输入/userInput'] = i['ext']['output']
|
|
403
426
|
info['output']['用户输入/output'] = j['用户输入/userInput']
|
|
404
|
-
if i['ext']['
|
|
427
|
+
if i['ext']['资产名称'] == j['llm关键词']:
|
|
405
428
|
info['rt'] = True
|
|
406
429
|
info['label'] = [{'label': str(j['llm关键词']), 'score': score_threshold}]
|
|
407
430
|
else:
|
|
408
431
|
info['rt'] = False
|
|
409
|
-
info['label'] = [{'label': str(i['ext']['
|
|
410
|
-
info['exp'] = [{'label': str(i['ext']['
|
|
432
|
+
info['label'] = [{'label': str(i['ext']['资产名称']), 'score': score_threshold}]
|
|
433
|
+
info['exp'] = [{'label': str(i['ext']['资产名称']), 'score': score_threshold}]
|
|
411
434
|
info['artificial'] = info['exp']
|
|
412
435
|
info_list.append(copy.deepcopy(info))
|
|
413
436
|
return info_list
|
|
@@ -433,15 +456,15 @@ def do_waterlevelline_autotest(collections, clientinfo, score_threshold):
|
|
|
433
456
|
}
|
|
434
457
|
a =0
|
|
435
458
|
for i in collections:
|
|
436
|
-
info['input']['用户输入/userInput'] = i['ext']['
|
|
437
|
-
info['output']['用户输入/output'] = i['ext']['
|
|
459
|
+
info['input']['用户输入/userInput'] = i['ext']['资产名称']
|
|
460
|
+
info['output']['用户输入/output'] = i['ext']['资产名称']
|
|
438
461
|
info['exp'] = []
|
|
439
|
-
for j in [i['ext']['
|
|
462
|
+
for j in [i['ext']['资产型号'], i['ext'].get('资产型号1'),i['ext'].get('资产型号2'),i['ext'].get('资产型号3'),i['ext'].get('资产型号4'),i['ext'].get('资产型号5'),i['ext'].get('资产型号6'),i['ext'].get('资产型号7'),i['ext'].get('资产型号8'),i['ext'].get('资产型号9'),i['ext'].get('资产型号10')]:
|
|
440
463
|
if j:
|
|
441
464
|
info['exp'].append({'label': j, 'score': score_threshold})
|
|
442
|
-
#判断i['ext']['
|
|
443
|
-
if i['ext']['
|
|
444
|
-
asset_name = i['ext']['
|
|
465
|
+
#判断i['ext']['资产型号']是否为空,为空就不用读取,不为空就读取
|
|
466
|
+
if i['ext']['资产型号']:
|
|
467
|
+
asset_name = i['ext']['资产名称']
|
|
445
468
|
try:
|
|
446
469
|
if isinstance(asset_name, str):
|
|
447
470
|
asset_name = json.loads(asset_name)
|
|
@@ -449,18 +472,18 @@ def do_waterlevelline_autotest(collections, clientinfo, score_threshold):
|
|
|
449
472
|
# 若解析失败,说明不是 JSON 格式,保持原样
|
|
450
473
|
pass
|
|
451
474
|
info['artificial'] = info['exp']
|
|
452
|
-
if i['ext']['
|
|
453
|
-
asset_name = i['ext']['
|
|
475
|
+
if i['ext']['资产名称']:
|
|
476
|
+
asset_name = i['ext']['资产名称']
|
|
454
477
|
try:
|
|
455
478
|
if isinstance(asset_name, str):
|
|
456
479
|
asset_name = json.loads(asset_name)
|
|
457
480
|
except json.JSONDecodeError:
|
|
458
481
|
# 若解析失败,说明不是 JSON 格式,保持原样
|
|
459
482
|
pass
|
|
460
|
-
if "软件申请" in i['ext']['
|
|
483
|
+
if "软件申请" in i['ext']['分发技能']:
|
|
461
484
|
keywprd = software_asset_sku_structure(asset_name)
|
|
462
485
|
res = json.loads(get_query_vector(keywprd, clientinfo))
|
|
463
|
-
if "设备/配件申请" in i['ext']['
|
|
486
|
+
if "设备/配件申请" in i['ext']['分发技能']:
|
|
464
487
|
#keywprd = equipmentrequest_structure(asset_name, i['ext']['asset_type'])
|
|
465
488
|
keywprd = {
|
|
466
489
|
"From": 0,
|
|
@@ -482,7 +505,7 @@ def do_waterlevelline_autotest(collections, clientinfo, score_threshold):
|
|
|
482
505
|
}
|
|
483
506
|
res = json.loads(get_query_vector(keywprd, clientinfo))
|
|
484
507
|
#res = get_by_AssetModelBizTypes(keywprd,res0)
|
|
485
|
-
if "设备/配件退还" in i['ext']['
|
|
508
|
+
if "设备/配件退还" in i['ext']['分发技能']:
|
|
486
509
|
keywprd = equipmentreturn_structure0(asset_name, i['ext']['asset_type'])
|
|
487
510
|
res0 = json.loads(get_query_vector(keywprd, clientinfo))
|
|
488
511
|
res = get_by_AssetModelBizTypes(keywprd, res0)
|
|
@@ -516,22 +539,21 @@ def do_waterlevelline_autotest_aseetspu(collections, clientinfo, score_threshold
|
|
|
516
539
|
}
|
|
517
540
|
a =0
|
|
518
541
|
for i in collections:
|
|
519
|
-
info['input']['用户输入/userInput'] = i['ext']['
|
|
520
|
-
info['output']['用户输入/output'] = i['ext']['
|
|
542
|
+
info['input']['用户输入/userInput'] = i['ext']['资产名称']
|
|
543
|
+
info['output']['用户输入/output'] = i['ext']['资产名称']
|
|
521
544
|
info['exp'] = []
|
|
522
|
-
for j in [i['ext']['
|
|
523
|
-
i['ext'].get('
|
|
524
|
-
i['ext'].get('
|
|
525
|
-
i['ext'].get('
|
|
526
|
-
i['ext'].get('
|
|
527
|
-
i['ext'].get('BPO标注-AP-资产型号10')]:
|
|
545
|
+
for j in [i['ext']['匹配型号1'], i['ext'].get('匹配型号2'),
|
|
546
|
+
i['ext'].get('匹配型号3'), i['ext'].get('匹配型号4'),
|
|
547
|
+
i['ext'].get('匹配型号5'), i['ext'].get('匹配型号6'),
|
|
548
|
+
i['ext'].get('匹配型号7'), i['ext'].get('匹配型号8'),
|
|
549
|
+
i['ext'].get('匹配型号9'), i['ext'].get('匹配型号10')]:
|
|
528
550
|
if j:
|
|
529
551
|
info['exp'].append({'label': j, 'score': score_threshold})
|
|
530
552
|
info['artificial'] = info['exp']
|
|
531
553
|
info['label']=[]
|
|
532
|
-
if i['ext']['
|
|
533
|
-
if "
|
|
534
|
-
asset_name = i['ext']['
|
|
554
|
+
if i['ext']['资产名称']:
|
|
555
|
+
if "设备&配件领用" in i['ext']['分发技能']:
|
|
556
|
+
asset_name = i['ext']['资产名称']
|
|
535
557
|
try:
|
|
536
558
|
# 尝试将其解析为 JSON 对象
|
|
537
559
|
if isinstance(asset_name, str):
|
|
@@ -541,11 +563,40 @@ def do_waterlevelline_autotest_aseetspu(collections, clientinfo, score_threshold
|
|
|
541
563
|
# 若解析失败,说明不是 JSON 格式,保持原样
|
|
542
564
|
pass
|
|
543
565
|
key = asset_name.get('asset_name') if isinstance(asset_name, dict) else asset_name
|
|
544
|
-
if i['ext']['
|
|
566
|
+
if i['ext']['资产类型'] == "设备":
|
|
545
567
|
hardtype = 1
|
|
546
|
-
elif i['ext']['
|
|
568
|
+
elif i['ext']['资产类型'] == "配件":
|
|
547
569
|
hardtype = 2
|
|
548
570
|
res = GetBestMatchItemonline(key,hardtype,clientinfo)
|
|
571
|
+
if "设备借用" in i['ext']['分发技能'] or "配件借用" in i['ext']['分发技能']:
|
|
572
|
+
asset_name = i['ext']['资产名称']
|
|
573
|
+
try:
|
|
574
|
+
# 尝试将其解析为 JSON 对象
|
|
575
|
+
if isinstance(asset_name, str):
|
|
576
|
+
asset_name0 = json.loads(asset_name)
|
|
577
|
+
asset_name = asset_name0['asset_name']
|
|
578
|
+
except json.JSONDecodeError:
|
|
579
|
+
# 若解析失败,说明不是 JSON 格式,保持原样
|
|
580
|
+
pass
|
|
581
|
+
key = asset_name.get('asset_name') if isinstance(asset_name, dict) else asset_name
|
|
582
|
+
if i['ext']['资产类型'] == "设备":
|
|
583
|
+
hardtype = 1
|
|
584
|
+
elif i['ext']['资产类型'] == "配件" or i['ext']['资产类型'] == '2.0' :
|
|
585
|
+
hardtype = 2
|
|
586
|
+
res = GetBestMatchItemonline_(key,hardtype,clientinfo)
|
|
587
|
+
if "软件申请" in i['ext']['分发技能']:
|
|
588
|
+
user_input_parts = [
|
|
589
|
+
"用户对话:"+i['ext'].get('用户输入', ''),
|
|
590
|
+
"资产名称:"+i['ext'].get('资产名称', ''),
|
|
591
|
+
"版本:"+i['ext'].get('版本', ''),
|
|
592
|
+
"用途:"+i['ext'].get('用途', '')
|
|
593
|
+
]
|
|
594
|
+
info['input']['用户输入/userInput'] = ','.join(filter(None, user_input_parts))
|
|
595
|
+
key = asset_name = i['ext'].get('资产名称')
|
|
596
|
+
Description = i['ext'].get('版本') + i['ext'].get('用途')
|
|
597
|
+
res = GetBestMatchItemonline_software(key, Description, clientinfo)
|
|
598
|
+
hardtype = 100
|
|
599
|
+
|
|
549
600
|
else:
|
|
550
601
|
res = ""
|
|
551
602
|
infoout = do_waterlevellineres_listassetspu(res, info,hardtype)
|
|
@@ -576,17 +627,17 @@ def do_waterlevelline_autotest_aseetspu_old(collections, clientinfo, score_thres
|
|
|
576
627
|
}
|
|
577
628
|
a =0
|
|
578
629
|
for i in collections:
|
|
579
|
-
info['input']['用户输入/userInput'] = i['ext']['
|
|
580
|
-
info['output']['用户输入/output'] = i['ext']['
|
|
630
|
+
info['input']['用户输入/userInput'] = i['ext']['资产名称']
|
|
631
|
+
info['output']['用户输入/output'] = i['ext']['资产名称']
|
|
581
632
|
info['exp'] = [
|
|
582
|
-
{'label': i['ext']['
|
|
583
|
-
{'label': i['ext'].get('
|
|
633
|
+
{'label': i['ext']['资产型号'], 'score': score_threshold},
|
|
634
|
+
{'label': i['ext'].get('资产型号1', ''), 'score': score_threshold}]
|
|
584
635
|
info['artificial'] = info['exp']
|
|
585
636
|
info['label']=[]
|
|
586
|
-
if i['ext']['
|
|
587
|
-
if "设备" in i['ext']['
|
|
588
|
-
asset_name = i['ext']['
|
|
589
|
-
asset_name = i['ext']['
|
|
637
|
+
if i['ext']['资产名称']:
|
|
638
|
+
if "设备" in i['ext']['分发技能'] or "配件" in i['ext']['分发技能']:
|
|
639
|
+
asset_name = i['ext']['资产名称']
|
|
640
|
+
asset_name = i['ext']['资产类型']
|
|
590
641
|
try:
|
|
591
642
|
# 尝试将其解析为 JSON 对象
|
|
592
643
|
if isinstance(asset_name, str):
|
|
@@ -595,9 +646,9 @@ def do_waterlevelline_autotest_aseetspu_old(collections, clientinfo, score_thres
|
|
|
595
646
|
# 若解析失败,说明不是 JSON 格式,保持原样
|
|
596
647
|
pass
|
|
597
648
|
key = asset_name.get('asset_name') if isinstance(asset_name, dict) else asset_name
|
|
598
|
-
if i['ext']['
|
|
649
|
+
if i['ext']['资产型号'] == "设备":
|
|
599
650
|
hardtype = 1
|
|
600
|
-
elif i['ext']['
|
|
651
|
+
elif i['ext']['资产型号'] == "配件" :
|
|
601
652
|
hardtype = 2
|
|
602
653
|
res = GetBestMatchItemonline_old(key,hardtype,clientinfo)
|
|
603
654
|
else:
|
|
@@ -631,17 +682,38 @@ def do_waterlevelline_autotest_aseetspu_pre(collections, clientinfo, score_thres
|
|
|
631
682
|
}
|
|
632
683
|
a =0
|
|
633
684
|
for i in collections:
|
|
634
|
-
info['input']['用户输入/userInput'] = i['ext']['
|
|
635
|
-
info['output']['用户输入/output'] = i['ext']['
|
|
636
|
-
info['exp'] = [
|
|
637
|
-
|
|
638
|
-
|
|
685
|
+
info['input']['用户输入/userInput'] = i['ext']['资产名称']
|
|
686
|
+
info['output']['用户输入/output'] = i['ext']['资产名称']
|
|
687
|
+
info['exp'] = []
|
|
688
|
+
for j in [i['ext']['匹配型号1'], i['ext'].get('匹配型号2'), i['ext'].get('匹配型号3'),
|
|
689
|
+
i['ext'].get('匹配型号4'), i['ext'].get('匹配型号5'), i['ext'].get('匹配型号6'),
|
|
690
|
+
i['ext'].get('匹配型号7'), i['ext'].get('匹配型号8'), i['ext'].get('匹配型号9'),
|
|
691
|
+
i['ext'].get('匹配型号10')]:
|
|
692
|
+
if j:
|
|
693
|
+
info['exp'].append({'label': j, 'score': score_threshold})
|
|
639
694
|
info['artificial'] = info['exp']
|
|
640
695
|
info['label']=[]
|
|
641
|
-
if i['ext']['
|
|
642
|
-
if "
|
|
643
|
-
asset_name = i['ext']['
|
|
644
|
-
asset_name = i['ext']['
|
|
696
|
+
if i['ext']['资产名称']:
|
|
697
|
+
if "设备&配件领用" in i['ext']['分发技能']:
|
|
698
|
+
asset_name = i['ext']['资产名称']
|
|
699
|
+
#asset_name = i['ext']['资产类型']
|
|
700
|
+
try:
|
|
701
|
+
# 尝试将其解析为 JSON 对象
|
|
702
|
+
if isinstance(asset_name, str):
|
|
703
|
+
asset_name = json.loads(asset_name)
|
|
704
|
+
except json.JSONDecodeError:
|
|
705
|
+
# 若解析失败,说明不是 JSON 格式,保持原样
|
|
706
|
+
pass
|
|
707
|
+
key = asset_name.get('asset_name') if isinstance(asset_name, dict) else asset_name
|
|
708
|
+
if i['ext']['资产类型'] == "设备":
|
|
709
|
+
hardtype = 1
|
|
710
|
+
elif i['ext']['资产类型'] == "配件" :
|
|
711
|
+
hardtype = 2
|
|
712
|
+
res = GetBestMatchItemoff(key,hardtype,clientinfo)
|
|
713
|
+
|
|
714
|
+
if "设备借用" in i['ext']['分发技能']:
|
|
715
|
+
asset_name = i['ext']['资产名称']
|
|
716
|
+
#asset_name = i['ext']['资产类型']
|
|
645
717
|
try:
|
|
646
718
|
# 尝试将其解析为 JSON 对象
|
|
647
719
|
if isinstance(asset_name, str):
|
|
@@ -650,14 +722,14 @@ def do_waterlevelline_autotest_aseetspu_pre(collections, clientinfo, score_thres
|
|
|
650
722
|
# 若解析失败,说明不是 JSON 格式,保持原样
|
|
651
723
|
pass
|
|
652
724
|
key = asset_name.get('asset_name') if isinstance(asset_name, dict) else asset_name
|
|
653
|
-
if i['ext']['
|
|
725
|
+
if i['ext']['资产类型'] == "设备":
|
|
654
726
|
hardtype = 1
|
|
655
|
-
elif i['ext']['
|
|
727
|
+
elif i['ext']['资产类型'] == "配件" :
|
|
656
728
|
hardtype = 2
|
|
657
|
-
res =
|
|
729
|
+
res = GetBestMatchItemoff0(key,hardtype,clientinfo)
|
|
658
730
|
else:
|
|
659
731
|
res = ""
|
|
660
|
-
infoout =
|
|
732
|
+
infoout = do_waterlevellineres_listassetspu(res, info,hardtype)
|
|
661
733
|
info_list.append(copy.deepcopy(infoout))
|
|
662
734
|
a = a+1
|
|
663
735
|
print("这是"+str(a))
|
|
@@ -685,17 +757,17 @@ def do_waterlevelline_autotest_search(collections, clientinfo, score_threshold):
|
|
|
685
757
|
}
|
|
686
758
|
a =0
|
|
687
759
|
for i in collections:
|
|
688
|
-
info['input']['用户输入/userInput'] = i['ext']['
|
|
689
|
-
info['output']['用户输入/output'] = i['ext']['
|
|
760
|
+
info['input']['用户输入/userInput'] = i['ext']['资产名称']
|
|
761
|
+
info['output']['用户输入/output'] = i['ext']['资产名称']
|
|
690
762
|
info['exp'] = [
|
|
691
|
-
{'label': i['ext']['
|
|
692
|
-
{'label': i['ext'].get('
|
|
763
|
+
{'label': i['ext']['资产型号'], 'score': score_threshold},
|
|
764
|
+
{'label': i['ext'].get('资产型号1', ''), 'score': score_threshold}]
|
|
693
765
|
info['artificial'] = info['exp']
|
|
694
766
|
info['label']=[]
|
|
695
|
-
if i['ext']['
|
|
696
|
-
if "设备" in i['ext']['
|
|
697
|
-
asset_name = i['ext']['
|
|
698
|
-
asset_name = i['ext']['
|
|
767
|
+
if i['ext']['资产名称']:
|
|
768
|
+
if "设备" in i['ext']['分发技能'] or "配件" in i['ext']['分发技能']:
|
|
769
|
+
asset_name = i['ext']['资产名称']
|
|
770
|
+
asset_name = i['ext']['资产类型']
|
|
699
771
|
try:
|
|
700
772
|
# 尝试将其解析为 JSON 对象
|
|
701
773
|
if isinstance(asset_name, str):
|
|
@@ -704,9 +776,9 @@ def do_waterlevelline_autotest_search(collections, clientinfo, score_threshold):
|
|
|
704
776
|
# 若解析失败,说明不是 JSON 格式,保持原样
|
|
705
777
|
pass
|
|
706
778
|
key = asset_name.get('asset_name') if isinstance(asset_name, dict) else asset_name
|
|
707
|
-
if i['ext']['
|
|
779
|
+
if i['ext']['资产型号'] == "设备":
|
|
708
780
|
hardtype = 1
|
|
709
|
-
elif i['ext']['
|
|
781
|
+
elif i['ext']['资产型号'] == "配件" :
|
|
710
782
|
hardtype = 2
|
|
711
783
|
res = searchListAssetModelScope(key,hardtype,clientinfo)
|
|
712
784
|
else:
|
|
@@ -740,24 +812,24 @@ def do_waterlevelline_autotest_SoftwareApplyRecommendList(collections, clientinf
|
|
|
740
812
|
}
|
|
741
813
|
a =0
|
|
742
814
|
for i in collections:
|
|
743
|
-
info['input']['用户输入/userInput'] = i['ext'].get('
|
|
744
|
-
info['output']['实际输出/output'] = i['ext']['
|
|
815
|
+
info['input']['用户输入/userInput'] = i['ext'].get('资产名称') or i['ext'].get('资产名称')
|
|
816
|
+
info['output']['实际输出/output'] = i['ext']['资产名称']
|
|
745
817
|
info['exp'] = []
|
|
746
|
-
for j in [i['ext']['
|
|
747
|
-
i['ext'].get('
|
|
748
|
-
i['ext'].get('
|
|
749
|
-
i['ext'].get('
|
|
750
|
-
i['ext'].get('
|
|
751
|
-
i['ext'].get('
|
|
818
|
+
for j in [i['ext']['资产型号'], i['ext'].get('资产型号1'),
|
|
819
|
+
i['ext'].get('资产型号2'), i['ext'].get('资产型号3'),
|
|
820
|
+
i['ext'].get('资产型号4'), i['ext'].get('资产型号5'),
|
|
821
|
+
i['ext'].get('资产型号6'), i['ext'].get('资产型号7'),
|
|
822
|
+
i['ext'].get('资产型号8'), i['ext'].get('资产型号9'),
|
|
823
|
+
i['ext'].get('资产型号10')]:
|
|
752
824
|
if j:
|
|
753
825
|
info['exp'].append({'label': j, 'score': score_threshold})
|
|
754
826
|
if info['exp'] == '':
|
|
755
827
|
break
|
|
756
828
|
info['artificial'] = info['exp']
|
|
757
829
|
info['label']=[]
|
|
758
|
-
if i['ext']['
|
|
759
|
-
if "软件" in i['ext']['
|
|
760
|
-
asset_name = i['ext']['
|
|
830
|
+
if i['ext']['资产名称']:
|
|
831
|
+
if "软件" in i['ext']['分发技能']:
|
|
832
|
+
asset_name = i['ext']['资产名称']
|
|
761
833
|
try:
|
|
762
834
|
# 尝试将其解析为 JSON 对象
|
|
763
835
|
if isinstance(asset_name, str):
|
|
@@ -998,7 +1070,7 @@ def do_waterlevelline_autotest_fix(collections, clientinfo, score_threshold):
|
|
|
998
1070
|
for j in [i['ext']['匹配型号1'], i['ext'].get('匹配型号2'),i['ext'].get('匹配型号3'),i['ext'].get('匹配型号4'),i['ext'].get('匹配型号5'),i['ext'].get('匹配型号6'),i['ext'].get('匹配型号7'),i['ext'].get('匹配型号8'),i['ext'].get('匹配型号9'),i['ext'].get('匹配型号10')]:
|
|
999
1071
|
if j:
|
|
1000
1072
|
info['exp'].append({'label': j, 'score': score_threshold})
|
|
1001
|
-
#判断i['ext']['
|
|
1073
|
+
#判断i['ext']['资产型号']是否为空,为空就不用读取,不为空就读取
|
|
1002
1074
|
if i['ext']['资产名称']:
|
|
1003
1075
|
asset_name = i['ext']['资产名称']
|
|
1004
1076
|
try:
|
itam_assistant/openapi.py
CHANGED
|
@@ -508,14 +508,47 @@ def equipmentreturn_structure(QueryValue):
|
|
|
508
508
|
|
|
509
509
|
|
|
510
510
|
def GetBestMatchItemonline(SearchKey, HardwareMatchType, clientinfo):
|
|
511
|
+
url = "https://it.bytedance.com/itam-byte/api/itservice/common/GetBestMatchItem"
|
|
512
|
+
payload = json.dumps({
|
|
513
|
+
"SearchKey": SearchKey,
|
|
514
|
+
"TopN": 10,
|
|
515
|
+
"AiUseType": 5,
|
|
516
|
+
"QueryAssetModelScopeRequestV2": {
|
|
517
|
+
"HardwareMatchType": HardwareMatchType,
|
|
518
|
+
"TemplateType": "6883418246797986828",
|
|
519
|
+
"ApplyRegionID": "7145432241957506086",
|
|
520
|
+
"Page": {
|
|
521
|
+
"PageNum": 1,
|
|
522
|
+
"PageSize": 10
|
|
523
|
+
}
|
|
524
|
+
},
|
|
525
|
+
"psm": "athena"
|
|
526
|
+
})
|
|
527
|
+
time.sleep(5)
|
|
528
|
+
headers = {
|
|
529
|
+
'authorization': clientinfo.get(
|
|
530
|
+
'authorization') or 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6InYyIiwidHlwIjoiSldUIn0.eyJleHAiOjE3NTEwOTI3NjksImp0aSI6ImR1M3o1UEh3ZDNla2tLUlUiLCJpYXQiOjE3NDk3OTY3NjksImlzcyI6InRhbm5hIiwic3ViIjoiMzgzMDMxOUBieXRlZGFuY2UucGVvcGxlIiwidGVuYW50X2lkIjoiYnl0ZWRhbmNlLnBlb3BsZSIsInRlbmFudF9uYW1lIjoiIiwicHJvamVjdF9rZXkiOiJjcm1TZmdIVmU1dXhIMHJyIiwidW5pdCI6ImV1X25jIiwiYXV0aF9ieSI6Mn0.GGUPJ3FzxW131PovtM_BUANXWUPIJTfG6zbNlb80ZIiPviQ3U0t4hxVMty9Dj4PYfiLfLMQ1r3E9xsIWfvQDL-CGC7EsnqBDT6Vc4_ZGvW_mx-z3YVzs7TJ8cKE0YZUI8gB-ZsAgztMJF5Jlja0zqdWNi7sdc-YnYISzrxv6aiY',
|
|
531
|
+
'cookie': clientinfo.get(
|
|
532
|
+
'cookie') or 'MONITOR_WEB_ID=ce5a3279-6ed5-4ede-9b00-29aa7c1a1311; bd_sso_3b6da9=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTAzMzYyMzMsImlhdCI6MTc0OTczMTQzMywiaXNzIjoic3NvLmJ5dGVkYW5jZS5jb20iLCJzdWIiOiJkZWdubjk2MWtma2treW9waDd5cyIsInRlbmFudF9pZCI6ImhncTN0Y2NwM2kxc2pqbjU4emlrIn0.dMO0OWpMvIXmHGHfgxU3FRvwLOqNWAW_kiWDiHWt9wMxQd5qsi9PILBXCEYP4NVq5CaNbU_XO488CJz0vxxNh50hLdk5Jgf7n1lm-FaTJ-AtD7tqBlUl94ZB38GiAb2m7U4xC-7iHWVH2Mp-M92Z7_jgB0xJcEiDmOhlLqBviatlLGcoeAIjhpK01MA04T6Efb5M_OgeJbbqOZgl-jSdIvY6SD5my9kSzg1KE3E1caquPzYMDtgjIy9L8rkqYz0A77DXac6l0tv6daHshoPvgtc4urTV9QdT6XAYyPO_yf8ISXz03opaKkmHtZ5slIFSqgTPbLJ9Y_dmaZuX9D_NRg; MONITOR_WEB_ID=ce5a3279-6ed5-4ede-9b00-29aa7c1a1311; _tea_utm_cache_1508={%22utm_source%22:%22startup%22%2C%22utm_medium%22:%22chrome%22}; _tea_utm_cache_1229=undefined; amuserid=7036392@bytedance.people',
|
|
533
|
+
'Content-Type': 'application/json',
|
|
534
|
+
}
|
|
535
|
+
if clientinfo.get('x_tt_env'):
|
|
536
|
+
headers['x-tt-env'] = clientinfo.get('x_tt_env')
|
|
537
|
+
headers['x-use-ppe'] = '1'
|
|
538
|
+
|
|
539
|
+
response = requests.request("POST", url, headers=headers, data=payload)
|
|
540
|
+
|
|
541
|
+
return json.loads(response.text)
|
|
542
|
+
|
|
543
|
+
def GetBestMatchItemonline_(SearchKey, HardwareMatchType, clientinfo):
|
|
511
544
|
url = "https://it.bytedance.com/itam-byte/api/itservice/common/GetBestMatchItem"
|
|
512
545
|
payload = json.dumps({
|
|
513
546
|
"SearchKey": SearchKey,
|
|
514
547
|
"TopN": 10,
|
|
515
|
-
"AiUseType":
|
|
548
|
+
"AiUseType": 7,
|
|
516
549
|
"QueryAssetModelScopeRequestV2": {
|
|
517
550
|
"HardwareMatchType": HardwareMatchType,
|
|
518
|
-
"TemplateType": "
|
|
551
|
+
"TemplateType": "6883418246797954060",
|
|
519
552
|
"ApplyRegionID": "7145432241957506086",
|
|
520
553
|
"Page": {
|
|
521
554
|
"PageNum": 1,
|
|
@@ -534,10 +567,110 @@ def GetBestMatchItemonline(SearchKey, HardwareMatchType, clientinfo):
|
|
|
534
567
|
}
|
|
535
568
|
|
|
536
569
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
570
|
+
response0 = json.loads(response.text)
|
|
571
|
+
response1 = json.loads(response.text)
|
|
572
|
+
if HardwareMatchType == 2:
|
|
573
|
+
if response0['data'].get('AiBorrowAndUseResponseList'):
|
|
574
|
+
for i in response0['data']['AiBorrowAndUseResponseList']:
|
|
575
|
+
if str(i['OutOfStock']) == 'True':
|
|
576
|
+
response1['data']['AiBorrowAndUseResponseList'].remove(i)
|
|
577
|
+
else:
|
|
578
|
+
pass
|
|
579
|
+
return response1
|
|
580
|
+
return json.loads(response.text)
|
|
537
581
|
|
|
582
|
+
def GetBestMatchItemonline_software(SearchKey, Description, clientinfo):
|
|
583
|
+
url = "https://it.bytedance.com/itam-byte/api/itservice/common/GetBestMatchItem"
|
|
584
|
+
payload = json.dumps({
|
|
585
|
+
"SearchKey":"","TopN":5,"AiUseType":100,
|
|
586
|
+
"SoftwareApplyRequest":{"Size":3,
|
|
587
|
+
"Name":SearchKey,
|
|
588
|
+
"Description":""},
|
|
589
|
+
"psm":"athena"})
|
|
590
|
+
time.sleep(5)
|
|
591
|
+
headers = {
|
|
592
|
+
'authorization': clientinfo.get(
|
|
593
|
+
'authorization') or 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6InYyIiwidHlwIjoiSldUIn0.eyJleHAiOjE3NTEwOTI3NjksImp0aSI6ImR1M3o1UEh3ZDNla2tLUlUiLCJpYXQiOjE3NDk3OTY3NjksImlzcyI6InRhbm5hIiwic3ViIjoiMzgzMDMxOUBieXRlZGFuY2UucGVvcGxlIiwidGVuYW50X2lkIjoiYnl0ZWRhbmNlLnBlb3BsZSIsInRlbmFudF9uYW1lIjoiIiwicHJvamVjdF9rZXkiOiJjcm1TZmdIVmU1dXhIMHJyIiwidW5pdCI6ImV1X25jIiwiYXV0aF9ieSI6Mn0.GGUPJ3FzxW131PovtM_BUANXWUPIJTfG6zbNlb80ZIiPviQ3U0t4hxVMty9Dj4PYfiLfLMQ1r3E9xsIWfvQDL-CGC7EsnqBDT6Vc4_ZGvW_mx-z3YVzs7TJ8cKE0YZUI8gB-ZsAgztMJF5Jlja0zqdWNi7sdc-YnYISzrxv6aiY',
|
|
594
|
+
'cookie': clientinfo.get(
|
|
595
|
+
'cookie') or 'MONITOR_WEB_ID=ce5a3279-6ed5-4ede-9b00-29aa7c1a1311; bd_sso_3b6da9=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTAzMzYyMzMsImlhdCI6MTc0OTczMTQzMywiaXNzIjoic3NvLmJ5dGVkYW5jZS5jb20iLCJzdWIiOiJkZWdubjk2MWtma2treW9waDd5cyIsInRlbmFudF9pZCI6ImhncTN0Y2NwM2kxc2pqbjU4emlrIn0.dMO0OWpMvIXmHGHfgxU3FRvwLOqNWAW_kiWDiHWt9wMxQd5qsi9PILBXCEYP4NVq5CaNbU_XO488CJz0vxxNh50hLdk5Jgf7n1lm-FaTJ-AtD7tqBlUl94ZB38GiAb2m7U4xC-7iHWVH2Mp-M92Z7_jgB0xJcEiDmOhlLqBviatlLGcoeAIjhpK01MA04T6Efb5M_OgeJbbqOZgl-jSdIvY6SD5my9kSzg1KE3E1caquPzYMDtgjIy9L8rkqYz0A77DXac6l0tv6daHshoPvgtc4urTV9QdT6XAYyPO_yf8ISXz03opaKkmHtZ5slIFSqgTPbLJ9Y_dmaZuX9D_NRg; MONITOR_WEB_ID=ce5a3279-6ed5-4ede-9b00-29aa7c1a1311; _tea_utm_cache_1508={%22utm_source%22:%22startup%22%2C%22utm_medium%22:%22chrome%22}; _tea_utm_cache_1229=undefined; amuserid=7036392@bytedance.people',
|
|
596
|
+
'Content-Type': 'application/json',
|
|
597
|
+
|
|
598
|
+
}
|
|
599
|
+
if clientinfo.get('x_tt_env'):
|
|
600
|
+
headers['x-tt-env'] = clientinfo.get('x_tt_env')
|
|
601
|
+
headers['x-use-ppe'] = '1'
|
|
602
|
+
response = requests.request("POST", url, headers=headers, data=payload)
|
|
538
603
|
return json.loads(response.text)
|
|
539
604
|
|
|
605
|
+
def GetBestMatchItemoff0(SearchKey, HardwareMatchType, clientinfo):
|
|
606
|
+
url = "https://it-pre.bytedance.net/itam-byte/api/itservice/common/GetBestMatchItem"
|
|
540
607
|
|
|
608
|
+
if HardwareMatchType==1:
|
|
609
|
+
pr = {"SearchKey":SearchKey,"TopN":10,"AiUseType":7,
|
|
610
|
+
"QueryAssetModelScopeRequestV2":
|
|
611
|
+
{"HardwareMatchType":HardwareMatchType,
|
|
612
|
+
"TemplateType":"6848436666751798285",
|
|
613
|
+
"ApplyRegionID":"7468013511194643493",
|
|
614
|
+
"Page":{"PageNum":1,"PageSize":10}},"psm":"athena"}
|
|
615
|
+
if HardwareMatchType==2:
|
|
616
|
+
pr = {"SearchKey":SearchKey,"TopN":10,"AiUseType":7,
|
|
617
|
+
"QueryAssetModelScopeRequestV2":
|
|
618
|
+
{"HardwareMatchType":HardwareMatchType,
|
|
619
|
+
"TemplateType":"7534557229471796234",
|
|
620
|
+
"ApplyRegionID":"7509062433064029194","Page":{"PageNum":1,"PageSize":10}},"psm":"athena"}
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
payload = json.dumps(pr)
|
|
625
|
+
# time.sleep(5)
|
|
626
|
+
headers = {
|
|
627
|
+
'authorization': clientinfo.get(
|
|
628
|
+
'authorization') or 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6InYyIiwidHlwIjoiSldUIn0.eyJleHAiOjE3NTk0MTc3ODEsImp0aSI6IkVXSUNmT0k5WVBCZVdKSTkiLCJpYXQiOjE3NTgxMjE3ODEsImlzcyI6InRhbm5hIiwic3ViIjoiMzgzMDMxOUBieXRlZGFuY2UucGVvcGxlIiwidGVuYW50X2lkIjoiYnl0ZWRhbmNlLnBlb3BsZSIsInRlbmFudF9uYW1lIjoiIiwicHJvamVjdF9rZXkiOiJjcm1TZmdIVmU1dXhIMHJyIiwidW5pdCI6ImV1X25jIiwiYXV0aF9ieSI6Mn0.MmENqyPY7k4KMz9ufbxzpIZXOnLaoYAAyv3J2T0OMz6tcd1IyEhYJd1cFjzqLw26NnWe4bfglki7zmIVQduftIJc8QaRcXDjDszCfG4DfH2O7zQTi7cwptt_o-CxI6E6osRhYmJ7dwaSWw1hBRlnBNJMbyzUlHRspJz-hox_oGA',
|
|
629
|
+
'cookie': clientinfo.get(
|
|
630
|
+
'cookie') or '_ga=GA1.1.1854125625.1750232273; _ga_FVWC4GKEYS=GS2.1.s1750301537$o2$g1$t1750301683$j60$l0$h0; X-Risk-Browser-Id=8f55035c3e943940f7e4eea73ae96e203e00887d4e38ec8b0f918e6477c34ef8; people-lang=zh; _tea_utm_cache_1508={%22utm_source%22:%22startup%22%2C%22utm_medium%22:%22chrome%22}; MONITOR_WEB_ID=ce5a3279-6ed5-4ede-9b00-29aa7c1a1311; email=liujunmei@bytedance.com; user_token=JTdCJTIybmFtZSUyMiUzQSUyMiVFNSU4OCU5OCVFNCVCRiU4QSVFNiVBMiU4NSUyMiUyQyUyMmZ1bGxfbmFtZSUyMiUzQSUyMiVFNSU4OCU5OCVFNCVCRiU4QSVFNiVBMiU4NSUyMDM4MzAzMTklMjIlMkMlMjJlbWFpbCUyMiUzQSUyMmxpdWp1bm1laSU0MGJ5dGVkYW5jZS5jb20lMjIlMkMlMjJwaWN0dXJlJTIyJTNBJTIyaHR0cHMlM0ElMkYlMkZzMS1pbWZpbGUuZmVpc2h1Y2RuLmNvbSUyRnN0YXRpYy1yZXNvdXJjZSUyRnYxJTJGdjNfMDBrOF81ZDBhNDk4MS0zMDJkLTQwMTEtOGJmMy0yNDYzZDhkY2IxMWd+JTNGaW1hZ2Vfc2l6ZSUzRDI0MHgyNDAlMjZjdXRfdHlwZSUzRCUyNnF1YWxpdHklM0QlMjZmb3JtYXQlM0RwbmclMjZzdGlja2VyX2Zvcm1hdCUzRC53ZWJwJTIyJTJDJTIyZW1wbG95ZWVfaWQlMjIlM0ElMjIzODMwMzE5JTIyJTJDJTIyZW1wbG95ZWVfbnVtYmVyJTIyJTNBJTIyMzgzMDMxOSUyMiUyQyUyMnRlbmFudF9hbGlhcyUyMiUzQSUyMmJ5dGVkYW5jZSUyMiUyQyUyMnVzZXJfaWQlMjIlM0ElMjJkZWdubjk2MWtma2treW9waDd5cyUyMiU3RA==; amuserid=3830319@bytedance.people; titan_passport_id=cn/bytedance/89511df1-02a0-412c-907d-fd5079b66ebe; MONITOR_WEB_ID=ce5a3279-6ed5-4ede-9b00-29aa7c1a1311; _tea_utm_cache_1229=undefined; bd_sso_3b6da9=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTg4MTU4NzQsImlhdCI6MTc1ODIxMTA3NCwiaXNzIjoic3NvLmJ5dGVkYW5jZS5jb20iLCJzdWIiOiJkZWdubjk2MWtma2treW9waDd5cyIsInRlbmFudF9pZCI6ImhncTN0Y2NwM2kxc2pqbjU4emlrIn0.IkLCCJrY4uuskameDvQpPgArxbEpS7P202Q46tGJkqNm5JrV73SvAeRtU9jNtbBRruTwQnlyuZYpIcGy2CJq1UiBLLb34jGhnoqw6-v6C2s3sKu5OYuHNcPYHvYTbUi7aqVxYeJWA7ag0Wx0rmdjb250oZkmurQKbdVFq8mihfHUumm55LskBcsA2ai5WHX4fNPzJ63GNJt0CvWnAOIPT7cvY8qZWZhbqqyfVL6gdkPAxiCR6mLmjkg0Jrrl84jbPM3LQxaySGZ91vU5WuRpnpn_ITBXDtvySTEN63lFj0IkaiNxgjQQXonPEnndgoDI3Q1N-Jif-MFlucgy8a04MA',
|
|
631
|
+
'Content-Type': 'application/json',
|
|
632
|
+
'x-use-ppe': '1',
|
|
633
|
+
'x-tt-env': 'ppe_itam_feat_vector_opt_nym'
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
response = requests.request("POST", url, headers=headers, data=payload)
|
|
637
|
+
|
|
638
|
+
return json.loads(response.text)
|
|
639
|
+
|
|
640
|
+
def GetBestMatchItemoff(SearchKey, HardwareMatchType, clientinfo):
|
|
641
|
+
url = "https://it-pre.bytedance.net/itam-byte/api/itservice/common/GetBestMatchItem"
|
|
642
|
+
|
|
643
|
+
if HardwareMatchType==1:
|
|
644
|
+
pr = {"SearchKey":SearchKey,"TopN":10,"AiUseType":5,
|
|
645
|
+
"QueryAssetModelScopeRequestV2":
|
|
646
|
+
{"HardwareMatchType":HardwareMatchType,
|
|
647
|
+
"TemplateType":"6848436753938779140",
|
|
648
|
+
"ApplyRegionID":"7468013511194643493",
|
|
649
|
+
"Page":{"PageNum":1,"PageSize":10}},"psm":"athena"}
|
|
650
|
+
if HardwareMatchType==2:
|
|
651
|
+
pr = {"SearchKey":SearchKey,"TopN":10,"AiUseType":5,
|
|
652
|
+
"QueryAssetModelScopeRequestV2":
|
|
653
|
+
{"HardwareMatchType":HardwareMatchType,
|
|
654
|
+
"TemplateType":"6848436753938779140",
|
|
655
|
+
"ApplyRegionID":"7509062433064029194","Page":{"PageNum":1,"PageSize":10}},"psm":"athena"}
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
payload = json.dumps(pr)
|
|
660
|
+
# time.sleep(5)
|
|
661
|
+
headers = {
|
|
662
|
+
'authorization': clientinfo.get(
|
|
663
|
+
'authorization') or 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6InYyIiwidHlwIjoiSldUIn0.eyJleHAiOjE3NTk0MTc3ODEsImp0aSI6IkVXSUNmT0k5WVBCZVdKSTkiLCJpYXQiOjE3NTgxMjE3ODEsImlzcyI6InRhbm5hIiwic3ViIjoiMzgzMDMxOUBieXRlZGFuY2UucGVvcGxlIiwidGVuYW50X2lkIjoiYnl0ZWRhbmNlLnBlb3BsZSIsInRlbmFudF9uYW1lIjoiIiwicHJvamVjdF9rZXkiOiJjcm1TZmdIVmU1dXhIMHJyIiwidW5pdCI6ImV1X25jIiwiYXV0aF9ieSI6Mn0.MmENqyPY7k4KMz9ufbxzpIZXOnLaoYAAyv3J2T0OMz6tcd1IyEhYJd1cFjzqLw26NnWe4bfglki7zmIVQduftIJc8QaRcXDjDszCfG4DfH2O7zQTi7cwptt_o-CxI6E6osRhYmJ7dwaSWw1hBRlnBNJMbyzUlHRspJz-hox_oGA',
|
|
664
|
+
'cookie': clientinfo.get(
|
|
665
|
+
'cookie') or '_ga=GA1.1.1854125625.1750232273; _ga_FVWC4GKEYS=GS2.1.s1750301537$o2$g1$t1750301683$j60$l0$h0; X-Risk-Browser-Id=8f55035c3e943940f7e4eea73ae96e203e00887d4e38ec8b0f918e6477c34ef8; people-lang=zh; _tea_utm_cache_1508={%22utm_source%22:%22startup%22%2C%22utm_medium%22:%22chrome%22}; MONITOR_WEB_ID=ce5a3279-6ed5-4ede-9b00-29aa7c1a1311; email=liujunmei@bytedance.com; user_token=JTdCJTIybmFtZSUyMiUzQSUyMiVFNSU4OCU5OCVFNCVCRiU4QSVFNiVBMiU4NSUyMiUyQyUyMmZ1bGxfbmFtZSUyMiUzQSUyMiVFNSU4OCU5OCVFNCVCRiU4QSVFNiVBMiU4NSUyMDM4MzAzMTklMjIlMkMlMjJlbWFpbCUyMiUzQSUyMmxpdWp1bm1laSU0MGJ5dGVkYW5jZS5jb20lMjIlMkMlMjJwaWN0dXJlJTIyJTNBJTIyaHR0cHMlM0ElMkYlMkZzMS1pbWZpbGUuZmVpc2h1Y2RuLmNvbSUyRnN0YXRpYy1yZXNvdXJjZSUyRnYxJTJGdjNfMDBrOF81ZDBhNDk4MS0zMDJkLTQwMTEtOGJmMy0yNDYzZDhkY2IxMWd+JTNGaW1hZ2Vfc2l6ZSUzRDI0MHgyNDAlMjZjdXRfdHlwZSUzRCUyNnF1YWxpdHklM0QlMjZmb3JtYXQlM0RwbmclMjZzdGlja2VyX2Zvcm1hdCUzRC53ZWJwJTIyJTJDJTIyZW1wbG95ZWVfaWQlMjIlM0ElMjIzODMwMzE5JTIyJTJDJTIyZW1wbG95ZWVfbnVtYmVyJTIyJTNBJTIyMzgzMDMxOSUyMiUyQyUyMnRlbmFudF9hbGlhcyUyMiUzQSUyMmJ5dGVkYW5jZSUyMiUyQyUyMnVzZXJfaWQlMjIlM0ElMjJkZWdubjk2MWtma2treW9waDd5cyUyMiU3RA==; amuserid=3830319@bytedance.people; titan_passport_id=cn/bytedance/89511df1-02a0-412c-907d-fd5079b66ebe; MONITOR_WEB_ID=ce5a3279-6ed5-4ede-9b00-29aa7c1a1311; _tea_utm_cache_1229=undefined; bd_sso_3b6da9=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTg4MTU4NzQsImlhdCI6MTc1ODIxMTA3NCwiaXNzIjoic3NvLmJ5dGVkYW5jZS5jb20iLCJzdWIiOiJkZWdubjk2MWtma2treW9waDd5cyIsInRlbmFudF9pZCI6ImhncTN0Y2NwM2kxc2pqbjU4emlrIn0.IkLCCJrY4uuskameDvQpPgArxbEpS7P202Q46tGJkqNm5JrV73SvAeRtU9jNtbBRruTwQnlyuZYpIcGy2CJq1UiBLLb34jGhnoqw6-v6C2s3sKu5OYuHNcPYHvYTbUi7aqVxYeJWA7ag0Wx0rmdjb250oZkmurQKbdVFq8mihfHUumm55LskBcsA2ai5WHX4fNPzJ63GNJt0CvWnAOIPT7cvY8qZWZhbqqyfVL6gdkPAxiCR6mLmjkg0Jrrl84jbPM3LQxaySGZ91vU5WuRpnpn_ITBXDtvySTEN63lFj0IkaiNxgjQQXonPEnndgoDI3Q1N-Jif-MFlucgy8a04MA',
|
|
666
|
+
'Content-Type': 'application/json',
|
|
667
|
+
'x-use-ppe': '1',
|
|
668
|
+
'x-tt-env': 'ppe_itam_feat_vector_opt_nym'
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
response = requests.request("POST", url, headers=headers, data=payload)
|
|
672
|
+
|
|
673
|
+
return json.loads(response.text)
|
|
541
674
|
def GetBestMatchItemonline_old(SearchKey, HardwareMatchType, clientinfo):
|
|
542
675
|
url = "https://it.bytedance.com/itam-byte/api/itservice/common/GetBestMatchItem"
|
|
543
676
|
payload = json.dumps({
|