(20250128) AI summarization bug fix.

This commit is contained in:
2025-01-28 18:20:32 +05:30
parent c3bc77c2cb
commit 751fdfc612
3 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -573,8 +573,8 @@ class GmailController(MailController):
message = mail_message, message = mail_message,
prompt_template = self.SENT_MAIL_SUMMARIZATION_PROMPT_TEMPLATE if is_sent else self.RECEIVED_MAIL_SUMMARIZATION_PROMPT_TEMPLATE prompt_template = self.SENT_MAIL_SUMMARIZATION_PROMPT_TEMPLATE if is_sent else self.RECEIVED_MAIL_SUMMARIZATION_PROMPT_TEMPLATE
) )
ai_json = ai_snippet.json
mail_message.aiSnippet = ai_snippet.summary mail_message.aiSnippet = ai_snippet.summary
ai_json = ai_snippet.output_json
mail_message.aiSnippet["output"] = ai_json["summary"] mail_message.aiSnippet["output"] = ai_json["summary"]
if ai_json["senderType"] is not None: mail_message.tags.append(ai_json["senderType"]) if ai_json["senderType"] is not None: mail_message.tags.append(ai_json["senderType"])
except Exception as exception: except Exception as exception:
-1
View File
@@ -259,7 +259,6 @@ class LLMOutput(BaseModel):
def to_json(self) -> dict: def to_json(self) -> dict:
dump = self.model_dump() dump = self.model_dump()
print("DUMP:", dump)
dump["invocationId"] = str(dump["invocationId"]) dump["invocationId"] = str(dump["invocationId"])
return dump return dump
@@ -196,6 +196,8 @@ class AsyncNimbusWhatsapp:
response_json = api_response.json() response_json = api_response.json()
) )
print("RESPONSE:", json.to_string(api_response.json()))
# If something goes wrong along the way: # If something goes wrong along the way:
except Exception as exception: except Exception as exception:
self.__printer(exception) self.__printer(exception)
@@ -217,12 +219,15 @@ if __name__ == "__main__":
async def main(): async def main():
sender = AsyncNimbusWhatsapp(api_key = "2c6175138e964ee8a6adc2af8faab726") # sender = AsyncNimbusWhatsapp(api_key = "2c6175138e964ee8a6adc2af8faab727") # ... TCAOFF 1
# sender = AsyncNimbusWhatsapp(api_key = "28ee15ef6df14105a855e8840540a791") # ... TCAOFF 2
sender = AsyncNimbusWhatsapp(api_key = "af82dd816b6c42958d052548f40ba5f9") # ... Mr. Gaurav Gupta
# sender = AsyncNimbusWhatsapp(api_key = "2b6aa961ad734611b932a8bd54747403") # ... Mr. Sumeet Shirke
api_result = await sender.send_whatsapp( api_result = await sender.send_whatsapp(
recipient_number = "919870391155", recipient_number = "7972314099",
# message = " ", message = f"Hello, Yatmesh ({datetime.datetime.now()})",
image_0_url = r"https://cdn.britannica.com/39/226539-050-D21D7721/Portrait-of-a-cat-with-whiskers-visible.jpg" # image_0_url = r"https://cdn.britannica.com/39/226539-050-D21D7721/Portrait-of-a-cat-with-whiskers-visible.jpg"
) )
print("WHATSAPP API RESULT:", api_result) print("WHATSAPP API RESULT:", api_result)
print("WHATSAPP API RESULT:", json.to_string(api_result.model_dump(), default = str)) print("WHATSAPP API RESULT:", json.to_string(api_result.model_dump(), default = str))