AIEmailAutomationUtility 0.0.34__py3-none-any.whl → 0.0.35__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.
@@ -4,10 +4,10 @@ from email.message import Message
4
4
  import datetime
5
5
  import time
6
6
  import loggerutility as logger
7
- from flask import Flask,request
8
7
  import json
9
8
  from email.mime.multipart import MIMEMultipart
10
9
  from email.mime.text import MIMEText
10
+ from bs4 import BeautifulSoup
11
11
 
12
12
  class Email_Draft:
13
13
  def draft_email(self, email_config, email_details, response_content):
@@ -60,6 +60,7 @@ class Email_Draft:
60
60
  # Extract response content
61
61
  body = response_content.get('body', '')
62
62
  table_html = response_content.get('table_', '')
63
+ aligned_table_html = self.align_numeric_cells_right(table_html)
63
64
  signature = response_content.get('signature', '')
64
65
  email_body = email_details['body']
65
66
 
@@ -72,7 +73,7 @@ class Email_Draft:
72
73
  html_content = (
73
74
  "<html><body>"
74
75
  f"<p>{body_html}</p>"
75
- f"{table_html}"
76
+ f"{aligned_table_html}"
76
77
  f"<b>GST Extra as per applicable.</b>"
77
78
  f"<p>{signature_html}</p>"
78
79
  "<hr>"
@@ -174,3 +175,26 @@ class Email_Draft:
174
175
 
175
176
  except Exception as e:
176
177
  logger.log(f"Error in Draft_Save: {str(e)}")
178
+
179
+ def align_numeric_cells_right(self,table_html):
180
+ soup = BeautifulSoup(table_html, 'html.parser')
181
+ rows = soup.find_all('tr')
182
+
183
+ for row in rows[1:]: # Skip header row
184
+ cells = row.find_all('td')
185
+ for cell in cells:
186
+ text = cell.get_text(strip=True)
187
+ # Check if the content is numeric (int or float)
188
+ try:
189
+ float(text.replace(',', '')) # Handle values like '7,500.00'
190
+ # If 'text-align: right;' is not present, add it
191
+ style = cell.get('style', '')
192
+ if 'text-align: right' not in style:
193
+ if style:
194
+ style += '; '
195
+ style += 'text-align: right;'
196
+ cell['style'] = style
197
+ except ValueError:
198
+ continue # Not numeric
199
+
200
+ return str(soup)
@@ -592,6 +592,9 @@ class Process_Category:
592
592
  if ai_result["status"] == "Success":
593
593
  logger.log(f"ai_result ::: {ai_result}")
594
594
  product_data = json.loads(ai_result["message"])
595
+ # If it's a dict, wrap in list
596
+ if isinstance(product_data, dict):
597
+ product_data = json.dumps([product_data], indent=4)
595
598
  else:
596
599
  product_data = []
597
600
  return product_data
@@ -635,10 +638,8 @@ class Process_Category:
635
638
  Sr. No., Requested Description, Item Code, Item Description, Make, Inventory Unit, Price, Discount, Rate, Quantity, Total, Price Pickup Source, Availability
636
639
 
637
640
  - If any value is missing, use a dash ("-") instead.
638
- - "Total" is calculated as Rate × Quantity.
639
641
  - "Availability" should be a blank column.
640
- - Only the numeric values in the table rows are right-aligned(Ensure the alignment applies only to the data cells (i.e., <td>), not the header cells (<th>).)
641
- Original Email Subject: {subject}
642
+ Original Email Subject: {subject}
642
643
 
643
644
  Return only the following JSON String format:
644
645
  {{
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: AIEmailAutomationUtility
3
- Version: 0.0.34
4
- Summary: Added a vector lookup for fallback products those return as NA.
3
+ Version: 0.0.35
4
+ Summary: Aligned numeric cells in the Email Draft table and ensured that the Identify Products function returns a JSON array only.
5
5
  Author: Proteus Technology PVT. LTD.
6
6
  Author-email: <apps@baseinformation.com>
7
7
  Keywords: python,first package
@@ -13,4 +13,4 @@ Classifier: Operating System :: MacOS :: MacOS X
13
13
  Classifier: Operating System :: Microsoft :: Windows
14
14
  License-File: LICENCE.txt
15
15
 
16
- Added a vector lookup for fallback products those return as NA.
16
+ Aligned numeric cells in the Email Draft table and ensured that the Identify Products function returns a JSON array only.
@@ -1,15 +1,15 @@
1
1
  AIEmailAutomationUtility/EmailReplyAssistant.py,sha256=R_wJna3-ITsVxQEccryhM93T_Nf_Oxo8DXnS-sDN8VE,6679
2
2
  AIEmailAutomationUtility/Email_Classification.py,sha256=Ar0g4Ff8HOT7xICktd3nP_C_vCyeY-xCpUjVCVRWAyc,9417
3
3
  AIEmailAutomationUtility/Email_DocumentUploader.py,sha256=BWNRt2X-E2HCogBaKDfl7cZZNSkZUeIsVs8iXjFjH88,3218
4
- AIEmailAutomationUtility/Email_Draft.py,sha256=JYZijUh_zan2asyMYQwIBwIpGNJ5SSQGma5AL1meaXk,7808
4
+ AIEmailAutomationUtility/Email_Draft.py,sha256=TGLqV0yzXLIdBnRcEY3CgmcDJVgiP3LN1vLPXTBj5rY,8831
5
5
  AIEmailAutomationUtility/Email_Read.py,sha256=_JwHTJZmxjuMPTbn90D9YStW7NSJd3t4R_cwUZ1tn20,31470
6
6
  AIEmailAutomationUtility/Email_Upload_Document.py,sha256=3bdkxfDlwoeRp-46KPw2Gs1dqBhEIoA1yE5GCudpdV8,1320
7
- AIEmailAutomationUtility/Process_Category.py,sha256=IMqvDVvuMNeLtQ2heFIyp1UKkz2AN1hAT02lXo8Pywk,53664
7
+ AIEmailAutomationUtility/Process_Category.py,sha256=RfOdZq4GnHlWVprSrKf_PQrx48QuFhav3CUwnEzOlOg,53585
8
8
  AIEmailAutomationUtility/Save_Draft.py,sha256=yzLgFN14I_lXE6qL0I3tKNduvcnWdbsY9i2mKdTtio4,5348
9
9
  AIEmailAutomationUtility/Save_Transaction.py,sha256=Gg1w6hhzHmEFjsuzYvkq-3-EsWReetjLHsYSv5YIGgM,3816
10
10
  AIEmailAutomationUtility/__init__.py,sha256=Jad3IdPRsVMeLqEEh-FbCrc1lE2tzJO2DTG5Hgmxh5g,391
11
- AIEmailAutomationUtility-0.0.34.dist-info/LICENCE.txt,sha256=2qX9IkEUBx0VJp1Vh9O2dsRwE-IpYId0lXDyn7OVsJ8,1073
12
- AIEmailAutomationUtility-0.0.34.dist-info/METADATA,sha256=eCpEKv1Cvin8-cceIQZ6OvbOsZ36o9EeijDAYgrM7Pw,627
13
- AIEmailAutomationUtility-0.0.34.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
14
- AIEmailAutomationUtility-0.0.34.dist-info/top_level.txt,sha256=3jTWrTUblVkaP7mpwY2UBSnrlfot5Ykpfsehyke-Uzw,25
15
- AIEmailAutomationUtility-0.0.34.dist-info/RECORD,,
11
+ AIEmailAutomationUtility-0.0.35.dist-info/LICENCE.txt,sha256=2qX9IkEUBx0VJp1Vh9O2dsRwE-IpYId0lXDyn7OVsJ8,1073
12
+ AIEmailAutomationUtility-0.0.35.dist-info/METADATA,sha256=H3FAgTui1ayJB9Q-opXbEKkgkqv1ORrrD6PXVVDnQEI,743
13
+ AIEmailAutomationUtility-0.0.35.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
14
+ AIEmailAutomationUtility-0.0.35.dist-info/top_level.txt,sha256=3jTWrTUblVkaP7mpwY2UBSnrlfot5Ykpfsehyke-Uzw,25
15
+ AIEmailAutomationUtility-0.0.35.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.45.1)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5