chatgraph 0.3.3__tar.gz → 0.3.5__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.

Potentially problematic release.


This version of chatgraph might be problematic. Click here for more details.

Files changed (23) hide show
  1. {chatgraph-0.3.3 → chatgraph-0.3.5}/PKG-INFO +1 -1
  2. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/cli/__init__.py +1 -3
  3. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/types/request_types.py +52 -8
  4. {chatgraph-0.3.3 → chatgraph-0.3.5}/pyproject.toml +1 -1
  5. {chatgraph-0.3.3 → chatgraph-0.3.5}/LICENSE +0 -0
  6. {chatgraph-0.3.3 → chatgraph-0.3.5}/README.md +0 -0
  7. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/__init__.py +0 -0
  8. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/auth/credentials.py +0 -0
  9. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/bot/chatbot_model.py +0 -0
  10. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/bot/chatbot_router.py +0 -0
  11. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/error/chatbot_error.py +0 -0
  12. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/error/route_error.py +0 -0
  13. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/gRPC/gRPCCall.py +0 -0
  14. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/messages/message_consumer.py +0 -0
  15. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/pb/userstate.proto +0 -0
  16. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/pb/userstate_pb2.py +0 -0
  17. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/pb/userstate_pb2_grpc.py +0 -0
  18. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/pb/voll.proto +0 -0
  19. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/pb/voll_pb2.py +0 -0
  20. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/pb/voll_pb2_grpc.py +0 -0
  21. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/types/end_types.py +0 -0
  22. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/types/message_types.py +0 -0
  23. {chatgraph-0.3.3 → chatgraph-0.3.5}/chatgraph/types/route.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chatgraph
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: A user-friendly chatbot library
5
5
  Home-page: https://github.com/irissonnlima/chatgraph
6
6
  License: MIT
@@ -1,8 +1,6 @@
1
1
  import typer
2
2
  from rich.console import Console
3
3
  from rich.table import Table
4
- from rich.text import Text
5
- from rich.panel import Panel
6
4
  from dotenv import load_dotenv
7
5
  from ..gRPC.gRPCCall import WhatsappServiceClient, UserStateServiceClient
8
6
  import os, re
@@ -62,7 +60,7 @@ def campaigns(regex: str = typer.Option(None, "--regex", "-r", help="Filtro rege
62
60
  # Aplicar filtro de regex, se fornecido
63
61
  filtered_campaigns = campaigns.campaigns
64
62
  if regex:
65
- pattern = re.compile(regex)
63
+ pattern = re.compile(regex, re.IGNORECASE)
66
64
  filtered_campaigns = [
67
65
  campaign for campaign in campaigns.campaigns
68
66
  if pattern.search(campaign.campaign_name)
@@ -1,8 +1,8 @@
1
- from ..gRPC.gRPCCall import WhatsappServiceClient, UserStateServiceClient
2
- from .message_types import Message, Button, ListElements, messageTypes, MessageTypes
1
+ from chatgraph.gRPC.gRPCCall import WhatsappServiceClient, UserStateServiceClient
2
+ from chatgraph.types.message_types import Message, Button, ListElements, messageTypes, MessageTypes
3
3
  from dataclasses import dataclass
4
4
  from typing import Optional
5
- import json
5
+ import json, os
6
6
 
7
7
  @dataclass
8
8
  class UserState:
@@ -15,12 +15,56 @@ class UserState:
15
15
  lst_update (str): A última atualização do menu.
16
16
  obs (dict): Observações adicionais sobre o estado do usuário.
17
17
  """
18
- customer_id: str
19
- menu: str
20
- route: str
21
- lst_update: str
22
- obs: Optional[dict] = None
18
+ def __init__(
19
+ self,
20
+ customer_id: str,
21
+ menu: str,
22
+ route: str,
23
+ lst_update: Optional[str]=None,
24
+ obs: Optional[dict] = None,
25
+ direction_in: Optional[bool] = True,
26
+ ) -> None:
27
+
28
+ self.customer_id = customer_id
29
+ self.menu = menu
30
+ self.route = route
31
+ self.lst_update = lst_update
32
+ self.obs = obs
33
+ self.direction_in = direction_in
34
+
35
+ def __str__(self):
36
+ return f"UserState:\n\tcustomer_id={self.customer_id},\n\tmenu={self.menu},\n\troute={self.route},\n\tlst_update={self.lst_update},\n\tobs={self.obs},\n\tdirection_in={self.direction_in}"
23
37
 
38
+ def insert(self, grpc_uri: Optional[str] = None) -> None:
39
+ if grpc_uri is None:
40
+ grpc_uri = os.getenv('GRPC_URI')
41
+ user_state_client = UserStateServiceClient(grpc_uri)
42
+
43
+ user_state_client.insert_user_state({
44
+ 'user_id': self.customer_id,
45
+ 'menu_id': self.menu,
46
+ 'route': self.route,
47
+ 'obs': json.dumps(self.obs),
48
+ })
49
+
50
+ def update(self, grpc_uri: Optional[str] = None) -> None:
51
+ if grpc_uri is None:
52
+ grpc_uri = os.getenv('GRPC_URI')
53
+ user_state_client = UserStateServiceClient(grpc_uri)
54
+
55
+ user_state_client.update_user_state({
56
+ 'user_id': self.customer_id,
57
+ 'menu_id': self.menu,
58
+ 'route': self.route,
59
+ 'obs': json.dumps(self.obs),
60
+ })
61
+
62
+ def delete(self, grpc_uri: Optional[str] = None) -> None:
63
+ if grpc_uri is None:
64
+ grpc_uri = os.getenv('GRPC_URI')
65
+ user_state_client = UserStateServiceClient(grpc_uri)
66
+
67
+ user_state_client.delete_user_state(self.customer_id)
24
68
 
25
69
  class UserCall:
26
70
  """
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "chatgraph"
3
- version = "0.3.3"
3
+ version = "0.3.5"
4
4
  description = "A user-friendly chatbot library"
5
5
  authors = ["Irisson N. Lima <irisson.lima@verdecard.com.br>"]
6
6
  readme = "README.md"
File without changes
File without changes