itam-assistant 0.1.18__tar.gz → 0.1.19__tar.gz
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-0.1.18 → itam_assistant-0.1.19}/PKG-INFO +2 -2
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant/do_ai.py +92 -3
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant/openapi.py +19 -1
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant.egg-info/PKG-INFO +2 -2
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/setup.py +2 -2
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/README.md +0 -0
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant/__init__.py +0 -0
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant/ailyapp_client.py +0 -0
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant/config.py +0 -0
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant/intent_detail.py +0 -0
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant/lark_client.py +0 -0
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant/logger.py +0 -0
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant/test.py +0 -0
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant.egg-info/SOURCES.txt +0 -0
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant.egg-info/dependency_links.txt +0 -0
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant.egg-info/requires.txt +0 -0
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant.egg-info/top_level.txt +0 -0
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/setup.cfg +0 -0
- {itam_assistant-0.1.18 → itam_assistant-0.1.19}/test/test.py +0 -0
|
@@ -462,11 +462,11 @@ def do_waterlevelline_autotest(collections, clientinfo, score_threshold):
|
|
|
462
462
|
info['input']['用户输入/userInput'] = i['ext']['资产名称']
|
|
463
463
|
info['output']['用户输入/output'] = i['ext']['资产名称']
|
|
464
464
|
info['exp'] = []
|
|
465
|
-
for j in [i['ext']
|
|
465
|
+
for j in [i['ext'].get('匹配型号'), 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')]:
|
|
466
466
|
if j:
|
|
467
467
|
info['exp'].append({'label': j, 'score': score_threshold})
|
|
468
468
|
#判断i['ext']['资产型号']是否为空,为空就不用读取,不为空就读取
|
|
469
|
-
if i['ext']['
|
|
469
|
+
if i['ext']['资产名称']:
|
|
470
470
|
asset_name = i['ext']['资产名称']
|
|
471
471
|
try:
|
|
472
472
|
if isinstance(asset_name, str):
|
|
@@ -486,7 +486,7 @@ def do_waterlevelline_autotest(collections, clientinfo, score_threshold):
|
|
|
486
486
|
if "软件申请" in i['ext']['分发技能']:
|
|
487
487
|
keywprd = software_asset_sku_structure(asset_name)
|
|
488
488
|
res = json.loads(get_query_vector(keywprd, clientinfo))
|
|
489
|
-
if "
|
|
489
|
+
if "设备&配件领用" in i['ext']['分发技能']:
|
|
490
490
|
#keywprd = equipmentrequest_structure(asset_name, i['ext']['asset_type'])
|
|
491
491
|
keywprd = {
|
|
492
492
|
"From": 0,
|
|
@@ -851,6 +851,62 @@ def do_waterlevelline_autotest_SoftwareApplyRecommendList(collections, clientinf
|
|
|
851
851
|
bbb = a
|
|
852
852
|
return info_list
|
|
853
853
|
|
|
854
|
+
def do_waterlevelline_autotest_SoftwareApplyRecommendList_SearchKey(collections, clientinfo, score_threshold):
|
|
855
|
+
"""
|
|
856
|
+
水位线评测- 返回 符合报告模式的结果
|
|
857
|
+
"""
|
|
858
|
+
keywprd= []
|
|
859
|
+
info_list = []
|
|
860
|
+
info = {
|
|
861
|
+
"input": {
|
|
862
|
+
"用户输入/userInput": "我要申请软件,名字叫:ai_xzh_all_restricted_software完全受限软件"
|
|
863
|
+
},
|
|
864
|
+
"output": {
|
|
865
|
+
"实际输出/output": "我要申请软件,名字叫:ai_xzh_all_restricted_software完全受限软件"
|
|
866
|
+
},
|
|
867
|
+
"rt": True,
|
|
868
|
+
"label": [{"label": "GUI 软件申请", "score": 0.6}, {"label": "软件申请", "score": 0.5}],
|
|
869
|
+
"exp": [{"label": "GUI 软件申请", " score": 0.9}, {"label": "软件申请", "score": 0.8
|
|
870
|
+
}],
|
|
871
|
+
"artificial": []
|
|
872
|
+
}
|
|
873
|
+
a =0
|
|
874
|
+
for i in collections:
|
|
875
|
+
info['input']['用户输入/userInput'] = i['ext'].get('资产名称') or i['ext'].get('资产名称')
|
|
876
|
+
info['output']['实际输出/output'] = i['ext']['资产名称']
|
|
877
|
+
info['exp'] = []
|
|
878
|
+
for j in [i['ext']['匹配型号1'], i['ext'].get('匹配型号1'),
|
|
879
|
+
i['ext'].get('匹配型号2'), i['ext'].get('匹配型号2'),
|
|
880
|
+
i['ext'].get('匹配型号3'), i['ext'].get('匹配型号3'),
|
|
881
|
+
i['ext'].get('匹配型号4'), i['ext'].get('匹配型号4'),
|
|
882
|
+
i['ext'].get('匹配型号5'), i['ext'].get('匹配型号5'),
|
|
883
|
+
i['ext'].get('匹配型号6')]:
|
|
884
|
+
if j:
|
|
885
|
+
info['exp'].append({'label': j, 'score': score_threshold})
|
|
886
|
+
if info['exp'] == '':
|
|
887
|
+
break
|
|
888
|
+
info['artificial'] = info['exp']
|
|
889
|
+
info['label']=[]
|
|
890
|
+
if i['ext']['资产名称']:
|
|
891
|
+
if "软件" in i['ext']['分发技能']:
|
|
892
|
+
asset_name = i['ext']['资产名称']
|
|
893
|
+
try:
|
|
894
|
+
# 尝试将其解析为 JSON 对象
|
|
895
|
+
if isinstance(asset_name, str):
|
|
896
|
+
asset_name = json.loads(asset_name)
|
|
897
|
+
except json.JSONDecodeError:
|
|
898
|
+
# 若解析失败,说明不是 JSON 格式,保持原样
|
|
899
|
+
pass
|
|
900
|
+
key = asset_name.get('asset_name') if isinstance(asset_name, dict) else asset_name
|
|
901
|
+
res = SoftwareApplyGetBestMatchItem_SearchKey(key,clientinfo)
|
|
902
|
+
else:
|
|
903
|
+
res = ""
|
|
904
|
+
infoout = do_waterlevellineres_software_SearchKey(res, info)
|
|
905
|
+
info_list.append(copy.deepcopy(infoout))
|
|
906
|
+
a = a+1
|
|
907
|
+
print("这是"+str(a))
|
|
908
|
+
bbb = a
|
|
909
|
+
return info_list
|
|
854
910
|
|
|
855
911
|
def do_waterlevellineres_software(res, info):
|
|
856
912
|
"""
|
|
@@ -884,6 +940,39 @@ def do_waterlevellineres_software(res, info):
|
|
|
884
940
|
info['rt'] = False
|
|
885
941
|
return info
|
|
886
942
|
|
|
943
|
+
|
|
944
|
+
def do_waterlevellineres_software_SearchKey(res, info):
|
|
945
|
+
"""
|
|
946
|
+
获取结果,并组装水位线info
|
|
947
|
+
"""
|
|
948
|
+
if res == '':
|
|
949
|
+
info['label'] = [{'label': '', 'score': 0}]
|
|
950
|
+
info['rt'] = False
|
|
951
|
+
return info
|
|
952
|
+
info['output']['实际输出/output'] = 'requestId:' + res.get('requestId')
|
|
953
|
+
if res["data"].get("SoftwareApplyRecommendList") == None:
|
|
954
|
+
info['label'] = [{'label': '', 'score': 0},{'label': '', 'score': 0.3}]
|
|
955
|
+
info['rt'] = False
|
|
956
|
+
if info['exp'][0]['label']=='':
|
|
957
|
+
info['rt'] = True
|
|
958
|
+
return info
|
|
959
|
+
reslist = res["data"]["SoftwareApplyRecommendList"]
|
|
960
|
+
aaa ={}
|
|
961
|
+
# 判断res["body"]["Results"]不为空,空则:label0 label1 为空,label默认2级
|
|
962
|
+
if reslist:
|
|
963
|
+
# 取["Results"]下前2个结果,若只有1个结果,label1为空
|
|
964
|
+
if len(reslist) > 0:
|
|
965
|
+
for j in range(len(reslist)):
|
|
966
|
+
aaa = {'label': reslist[j]['Data']['Name']['ValueZh'],
|
|
967
|
+
'score': reslist[j]['Score']/20}
|
|
968
|
+
info['label'].append(copy.deepcopy(aaa))
|
|
969
|
+
|
|
970
|
+
info['rt'] = do_businessassertionrules(info['label'],info['exp'])
|
|
971
|
+
else:
|
|
972
|
+
info['label'] = info['label'] = [{'label': '', 'score': 0}, {'label': '', 'score': 0}]
|
|
973
|
+
info['rt'] = False
|
|
974
|
+
return info
|
|
975
|
+
|
|
887
976
|
def do_businessassertionrules(label, epx):
|
|
888
977
|
"""
|
|
889
978
|
业务断言
|
|
@@ -680,7 +680,7 @@ def GetBestMatchItemonline_old(SearchKey, HardwareMatchType, clientinfo):
|
|
|
680
680
|
payload = json.dumps({
|
|
681
681
|
"SearchKey": SearchKey,
|
|
682
682
|
"TopN": 1000,
|
|
683
|
-
"AiUseType":
|
|
683
|
+
"AiUseType": 5,
|
|
684
684
|
"QueryAssetModelScopeRequest":
|
|
685
685
|
{"FlowTemplateIDs":
|
|
686
686
|
["6883468409742298119", "7514160571177913371", "6885245774565739523", "6883468929408437256",
|
|
@@ -791,6 +791,24 @@ def SoftwareApplyGetBestMatchItem(key, clientinfo):
|
|
|
791
791
|
return json.loads(response.text)
|
|
792
792
|
|
|
793
793
|
|
|
794
|
+
|
|
795
|
+
def SoftwareApplyGetBestMatchItem_SearchKey(key, clientinfo):
|
|
796
|
+
url = "https://it.bytedance.com/itam-byte/api/itservice/common/GetBestMatchItem"
|
|
797
|
+
payload = json.dumps({"SearchKey":"","TopN":5,"AiUseType":100,"SoftwareApplyRequest":{"Size":30,"Search":key},"psm":"athena"})
|
|
798
|
+
headers = {
|
|
799
|
+
'authorization': clientinfo.get(
|
|
800
|
+
'authorization') or 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6InYyIiwidHlwIjoiSldUIn0.eyJleHAiOjE3NTEwMDU1MjQsImp0aSI6IktJVVI5ZkdoZ2Q1cyt4NWIiLCJpYXQiOjE3NDk3MDk1MjQsImlzcyI6InRhbm5hIiwic3ViIjoiMzgzMDMxOUBieXRlZGFuY2UucGVvcGxlIiwidGVuYW50X2lkIjoiYnl0ZWRhbmNlLnBlb3BsZSIsInRlbmFudF9uYW1lIjoiIiwicHJvamVjdF9rZXkiOiJjcm1TZmdIVmU1dXhIMHJyIiwidW5pdCI6ImV1X25jIiwiYXV0aF9ieSI6Mn0.wtuTgUI6posLTQ-WJU539NuIYbMCgYqBrCOvdigR09h8zl_VO7tUJ4GSmfjDH8jZjtGSF-nEoDLPbX2z4BZkwtvoh--oa8KP-IIOOk2KQS2lVHz1mE7HWaEdCpml1_DS0PJB42F3B-L0EjRqQki_g3Jjn1kZjMgwFqpFW-TwcpY',
|
|
801
|
+
'cookie': clientinfo.get(
|
|
802
|
+
'cookie') or '_tea_utm_cache_1229=undefined; MONITOR_WEB_ID=ce5a3279-6ed5-4ede-9b00-29aa7c1a1311; amuserid=3830319@bytedance.people; msToken=TYcrN_92buBPnrV9MSb8i_0Uvz5lFxoWtnz8PA8MhLaAtrddfSUuR69V8vEJvRwEMDOyOAFL-PY87wN-oA4tKDroSbEvsjPNFn202nmCEcO9rKH9KINPWA==',
|
|
803
|
+
'Content-Type': 'application/json',
|
|
804
|
+
'x-use-ppe': '1',
|
|
805
|
+
'x-tt-env': clientinfo.get("x_tt_env")
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
response = requests.request("POST", url, headers=headers, data=payload)
|
|
809
|
+
time.sleep(5)
|
|
810
|
+
|
|
811
|
+
return json.loads(response.text)
|
|
794
812
|
if __name__ == '__main__':
|
|
795
813
|
info = {
|
|
796
814
|
'input': {'用户输入/userInput': 'Autodesk 3Ds MAX'},
|
|
@@ -2,10 +2,10 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="itam_assistant", # 包名称
|
|
5
|
-
version="0.1.
|
|
5
|
+
version="0.1.19", # 版本号
|
|
6
6
|
author="liujunmeiD",
|
|
7
7
|
author_email="1105030421@qq.com",
|
|
8
|
-
description="
|
|
8
|
+
description="新增-软件搜索",
|
|
9
9
|
long_description=open("README.md").read(),
|
|
10
10
|
long_description_content_type="text/markdown",
|
|
11
11
|
url="https://github.com/liujunmeiD/itam_assistant",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{itam_assistant-0.1.18 → itam_assistant-0.1.19}/itam_assistant.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|