chatgraph 0.2.5__py3-none-any.whl → 0.3.0__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.
Potentially problematic release.
This version of chatgraph might be problematic. Click here for more details.
- chatgraph/__init__.py +5 -4
- chatgraph/bot/chatbot_model.py +45 -34
- chatgraph/gRPC/gRPCCall.py +125 -0
- chatgraph/messages/{rabbitMQ_message_consumer.py → message_consumer.py} +14 -8
- chatgraph/pb/userstate.proto +29 -0
- chatgraph/pb/userstate_pb2.py +43 -0
- chatgraph/pb/userstate_pb2_grpc.py +226 -0
- chatgraph/pb/voll.proto +32 -0
- chatgraph/pb/voll_pb2.py +43 -0
- chatgraph/pb/voll_pb2_grpc.py +183 -0
- chatgraph/types/message_types.py +180 -9
- chatgraph/types/output_state.py +28 -0
- {chatgraph-0.2.5.dist-info → chatgraph-0.3.0.dist-info}/METADATA +4 -1
- chatgraph-0.3.0.dist-info/RECORD +21 -0
- chatgraph/messages/base_message_consumer.py +0 -40
- chatgraph/messages/base_message_sender.py +0 -23
- chatgraph/messages/rabbitMQ_message_sender.py +0 -79
- chatgraph/messages/test_message_consumer.py +0 -17
- chatgraph/types/user_state.py +0 -98
- chatgraph-0.2.5.dist-info/RECORD +0 -19
- {chatgraph-0.2.5.dist-info → chatgraph-0.3.0.dist-info}/LICENSE +0 -0
- {chatgraph-0.2.5.dist-info → chatgraph-0.3.0.dist-info}/WHEEL +0 -0
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from typing import Any, Callable
|
|
2
|
-
from .base_message_consumer import MessageConsumer
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class TestMessageConsumer(MessageConsumer):
|
|
6
|
-
"""
|
|
7
|
-
Classe de consumidor de mensagens de teste para uso em testes unitários.
|
|
8
|
-
"""
|
|
9
|
-
def __init__(self) -> None:
|
|
10
|
-
super().__init__()
|
|
11
|
-
|
|
12
|
-
@classmethod
|
|
13
|
-
def load_dotenv(cls) -> 'TestMessageConsumer':
|
|
14
|
-
return cls()
|
|
15
|
-
|
|
16
|
-
def start_consume(self, process_message: Callable) -> Any:
|
|
17
|
-
return super().start_consume(process_message)
|
chatgraph/types/user_state.py
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Deprecated!!
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from abc import ABC, abstractmethod
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class UserState(ABC):
|
|
9
|
-
"""
|
|
10
|
-
Classe abstrata para gerenciar o estado do usuário no fluxo do chatbot.
|
|
11
|
-
|
|
12
|
-
Esta classe define a interface para implementar o gerenciamento de estado do usuário, incluindo métodos para obter e definir o menu atual do usuário.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
@abstractmethod
|
|
16
|
-
def get_menu(self, customer_id: str) -> str:
|
|
17
|
-
"""
|
|
18
|
-
Retorna o menu atual para o ID de cliente fornecido.
|
|
19
|
-
|
|
20
|
-
Args:
|
|
21
|
-
customer_id (str): O ID do cliente.
|
|
22
|
-
|
|
23
|
-
Returns:
|
|
24
|
-
str: O menu atual associado ao cliente.
|
|
25
|
-
"""
|
|
26
|
-
pass
|
|
27
|
-
|
|
28
|
-
@abstractmethod
|
|
29
|
-
def set_menu(self, customer_id: str, menu: str) -> None:
|
|
30
|
-
"""
|
|
31
|
-
Define o menu atual para o ID de cliente fornecido.
|
|
32
|
-
|
|
33
|
-
Args:
|
|
34
|
-
customer_id (str): O ID do cliente.
|
|
35
|
-
menu (str): O menu a ser definido para o cliente.
|
|
36
|
-
"""
|
|
37
|
-
pass
|
|
38
|
-
|
|
39
|
-
@abstractmethod
|
|
40
|
-
def delete_menu(self, customer_id: str) -> None:
|
|
41
|
-
"""
|
|
42
|
-
Deleta o menu atual para o ID de cliente fornecido.
|
|
43
|
-
|
|
44
|
-
Args:
|
|
45
|
-
customer_id (str): O ID do cliente.
|
|
46
|
-
"""
|
|
47
|
-
pass
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
class SimpleUserState(UserState):
|
|
51
|
-
"""
|
|
52
|
-
Implementação simples de UserState que armazena o estado do usuário em um dicionário em memória.
|
|
53
|
-
|
|
54
|
-
Atributos:
|
|
55
|
-
states (dict): Dicionário que armazena o estado de menu atual para cada cliente.
|
|
56
|
-
"""
|
|
57
|
-
|
|
58
|
-
def __init__(self):
|
|
59
|
-
"""
|
|
60
|
-
Inicializa o estado do usuário com um dicionário vazio.
|
|
61
|
-
"""
|
|
62
|
-
self.states = {}
|
|
63
|
-
|
|
64
|
-
def get_menu(self, customer_id: str) -> str:
|
|
65
|
-
"""
|
|
66
|
-
Retorna o menu atual para o ID de cliente fornecido. Se o cliente não tiver um menu definido, define 'start' como padrão.
|
|
67
|
-
|
|
68
|
-
Args:
|
|
69
|
-
customer_id (str): O ID do cliente.
|
|
70
|
-
|
|
71
|
-
Returns:
|
|
72
|
-
str: O menu atual associado ao cliente.
|
|
73
|
-
"""
|
|
74
|
-
menu = self.states.get(customer_id, 'start')
|
|
75
|
-
if menu == 'start':
|
|
76
|
-
self.set_menu(customer_id, menu)
|
|
77
|
-
return menu
|
|
78
|
-
|
|
79
|
-
def set_menu(self, customer_id: str, menu: str | None = None) -> None:
|
|
80
|
-
"""
|
|
81
|
-
Define o menu atual para o ID de cliente fornecido. Converte o nome do menu para maiúsculas.
|
|
82
|
-
|
|
83
|
-
Args:
|
|
84
|
-
customer_id (str): O ID do cliente.
|
|
85
|
-
menu (str | None): O menu a ser definido para o cliente. Se None, não faz nenhuma alteração.
|
|
86
|
-
"""
|
|
87
|
-
if menu:
|
|
88
|
-
self.states[customer_id] = menu.lower()
|
|
89
|
-
|
|
90
|
-
def delete_menu(self, customer_id: str) -> None:
|
|
91
|
-
"""
|
|
92
|
-
Deleta o menu atual para o ID de cliente fornecido.
|
|
93
|
-
|
|
94
|
-
Args:
|
|
95
|
-
customer_id (str): O ID do cliente.
|
|
96
|
-
"""
|
|
97
|
-
if customer_id in self.states:
|
|
98
|
-
self.states.pop(customer_id)
|
chatgraph-0.2.5.dist-info/RECORD
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
chatgraph/__init__.py,sha256=6pDNMUOLR8iFK_3mWula1IJQcIoE8io-65mS_QheXXE,642
|
|
2
|
-
chatgraph/auth/credentials.py,sha256=xsMEpLQnc66novPjL6upocMcnUnvFJ7yxINzUenkxmc,2388
|
|
3
|
-
chatgraph/bot/chatbot_model.py,sha256=NNsUM6GUvmf-d2DbGxsUCL26JtNscBdrQJcbXdv20_0,6850
|
|
4
|
-
chatgraph/bot/chatbot_router.py,sha256=kZ_4X5AhhE2mntx4tcHiapaSKC1T4K1jqIVjLp1Pjg0,2817
|
|
5
|
-
chatgraph/error/chatbot_error.py,sha256=4sEcW8vz0eQk2QDmDygucVM4caHliZW5iH7XJvmLBuk,1897
|
|
6
|
-
chatgraph/error/route_error.py,sha256=CY8m82ap7-Sr-DXPsolltRW50TqD__5RyXBmNNJCWr8,793
|
|
7
|
-
chatgraph/messages/base_message_consumer.py,sha256=4qZj69eDtqeqmSDSfGsCRt6hyypSPTSry3pmRh8r8nM,1269
|
|
8
|
-
chatgraph/messages/base_message_sender.py,sha256=0IgNW0WMwRXnXiKokqhMtX5imK3L6ZDKEYjFdSbQIq4,610
|
|
9
|
-
chatgraph/messages/rabbitMQ_message_consumer.py,sha256=Y9Y0BuHHPBj3qJZNVBQ0QA9XI-T_AqUR-ULd5WSeY1A,8771
|
|
10
|
-
chatgraph/messages/rabbitMQ_message_sender.py,sha256=TWegMfDasjUjKF5u8LVfr8ai32E3oBa_EELtGrTS7xk,3213
|
|
11
|
-
chatgraph/messages/test_message_consumer.py,sha256=9XIkbCHd1S6S8pINRT-SLEvUT0TQWBCsdPhYN6PpZ2s,518
|
|
12
|
-
chatgraph/types/message_types.py,sha256=7eB45hrlbYKV1Lp9vysR6V7OXNsySpeKYbGBc2Ux6xE,1363
|
|
13
|
-
chatgraph/types/output_state.py,sha256=_pbCssNM4ls7tFG1Wbdg8BJN6ih0q3x2onXZdvZcGDo,3025
|
|
14
|
-
chatgraph/types/route.py,sha256=nKTqzwGl7d_Bu8G6Sr0EmmhuuiZWKEoSozITRrdyi1g,2587
|
|
15
|
-
chatgraph/types/user_state.py,sha256=nliV-kC_yOmYoFh8CQSfT92DbOv4BLF0vvn8kotnDog,2884
|
|
16
|
-
chatgraph-0.2.5.dist-info/LICENSE,sha256=rVJozpRzDlplOpvI8A1GvmfVS0ReYdZvMWc1j2jV0v8,1090
|
|
17
|
-
chatgraph-0.2.5.dist-info/METADATA,sha256=PLM-QZCefEPaSuAKJq9qz7NYcBbCxw12gMlqt-aFHqQ,5868
|
|
18
|
-
chatgraph-0.2.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
19
|
-
chatgraph-0.2.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|