itam-assistant 0.1.6__tar.gz → 0.1.8__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.6 → itam_assistant-0.1.8}/PKG-INFO +2 -2
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant/do_ai.py +83 -44
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant.egg-info/PKG-INFO +2 -2
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/setup.py +2 -2
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/test/test.py +2 -2
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/README.md +0 -0
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant/__init__.py +0 -0
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant/ailyapp_client.py +0 -0
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant/config.py +0 -0
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant/intent_detail.py +0 -0
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant/lark_client.py +0 -0
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant/logger.py +0 -0
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant/openapi.py +0 -0
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant/test.py +0 -0
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant.egg-info/SOURCES.txt +0 -0
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant.egg-info/dependency_links.txt +0 -0
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant.egg-info/requires.txt +0 -0
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/itam_assistant.egg-info/top_level.txt +0 -0
- {itam_assistant-0.1.6 → itam_assistant-0.1.8}/setup.cfg +0 -0
|
@@ -68,7 +68,7 @@ def do_ai_auto(Testk_data, clientinfo):
|
|
|
68
68
|
# 可不需等待运行实例创建完成
|
|
69
69
|
# if not runs:
|
|
70
70
|
# raise ValueError("未能成功创建运行实例")
|
|
71
|
-
time.sleep(
|
|
71
|
+
time.sleep(2)
|
|
72
72
|
else:
|
|
73
73
|
return startAt, i
|
|
74
74
|
break
|
|
@@ -81,23 +81,26 @@ def do_ai_auto(Testk_data, clientinfo):
|
|
|
81
81
|
tenant_access_token = AilyLarkClient(clientinfo).get_tenant_access_token()
|
|
82
82
|
if not tenant_access_token:
|
|
83
83
|
raise ValueError("未能获取到有效的租户访问令牌")
|
|
84
|
-
|
|
84
|
+
if i['ext'].get('input'):
|
|
85
|
+
aa = i['ext']['input']
|
|
86
|
+
else:
|
|
87
|
+
aa = i['ext']['用户输入']
|
|
85
88
|
if startAt == 0:
|
|
86
89
|
startAt = int(time.time())
|
|
87
90
|
# 创建会话
|
|
88
91
|
seseion_id = AilyLarkClient(clientinfo).create_ailysession(tenant_access_token)
|
|
89
|
-
time.sleep(
|
|
92
|
+
time.sleep(2)
|
|
90
93
|
if not seseion_id:
|
|
91
94
|
raise ValueError("未能成功创建会话")
|
|
92
95
|
# 创建消息
|
|
93
96
|
message_id = AilyLarkClient(clientinfo).create_ailysessionaily_message(tenant_access_token, seseion_id,
|
|
94
97
|
aa)
|
|
95
|
-
time.sleep(
|
|
98
|
+
time.sleep(2)
|
|
96
99
|
if not message_id:
|
|
97
100
|
raise ValueError("未能成功创建消息")
|
|
98
101
|
# 创建运行实例
|
|
99
102
|
runs = AilyLarkClient(clientinfo).create_ailysession_run(tenant_access_token, seseion_id)
|
|
100
|
-
time.sleep(
|
|
103
|
+
time.sleep(2)
|
|
101
104
|
num = num + 1
|
|
102
105
|
return startAt, num
|
|
103
106
|
except KeyError as ke:
|
|
@@ -316,12 +319,13 @@ def do_waterlevellineres_sr(res, info,hardtype):
|
|
|
316
319
|
info['label'].append(copy.deepcopy(aaa))
|
|
317
320
|
# 判断label0和label1是否为空,为空则:label默认2级
|
|
318
321
|
# 判断exp和label是否一致,一致则:rt=True,不一致则:rt=False
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
322
|
+
# 判断label0和label1是否为空,为空则:label默认2级
|
|
323
|
+
for a in range(len(info['exp'])):
|
|
324
|
+
if info['exp'][a]['label'] == info['label'][a]['label']:
|
|
325
|
+
info['rt'] = True
|
|
326
|
+
else:
|
|
327
|
+
info['rt'] = False
|
|
328
|
+
break
|
|
325
329
|
else:
|
|
326
330
|
info['label'] = info['label'] = [{'label': '', 'score': 0}, {'label': '', 'score': 0}]
|
|
327
331
|
info['rt'] = False
|
|
@@ -334,12 +338,12 @@ def do_metricsevaluation_list(collections,data,score_threshold):
|
|
|
334
338
|
"""
|
|
335
339
|
info = {
|
|
336
340
|
"input": {
|
|
337
|
-
"
|
|
341
|
+
"用户输入": "测试数据"
|
|
338
342
|
},
|
|
339
343
|
"output": {
|
|
340
|
-
"
|
|
344
|
+
"output": "测试数据"
|
|
341
345
|
},
|
|
342
|
-
"rt":
|
|
346
|
+
"rt": False,
|
|
343
347
|
"label": [{"label": "测试"}, {"label": "测试"}],
|
|
344
348
|
"exp": [{"label": "测试"}, {"label": "测试" }],
|
|
345
349
|
"artificial": []
|
|
@@ -348,33 +352,28 @@ def do_metricsevaluation_list(collections,data,score_threshold):
|
|
|
348
352
|
businessscenario = []
|
|
349
353
|
for i in collections:
|
|
350
354
|
for j in data:
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
"exp": [{"label": "测试",}, {"label": "测试"}],
|
|
358
|
-
"artificial": []
|
|
359
|
-
}
|
|
360
|
-
info['input']['用户输入/userInput'] = i['ext']['output']
|
|
361
|
-
info['output']['用户输入/output'] = "对话id:"+j['对话日志/intentID']+" 对话内容:"+j['用户输入/userInput']
|
|
362
|
-
if i['ext']['BPO标注-AP-分发技能'] != '' and i['ext']['BPO标注-AP-分发技能'] in j['分发技能/skill'][0]:
|
|
355
|
+
cleaned_content = i['content'].replace('\r', '').replace('\n', '').replace('\\', '')
|
|
356
|
+
cleaned_userInput = j['用户输入/userInput'].replace('\r', '').replace('\n', '').replace('\\', '')
|
|
357
|
+
if cleaned_content == cleaned_userInput:
|
|
358
|
+
info['input']['用户输入'] = i['ext'].get('input') or i['ext']['用户输入']
|
|
359
|
+
info['output']['output'] = "对话id:"+j['对话日志/intentID']+" 对话内容:"+j['用户输入/userInput']
|
|
360
|
+
if i['ext']['分发技能'] != '' and i['ext']['分发技能'] in j['分发技能/skill'][0]:
|
|
363
361
|
info['rt'] = True
|
|
364
362
|
info['label'] = [{'label': j['分发技能/skill'][0]}]
|
|
365
|
-
info['exp'] = [{'label':
|
|
363
|
+
info['exp'] = [{'label': i['ext']['分发技能']}]
|
|
366
364
|
info['artificial'] = info['exp']
|
|
367
365
|
else:
|
|
368
366
|
info['rt'] = False
|
|
369
367
|
info['label'] = [{'label': j['分发技能/skill'][0]}]
|
|
370
|
-
info['exp'] = [{'label': i['ext']['
|
|
368
|
+
info['exp'] = [{'label': i['ext']['分发技能']}]
|
|
371
369
|
info['artificial'] = info['exp']
|
|
372
|
-
if i['ext']['
|
|
373
|
-
businessscenario.append(i['ext']['
|
|
370
|
+
if i['ext']['分发技能'] not in businessscenario:
|
|
371
|
+
businessscenario.append(i['ext']['分发技能'])
|
|
374
372
|
#将data中的j删除
|
|
375
373
|
data.remove(j)
|
|
374
|
+
info_list.append(copy.deepcopy(info))
|
|
375
|
+
print(info)
|
|
376
376
|
break
|
|
377
|
-
info_list.append(copy.deepcopy(info))
|
|
378
377
|
return info_list,businessscenario
|
|
379
378
|
|
|
380
379
|
|
|
@@ -730,7 +729,7 @@ def do_waterlevelline_autotest_SoftwareApplyRecommendList(collections, clientinf
|
|
|
730
729
|
"用户输入/userInput": "我要申请软件,名字叫:ai_xzh_all_restricted_software完全受限软件"
|
|
731
730
|
},
|
|
732
731
|
"output": {
|
|
733
|
-
"
|
|
732
|
+
"实际输出/output": "我要申请软件,名字叫:ai_xzh_all_restricted_software完全受限软件"
|
|
734
733
|
},
|
|
735
734
|
"rt": True,
|
|
736
735
|
"label": [{"label": "GUI 软件申请", "score": 0.6}, {"label": "软件申请", "score": 0.5}],
|
|
@@ -740,16 +739,24 @@ def do_waterlevelline_autotest_SoftwareApplyRecommendList(collections, clientinf
|
|
|
740
739
|
}
|
|
741
740
|
a =0
|
|
742
741
|
for i in collections:
|
|
743
|
-
info['input']['用户输入/userInput'] = i['ext'].get('
|
|
744
|
-
info['output']['
|
|
745
|
-
info['exp'] = [
|
|
746
|
-
|
|
747
|
-
|
|
742
|
+
info['input']['用户输入/userInput'] = i['ext'].get('BPO标注-AP-资产名称') or i['ext'].get('BPO标注-AP-资产名称')
|
|
743
|
+
info['output']['实际输出/output'] = i['ext']['BPO标注-AP-资产名称']
|
|
744
|
+
info['exp'] = []
|
|
745
|
+
for j in [i['ext']['BPO标注-AP-资产型号'], i['ext'].get('BPO标注-AP-资产型号1'),
|
|
746
|
+
i['ext'].get('BPO标注-AP-资产型号2'), i['ext'].get('BPO标注-AP-资产型号3'),
|
|
747
|
+
i['ext'].get('BPO标注-AP-资产型号4'), i['ext'].get('BPO标注-AP-资产型号5'),
|
|
748
|
+
i['ext'].get('BPO标注-AP-资产型号6'), i['ext'].get('BPO标注-AP-资产型号7'),
|
|
749
|
+
i['ext'].get('BPO标注-AP-资产型号8'), i['ext'].get('BPO标注-AP-资产型号9'),
|
|
750
|
+
i['ext'].get('BPO标注-AP-资产型号10')]:
|
|
751
|
+
if j:
|
|
752
|
+
info['exp'].append({'label': j, 'score': score_threshold})
|
|
753
|
+
if info['exp'] == '':
|
|
754
|
+
break
|
|
748
755
|
info['artificial'] = info['exp']
|
|
749
756
|
info['label']=[]
|
|
750
|
-
if i['ext']['
|
|
751
|
-
if "软件" in i['ext']['
|
|
752
|
-
asset_name = i['ext']['
|
|
757
|
+
if i['ext']['BPO标注-AP-资产名称']:
|
|
758
|
+
if "软件" in i['ext']['BPO标注-AP-分发技能']:
|
|
759
|
+
asset_name = i['ext']['BPO标注-AP-资产名称']
|
|
753
760
|
try:
|
|
754
761
|
# 尝试将其解析为 JSON 对象
|
|
755
762
|
if isinstance(asset_name, str):
|
|
@@ -785,6 +792,7 @@ def do_waterlevellineres_software(res, info):
|
|
|
785
792
|
return info
|
|
786
793
|
reslist=res["data"]["SoftwareApplyRecommendList"]
|
|
787
794
|
aaa ={}
|
|
795
|
+
info['output']['实际输出/output'] = 'requestId:'+res.get('requestId')
|
|
788
796
|
# 判断res["body"]["Results"]不为空,空则:label0 label1 为空,label默认2级
|
|
789
797
|
if reslist:
|
|
790
798
|
# 取["Results"]下前2个结果,若只有1个结果,label1为空
|
|
@@ -793,15 +801,46 @@ def do_waterlevellineres_software(res, info):
|
|
|
793
801
|
aaa = {'label': reslist[j]['Data']['Name']['ValueZh'],
|
|
794
802
|
'score': reslist[j]['Score']}
|
|
795
803
|
info['label'].append(copy.deepcopy(aaa))
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
else:
|
|
799
|
-
info['rt'] = False
|
|
804
|
+
|
|
805
|
+
info['rt'] = do_businessassertionrules(info['label'],info['exp'])
|
|
800
806
|
else:
|
|
801
807
|
info['label'] = info['label'] = [{'label': '', 'score': 0}, {'label': '', 'score': 0}]
|
|
802
808
|
info['rt'] = False
|
|
803
809
|
return info
|
|
804
810
|
|
|
811
|
+
def do_businessassertionrules(label, epx):
|
|
812
|
+
"""
|
|
813
|
+
业务断言
|
|
814
|
+
:param res:
|
|
815
|
+
:param info:
|
|
816
|
+
:return:
|
|
817
|
+
"""
|
|
818
|
+
# 当预期值或实际值列表为空时,直接返回 False
|
|
819
|
+
if not epx or not label:
|
|
820
|
+
return False
|
|
821
|
+
|
|
822
|
+
# 规则1:当预期值为1维时
|
|
823
|
+
if len(epx) == 1:
|
|
824
|
+
return epx[0]['label'] == label[0]['label']
|
|
825
|
+
|
|
826
|
+
# 规则2:当预期值大于等于 实际值时,判断预期值包含实际值
|
|
827
|
+
if len(epx) >= len(label):
|
|
828
|
+
for i in range(len(label)):
|
|
829
|
+
if epx[i]['label'] != label[i]['label']:
|
|
830
|
+
return False
|
|
831
|
+
return True
|
|
832
|
+
|
|
833
|
+
# 规则3:当预期值小于 实际值时,判断实际值包含预期值
|
|
834
|
+
for i in range(len(epx)):
|
|
835
|
+
if epx[i]['label'] != label[i]['label']:
|
|
836
|
+
return False
|
|
837
|
+
return True
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
805
844
|
def get_conversationlogs1(startAt):
|
|
806
845
|
"""
|
|
807
846
|
对话ID 技能分发 用户输入
|
|
@@ -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.8", # 版本号
|
|
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",
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import csv
|
|
3
3
|
import json
|
|
4
4
|
import copy
|
|
5
|
-
from
|
|
5
|
+
from itam_assistant1.do_ai import do_ai_auto
|
|
6
6
|
|
|
7
7
|
# 假设 Testsuitelink 是一个有效的文档链接
|
|
8
|
-
from
|
|
8
|
+
from itam_assistant1.openapi import get_query_vector
|
|
9
9
|
|
|
10
10
|
Testsuitelink = "your_testsuitelink_here"
|
|
11
11
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|