itam-assistant 0.1.7__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.
Files changed (19) hide show
  1. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/PKG-INFO +1 -1
  2. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant/do_ai.py +77 -33
  3. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant.egg-info/PKG-INFO +1 -1
  4. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/setup.py +1 -1
  5. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/test/test.py +2 -2
  6. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/README.md +0 -0
  7. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant/__init__.py +0 -0
  8. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant/ailyapp_client.py +0 -0
  9. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant/config.py +0 -0
  10. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant/intent_detail.py +0 -0
  11. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant/lark_client.py +0 -0
  12. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant/logger.py +0 -0
  13. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant/openapi.py +0 -0
  14. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant/test.py +0 -0
  15. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant.egg-info/SOURCES.txt +0 -0
  16. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant.egg-info/dependency_links.txt +0 -0
  17. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant.egg-info/requires.txt +0 -0
  18. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/itam_assistant.egg-info/top_level.txt +0 -0
  19. {itam_assistant-0.1.7 → itam_assistant-0.1.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: itam_assistant
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: 优化版本--技能分发的结果展示
5
5
  Home-page: https://github.com/liujunmeiD/itam_assistant
6
6
  Author: liujunmeiD
@@ -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(5)
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
- aa = i['ext']['input']
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(10)
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(5)
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(5)
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
- if info['exp'][0]['label'] == info['label'][0]['label'] and info['exp'][1]['label'] == info['label'][1][
320
- 'label'] and info['exp'][0]['score'] <= info['label'][0]['score'] and info['exp'][1]['score'] <= \
321
- info['label'][1]['score']:
322
- info['rt'] = True
323
- else:
324
- info['rt'] = False
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,10 +338,10 @@ def do_metricsevaluation_list(collections,data,score_threshold):
334
338
  """
335
339
  info = {
336
340
  "input": {
337
- "用户输入/userInput": "测试数据"
341
+ "用户输入": "测试数据"
338
342
  },
339
343
  "output": {
340
- "用户输入/output": "测试数据"
344
+ "output": "测试数据"
341
345
  },
342
346
  "rt": False,
343
347
  "label": [{"label": "测试"}, {"label": "测试"}],
@@ -351,20 +355,20 @@ def do_metricsevaluation_list(collections,data,score_threshold):
351
355
  cleaned_content = i['content'].replace('\r', '').replace('\n', '').replace('\\', '')
352
356
  cleaned_userInput = j['用户输入/userInput'].replace('\r', '').replace('\n', '').replace('\\', '')
353
357
  if cleaned_content == cleaned_userInput:
354
- info['input']['用户输入/userInput'] = i['ext']['input']
355
- info['output']['用户输入/output'] = "对话id:"+j['对话日志/intentID']+" 对话内容:"+j['用户输入/userInput']
356
- if i['ext']['BPO标注-AP-分发技能'] != '' and i['ext']['BPO标注-AP-分发技能'] in j['分发技能/skill'][0]:
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]:
357
361
  info['rt'] = True
358
362
  info['label'] = [{'label': j['分发技能/skill'][0]}]
359
- info['exp'] = [{'label': i['ext']['BPO标注-AP-分发技能']}]
363
+ info['exp'] = [{'label': i['ext']['分发技能']}]
360
364
  info['artificial'] = info['exp']
361
365
  else:
362
366
  info['rt'] = False
363
367
  info['label'] = [{'label': j['分发技能/skill'][0]}]
364
- info['exp'] = [{'label': i['ext']['BPO标注-AP-分发技能']}]
368
+ info['exp'] = [{'label': i['ext']['分发技能']}]
365
369
  info['artificial'] = info['exp']
366
- if i['ext']['BPO标注-AP-分发技能'] not in businessscenario:
367
- businessscenario.append(i['ext']['BPO标注-AP-分发技能'])
370
+ if i['ext']['分发技能'] not in businessscenario:
371
+ businessscenario.append(i['ext']['分发技能'])
368
372
  #将data中的j删除
369
373
  data.remove(j)
370
374
  info_list.append(copy.deepcopy(info))
@@ -725,7 +729,7 @@ def do_waterlevelline_autotest_SoftwareApplyRecommendList(collections, clientinf
725
729
  "用户输入/userInput": "我要申请软件,名字叫:ai_xzh_all_restricted_software完全受限软件"
726
730
  },
727
731
  "output": {
728
- "用户输入/output": "我要申请软件,名字叫:ai_xzh_all_restricted_software完全受限软件"
732
+ "实际输出/output": "我要申请软件,名字叫:ai_xzh_all_restricted_software完全受限软件"
729
733
  },
730
734
  "rt": True,
731
735
  "label": [{"label": "GUI 软件申请", "score": 0.6}, {"label": "软件申请", "score": 0.5}],
@@ -735,16 +739,24 @@ def do_waterlevelline_autotest_SoftwareApplyRecommendList(collections, clientinf
735
739
  }
736
740
  a =0
737
741
  for i in collections:
738
- info['input']['用户输入/userInput'] = i['ext'].get('BP标注-AP-资产名称') or i['ext'].get('BPO标注-AP-资产名称')
739
- info['output']['用户输入/output'] = i['ext']['BP标注-AP-资产名称']
740
- info['exp'] = [
741
- {'label': i['ext']['BP标注-AP-资产名称'], 'score': score_threshold},
742
- {'label': i['ext'].get('BP标注-AP-资产型号1', ''), 'score': score_threshold}]
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
743
755
  info['artificial'] = info['exp']
744
756
  info['label']=[]
745
- if i['ext']['BP标注-AP-资产名称']:
746
- if "软件" in i['ext']['BP标注-AP-分发技能']:
747
- asset_name = i['ext']['BP标注-AP-资产名称']
757
+ if i['ext']['BPO标注-AP-资产名称']:
758
+ if "软件" in i['ext']['BPO标注-AP-分发技能']:
759
+ asset_name = i['ext']['BPO标注-AP-资产名称']
748
760
  try:
749
761
  # 尝试将其解析为 JSON 对象
750
762
  if isinstance(asset_name, str):
@@ -780,6 +792,7 @@ def do_waterlevellineres_software(res, info):
780
792
  return info
781
793
  reslist=res["data"]["SoftwareApplyRecommendList"]
782
794
  aaa ={}
795
+ info['output']['实际输出/output'] = 'requestId:'+res.get('requestId')
783
796
  # 判断res["body"]["Results"]不为空,空则:label0 label1 为空,label默认2级
784
797
  if reslist:
785
798
  # 取["Results"]下前2个结果,若只有1个结果,label1为空
@@ -788,15 +801,46 @@ def do_waterlevellineres_software(res, info):
788
801
  aaa = {'label': reslist[j]['Data']['Name']['ValueZh'],
789
802
  'score': reslist[j]['Score']}
790
803
  info['label'].append(copy.deepcopy(aaa))
791
- if info['exp'][0]['label'] == info['label'][0]['label'] and info['exp'][0]['score'] <= info['label'][0]['score']:
792
- info['rt'] = True
793
- else:
794
- info['rt'] = False
804
+
805
+ info['rt'] = do_businessassertionrules(info['label'],info['exp'])
795
806
  else:
796
807
  info['label'] = info['label'] = [{'label': '', 'score': 0}, {'label': '', 'score': 0}]
797
808
  info['rt'] = False
798
809
  return info
799
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
+
800
844
  def get_conversationlogs1(startAt):
801
845
  """
802
846
  对话ID 技能分发 用户输入
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: itam-assistant
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: 优化版本--技能分发的结果展示
5
5
  Home-page: https://github.com/liujunmeiD/itam_assistant
6
6
  Author: liujunmeiD
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="itam_assistant", # 包名称
5
- version="0.1.7", # 版本号
5
+ version="0.1.8", # 版本号
6
6
  author="liujunmeiD",
7
7
  author_email="1105030421@qq.com",
8
8
  description="优化版本--技能分发的结果展示",
@@ -2,10 +2,10 @@
2
2
  import csv
3
3
  import json
4
4
  import copy
5
- from itam_assistant.do_ai import do_ai_auto
5
+ from itam_assistant1.do_ai import do_ai_auto
6
6
 
7
7
  # 假设 Testsuitelink 是一个有效的文档链接
8
- from itam_assistant.openapi import get_query_vector
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