ws-bom-robot-app 0.0.31__py3-none-any.whl → 0.0.32__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.
@@ -42,7 +42,7 @@ async def __stream(rq: StreamRequest,queue: Queue,formatted: bool = True) -> Non
42
42
  settings.chat_history.append(HumanMessage(content=message.content))
43
43
  elif message.role == "assistant":
44
44
  message_content = ""
45
- if '{\"type\":\"string\"' in message.content:
45
+ if '{\"type\":\"text\"' in message.content:
46
46
  try:
47
47
  json_msg = json.loads('[' + message.content[:-1] + ']')
48
48
  for msg in json_msg:
@@ -75,13 +75,13 @@ async def __stream(rq: StreamRequest,queue: Queue,formatted: bool = True) -> Non
75
75
  )
76
76
  callbacks.append(nebuly_callback)
77
77
 
78
- with warnings.catch_warnings():
79
- warnings.simplefilter("ignore", UserWarning)
78
+ #with warnings.catch_warnings():
79
+ # warnings.simplefilter("ignore", UserWarning)
80
80
 
81
- await processor.executor.ainvoke(
82
- {"input": rq.messages[-1], "chat_history": settings.chat_history},
83
- {"callbacks": callbacks},
84
- )
81
+ await processor.executor.ainvoke(
82
+ {"input": rq.messages[-1], "chat_history": settings.chat_history},
83
+ {"callbacks": callbacks},
84
+ )
85
85
 
86
86
  # Signal the end of streaming
87
87
  await queue.put(None)
@@ -8,7 +8,7 @@ from ws_bom_robot_app.config import Settings, config
8
8
 
9
9
  class LlmMessage(BaseModel):
10
10
  role: str
11
- content: str
11
+ content: Union[str, list]
12
12
 
13
13
  class LlmSearchSettings(BaseModel):
14
14
  search_type: Optional[str] = Field('default', validation_alias=AliasChoices("searchType","search_type"))
@@ -7,6 +7,8 @@ from langchain_core.documents import Document
7
7
  from ws_bom_robot_app.llm.vector_store.loader.base import Loader
8
8
  from pydantic import BaseModel, Field, AliasChoices
9
9
  from typing import Optional, Union
10
+ import requests
11
+ import unstructured_ingest.connector.jira
10
12
 
11
13
  class JiraParams(BaseModel):
12
14
  """
@@ -26,13 +28,18 @@ class JiraParams(BaseModel):
26
28
  projects: list[str]
27
29
  boards: Optional[list[str]] | None = None
28
30
  issues: Optional[list[str]] | None = None
31
+ fieldsMappingUrl: Optional[str] | None = None
32
+
29
33
  class Jira(IntegrationStrategy):
34
+ DEFAULT_C_SEP = " " * 5
35
+ DEFAULT_R_SEP = "\n"
30
36
  def __init__(self, knowledgebase_path: str, data: dict[str, Union[str,int,list]]):
31
37
  super().__init__(knowledgebase_path, data)
32
38
  self.__data = JiraParams.model_validate(self.data)
33
39
  def working_subdirectory(self) -> str:
34
40
  return 'jira'
35
41
  def run(self) -> None:
42
+ unstructured_ingest.connector.jira._get_dropdown_fields_for_issue = self._get_dropdown_fields_for_issue
36
43
  access_config = JiraAccessConfig(
37
44
  api_token=self.__data.access_token
38
45
  )
@@ -56,3 +63,52 @@ class Jira(IntegrationStrategy):
56
63
  await asyncio.to_thread(self.run)
57
64
  await asyncio.sleep(1)
58
65
  return await Loader(self.working_directory).load()
66
+
67
+ def _remap_custom_fields(self, field_list):
68
+ auth = (self.__data.user_email, self.__data.access_token)
69
+ response = requests.get(self.__data.fieldsMappingUrl, auth=auth)
70
+
71
+ if response.status_code == 200:
72
+ mapper: dict = response.json()
73
+ remapped_field_list = {}
74
+ for field_key, field_value in field_list.items():
75
+ new_key = None
76
+ for map_item in mapper:
77
+ if field_key == map_item["id"]:
78
+ # Usa il nome mappato come nuova chiave
79
+ new_key = map_item["name"]
80
+ break
81
+
82
+ if new_key is None:
83
+ new_key = field_key
84
+
85
+ remapped_field_list[new_key] = field_value
86
+
87
+ return remapped_field_list
88
+
89
+ def _get_dropdown_fields_for_issue(self, issue, c_sep=DEFAULT_C_SEP, r_sep=DEFAULT_R_SEP):
90
+ all_fields = {}
91
+ for key, value in issue.items():
92
+ if value is not None:
93
+ if isinstance(value, list) and (len(value) > 0):
94
+ all_fields[key] = value
95
+ else:
96
+ all_fields[key] = value
97
+ mapped_fields = self._remap_custom_fields(all_fields)
98
+ return f"""
99
+ IssueType:{issue["issuetype"]["name"]}
100
+ {r_sep}
101
+ Status:{issue["status"]["name"]}
102
+ {r_sep}
103
+ Priority:{issue["priority"]}
104
+ {r_sep}
105
+ AssigneeID_Name:{issue["assignee"]["accountId"]}{c_sep}{issue["assignee"]["displayName"]}
106
+ {r_sep}
107
+ ReporterAdr_Name:{issue["reporter"]["emailAddress"]}{c_sep}{issue["reporter"]["displayName"]}
108
+ {r_sep}
109
+ Labels:{c_sep.join(issue["labels"])}
110
+ {r_sep}
111
+ Components:{c_sep.join([component["name"] for component in issue["components"]])}
112
+ {r_sep}
113
+ {(r_sep + c_sep ).join([f"{key}:{value}{r_sep}" for key, value in mapped_fields.items()])}
114
+ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ws_bom_robot_app
3
- Version: 0.0.31
3
+ Version: 0.0.32
4
4
  Summary: A FastAPI application serving ws bom/robot/llm platform ai.
5
5
  Home-page: https://github.com/websolutespa/bom
6
6
  Author: Websolute Spa
@@ -11,10 +11,10 @@ ws_bom_robot_app/llm/agent_handler.py,sha256=7b-H6PCkeFt4gDFv4oXO_Mg6A59MepWm0qw
11
11
  ws_bom_robot_app/llm/agent_lcel.py,sha256=O4FgzvKXuIP9VJgSBQtP26Xifx1r-fydD0LtlqUYzug,2730
12
12
  ws_bom_robot_app/llm/api.py,sha256=vBu_TFTlBjp7e3J-WmlZbXn_TbB550x-NpQN4YsO7To,3004
13
13
  ws_bom_robot_app/llm/defaut_prompt.py,sha256=CDsM6I6vOTklOKD1FK0v93P4TLPjdq7iCQ7wszCs6yE,765
14
- ws_bom_robot_app/llm/main.py,sha256=VL1xa8i28g4xpLdsxAOnnm-PlExJo1KoIlrGWUNe1jQ,4045
14
+ ws_bom_robot_app/llm/main.py,sha256=OgjWceJca1d3zd9TJHfdalcXAZMCyr8aO6VZGuqLWsY,4037
15
15
  ws_bom_robot_app/llm/settings.py,sha256=DCLaGZwxlw0xE46LpfUgin_FHD8_XJIthCgI6r2UDlM,121
16
16
  ws_bom_robot_app/llm/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- ws_bom_robot_app/llm/models/api.py,sha256=14CPG9hCu2rDMNrUGpvi9SOfKr-ALSBZfKtliSjnwEs,6570
17
+ ws_bom_robot_app/llm/models/api.py,sha256=ebyzuXcNNan8xzR94SfediHMJ5PymY4GoPYlfFQPdq4,6583
18
18
  ws_bom_robot_app/llm/models/base.py,sha256=1TqxuTK3rjJEALn7lvgoen_1ba3R2brAgGx6EDTtDZo,152
19
19
  ws_bom_robot_app/llm/models/kb.py,sha256=9zqwDlVULVrWE48wo5AivzWoOtnjA57k9rsw8KNnyDk,8935
20
20
  ws_bom_robot_app/llm/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -41,7 +41,7 @@ ws_bom_robot_app/llm/vector_store/integration/dropbox.py,sha256=yhGvHTN0TEpUfhdv
41
41
  ws_bom_robot_app/llm/vector_store/integration/gcs.py,sha256=fFDVDUR6eNB7FVTzDSEpMHFEWMgG16GLnpSf_mqGDdE,3184
42
42
  ws_bom_robot_app/llm/vector_store/integration/github.py,sha256=18PO30AZcgTn6PHhid3MwImVAdmKBNkr0kmAPgOetGw,2663
43
43
  ws_bom_robot_app/llm/vector_store/integration/googledrive.py,sha256=R6hr8iEgrR3QMOzIj5jY6w1x8pZ1LGdh4xM_q7g_ttc,3738
44
- ws_bom_robot_app/llm/vector_store/integration/jira.py,sha256=o5iINIblp_yNszp54nf7fW97aqjs0A5G89N8sYrd1ds,2771
44
+ ws_bom_robot_app/llm/vector_store/integration/jira.py,sha256=uiNkCOSqxOgm3AoO6k5TN_bsYXiO60I_wF0i_z8Yp8Y,4874
45
45
  ws_bom_robot_app/llm/vector_store/integration/manager.py,sha256=5Fl3XML6f1wmgraigpUwIFIXh7QFPX0RI0YFgFxBAvg,1700
46
46
  ws_bom_robot_app/llm/vector_store/integration/s3.py,sha256=3kh-VmH84IW7DdSLvOk6td1VBJ9aohlVJsk5F3cYj0U,3320
47
47
  ws_bom_robot_app/llm/vector_store/integration/sftp.py,sha256=WNzjjS1EUykgFB-8e7QkecSa1r1jTJqKyGzR25uJCtM,2848
@@ -52,7 +52,7 @@ ws_bom_robot_app/llm/vector_store/loader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
52
52
  ws_bom_robot_app/llm/vector_store/loader/base.py,sha256=Bv3r5YYAjLHp4sU_sxTk6-OmUdEgoVDqKL-xgWD9k_s,5240
53
53
  ws_bom_robot_app/llm/vector_store/loader/docling.py,sha256=12sMSH8DkEsC1Ctml2EIX2gs1BDnWWdynUEqGv-JAF4,2114
54
54
  ws_bom_robot_app/llm/vector_store/loader/json_loader.py,sha256=LDppW0ZATo4_1hh-KlsAM3TLawBvwBxva_a7k5Oz1sc,858
55
- ws_bom_robot_app-0.0.31.dist-info/METADATA,sha256=I8kp-oQ6Kl4hb8VNLlFwwcnKnyzNQrLb907OeoVLlB4,7756
56
- ws_bom_robot_app-0.0.31.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
57
- ws_bom_robot_app-0.0.31.dist-info/top_level.txt,sha256=Yl0akyHVbynsBX_N7wx3H3ZTkcMLjYyLJs5zBMDAKcM,17
58
- ws_bom_robot_app-0.0.31.dist-info/RECORD,,
55
+ ws_bom_robot_app-0.0.32.dist-info/METADATA,sha256=2k0lbPSs0i08ckNPoaohVty_UBeN7pIjpFfX1bLZ190,7756
56
+ ws_bom_robot_app-0.0.32.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
57
+ ws_bom_robot_app-0.0.32.dist-info/top_level.txt,sha256=Yl0akyHVbynsBX_N7wx3H3ZTkcMLjYyLJs5zBMDAKcM,17
58
+ ws_bom_robot_app-0.0.32.dist-info/RECORD,,