letschatty 0.4.338__py3-none-any.whl → 0.4.340__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.
@@ -211,6 +211,25 @@ class ChatService:
211
211
  ChatService.add_central_notification_from_text(chat=chat, body=f"Agente de IA {chatty_ai_agent.name} actualizado en el chat {chat.id} por {execution_context.executor.name}", subtype=MessageSubtype.CHATTY_AI_AGENT_UPDATED)
212
212
  return chat.chatty_ai_agent
213
213
 
214
+ @staticmethod
215
+ def escalate_chatty_ai_agent(chat: Chat, execution_context: ExecutionContext, message: Optional[str] = None) -> None:
216
+ """
217
+ Mark the chat's AI agent as requiring human intervention and add a central notification.
218
+ """
219
+ if chat.chatty_ai_agent and not chat.chatty_ai_agent.requires_human_intervention:
220
+ chat.chatty_ai_agent.requires_human_intervention = True
221
+ execution_context.set_event_time(datetime.now(tz=ZoneInfo("UTC")))
222
+ body = "El chat fue escalado a un agente humano"
223
+ if message:
224
+ body = f"{body}: {message}"
225
+ ChatService.add_central_notification_from_text(
226
+ chat=chat,
227
+ body=body,
228
+ subtype=MessageSubtype.CHATTY_AI_AGENT_NOTIFICATION,
229
+ content_status=CentralNotificationStatus.WARNING,
230
+ context=ChattyContext(chain_of_thought_id=execution_context.chain_of_thought_id)
231
+ )
232
+
214
233
  @staticmethod
215
234
  def add_workflow_link(chat : Chat, link : LinkItem, flow:FlowPreview, execution_context: ExecutionContext, description: str, last_incoming_message_id: Optional[str] = None, next_call: Optional[datetime] = None) -> FlowStateAssignedToChat:
216
235
  """
@@ -873,9 +892,16 @@ class ChatService:
873
892
  execution_context.set_event_time(datetime.now(tz=ZoneInfo("UTC")))
874
893
  logger.info(f"Updated collected data for chat {chat.id}: {', '.join(updated_fields)}")
875
894
 
895
+ field_label_map = {
896
+ "name": "nombre",
897
+ "email": "email",
898
+ "phone": "telefono",
899
+ "document_id": "dni",
900
+ }
901
+ display_fields = [field_label_map.get(field, field) for field in updated_fields]
876
902
  ChatService.add_central_notification_from_text(
877
903
  chat=chat,
878
- body=f"Collected customer data: {', '.join(updated_fields)}",
904
+ body=f"Datos del cliente recopilados: {', '.join(display_fields)}",
879
905
  subtype=MessageSubtype.CLIENT_INFO_UPDATED,
880
906
  context=ChattyContext(chain_of_thought_id=execution_context.chain_of_thought_id)
881
907
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: letschatty
3
- Version: 0.4.338
3
+ Version: 0.4.340
4
4
  Summary: Models and custom classes to work across the Chattyverse
5
5
  License: MIT
6
6
  Author: Axel
@@ -124,7 +124,6 @@ letschatty/models/company/assets/users/user_asset_permission.py,sha256=wZ8MJhFoh
124
124
  letschatty/models/company/assets/workflow_execution.py,sha256=CKlT9JTryKC8kNniRXOHOgfF3Id-Cr0ufx5daQH-j58,3081
125
125
  letschatty/models/company/company_chats_snapshot.py,sha256=Mg9Wmu3pfE-t5Sf57FCj-psvc5TkDkFfma-hdh6nE0Q,668
126
126
  letschatty/models/company/company_messaging_settgins.py,sha256=7isXt7gmqw-FKSUSZwdctdXDFMfPi2OyPuWqB7WpC6c,957
127
- letschatty/models/company/company_shopify_integration.py,sha256=jE32t_PbU7D8eVCP8y66vDiznckvQI5frnkEwHbK5hg,356
128
127
  letschatty/models/company/conversation_topic.py,sha256=__IinJ3YcUsiApF4Em5uAgd01ydRUrlCVxaat-pCCRg,1704
129
128
  letschatty/models/company/empresa.py,sha256=2INPC8YSZJcT10Gny_zXV_PujeqUGccsZHV31ZSywyw,5961
130
129
  letschatty/models/company/form_field.py,sha256=LGyMLybwvfEPG3hMmwsoP_4wnMaPJbVFpG6c1HdVC8E,9802
@@ -231,7 +230,7 @@ letschatty/services/ai_agents/tool_descriptions/human_handover.json,sha256=-b3l_
231
230
  letschatty/services/ai_agents/tool_descriptions.py,sha256=MMFhcgEl6Z7k8BUv3Yx1pCxHzIjc8HD93S0uM5OPj8Y,105
232
231
  letschatty/services/ai_components_service.py,sha256=QUb-NdzHj4nPmnceVSQ9Pe3swFWUrkUFKzDZeuP0b5o,3762
233
232
  letschatty/services/chat/chat_extractors.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
234
- letschatty/services/chat/chat_service.py,sha256=DsnjSYmOXGSRQPtnYEx2O4NPdEXpG1GBOjk53M-jYM8,47832
233
+ letschatty/services/chat/chat_service.py,sha256=BQK-xVm9BMPwnoEcZHufhevMJIJ5yzhZnCoyFf0qp5s,49068
235
234
  letschatty/services/chat/client_service.py,sha256=TtlG0GJDqx6YemfueiJzAtMNk_udnPhg0MJG0bKwnk8,1097
236
235
  letschatty/services/chat/conversation_topics_service.py,sha256=jvIkpHTCz0JKXui3n_BRs6UQ-TB3x7DrQsnX2zUVFVw,2461
237
236
  letschatty/services/chatty_assets/__init__.py,sha256=quOXMGvcDVRkbeaGfCQliFfZzis5m1wrfJkHqDkWRx8,132
@@ -276,7 +275,7 @@ letschatty/services/template_campaigns/template_campaign_service.py,sha256=jORgD
276
275
  letschatty/services/users/agent_service.py,sha256=hIkUUJ1SpkKbh5_uo4i2CeqGtuMTjU7tSV8k5J7WPG4,279
277
276
  letschatty/services/users/user_factory.py,sha256=FCB9uiAfjMeYfh4kMdx5h8VDHJ8MCsD-uaxW3X3KaWM,6681
278
277
  letschatty/services/validators/analytics_validator.py,sha256=-QBR6XIqEv2qw3stcBQehkwui1EcfWUM6M9DRQODykY,6335
279
- letschatty-0.4.338.dist-info/LICENSE,sha256=EClLu_bO2HBLDcThowIwfaIg5EOwIYhpRsBJjVEk92A,1197
280
- letschatty-0.4.338.dist-info/METADATA,sha256=WnJTrR_WgkrNRLmzyKot97YWUuI5PnC9x8wpaWGPUb4,3283
281
- letschatty-0.4.338.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
282
- letschatty-0.4.338.dist-info/RECORD,,
278
+ letschatty-0.4.340.dist-info/LICENSE,sha256=EClLu_bO2HBLDcThowIwfaIg5EOwIYhpRsBJjVEk92A,1197
279
+ letschatty-0.4.340.dist-info/METADATA,sha256=HDe6iHDJWt8j5QCRLey6W21uZfhg3ykXUIHplKqU_oc,3283
280
+ letschatty-0.4.340.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
281
+ letschatty-0.4.340.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- from zoneinfo import ZoneInfo
2
- from pydantic import Field, BaseModel
3
- from datetime import datetime
4
-
5
-
6
- class ShopifyIntegration(BaseModel):
7
- """Shopify integration for the company"""
8
- shopify_store_url: str = Field(default = "")
9
- oauth_state: str = Field(default = "")
10
- oauth_state_at: datetime = Field(default = datetime.now(tz=ZoneInfo("UTC")))