chatgraph 0.1.1__py3-none-any.whl → 0.1.2__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/types/route.py +5 -3
- {chatgraph-0.1.1.dist-info → chatgraph-0.1.2.dist-info}/METADATA +3 -3
- {chatgraph-0.1.1.dist-info → chatgraph-0.1.2.dist-info}/RECORD +5 -5
- {chatgraph-0.1.1.dist-info → chatgraph-0.1.2.dist-info}/LICENSE +0 -0
- {chatgraph-0.1.1.dist-info → chatgraph-0.1.2.dist-info}/WHEEL +0 -0
chatgraph/types/route.py
CHANGED
|
@@ -10,16 +10,18 @@ class Route:
|
|
|
10
10
|
routes (list[str]): A lista de todas as rotas disponíveis no fluxo.
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
|
-
def __init__(self, current: str, routes: list[str]):
|
|
13
|
+
def __init__(self, current: str, routes: list[str], separator:str='.'):
|
|
14
14
|
"""
|
|
15
15
|
Inicializa a rota com a rota atual e a lista de rotas disponíveis.
|
|
16
16
|
|
|
17
17
|
Args:
|
|
18
18
|
current (str): A rota atual.
|
|
19
19
|
routes (list[str]): A lista de todas as rotas disponíveis no fluxo.
|
|
20
|
+
separator (str): O separador de partes de rota. Padrão é '.'.
|
|
20
21
|
"""
|
|
21
22
|
self.current = current
|
|
22
23
|
self.routes = routes
|
|
24
|
+
self.separator = separator
|
|
23
25
|
|
|
24
26
|
def get_previous(self) -> str:
|
|
25
27
|
"""
|
|
@@ -34,7 +36,7 @@ class Route:
|
|
|
34
36
|
if self.current == 'START':
|
|
35
37
|
raise RouteError('Não há caminho anterior ao START')
|
|
36
38
|
|
|
37
|
-
previous_route =
|
|
39
|
+
previous_route = self.separator.join(self.current.split(self.separator)[:-1])
|
|
38
40
|
return previous_route
|
|
39
41
|
|
|
40
42
|
def get_next(self, next_part: str) -> str:
|
|
@@ -51,7 +53,7 @@ class Route:
|
|
|
51
53
|
str: O próximo caminho construído a partir da rota atual e da parte fornecida.
|
|
52
54
|
"""
|
|
53
55
|
next_part = next_part.strip().upper()
|
|
54
|
-
next_route = f"{self.current.rstrip(
|
|
56
|
+
next_route = f"{self.current.rstrip(self.separator)}{next_part}"
|
|
55
57
|
if next_route not in self.routes:
|
|
56
58
|
raise RouteError(f'Rota não encontrada: {next_route}')
|
|
57
59
|
return next_route
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: chatgraph
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A user-friendly chatbot library
|
|
5
5
|
Home-page: https://github.com/irissonnlima/chatgraph
|
|
6
6
|
License: MIT
|
|
@@ -110,9 +110,9 @@ router = ChatbotRouter()
|
|
|
110
110
|
|
|
111
111
|
@router.route("START")
|
|
112
112
|
def say_hello():
|
|
113
|
-
return ChatbotResponse(message="Hello! How can I assist you today?", route="HELP")
|
|
113
|
+
return ChatbotResponse(message="Hello! How can I assist you today?", route=".HELP")
|
|
114
114
|
|
|
115
|
-
@router.route("
|
|
115
|
+
@router.route(".HELP")
|
|
116
116
|
def provide_help():
|
|
117
117
|
return ChatbotResponse(message="Here are some things I can help with: ...")
|
|
118
118
|
|
|
@@ -8,9 +8,9 @@ chatgraph/messages/base_message_consumer.py,sha256=OSdTT4dHIzawLDOCZ-4hZ06T8UBxo
|
|
|
8
8
|
chatgraph/messages/rabbitMQ_message_consumer.py,sha256=mRcJ1Hbd5wPFxC3v6Tj3pYvjd9yAc398Ys6cUox-CTY,7005
|
|
9
9
|
chatgraph/types/message_types.py,sha256=NBuebmpO2e9ilspBoFgs9O3rY_VQ2AP_Z8Q_nC70nyM,965
|
|
10
10
|
chatgraph/types/output_state.py,sha256=ZditFyycd6CEvemrW9c7mThQDP1l6tI_8p19Jgj8pbs,1471
|
|
11
|
-
chatgraph/types/route.py,sha256=
|
|
11
|
+
chatgraph/types/route.py,sha256=u_VrOAlWdauj-V0LU6zkX2qZNWab2UFtfhGjUUTGJrA,2587
|
|
12
12
|
chatgraph/types/user_state.py,sha256=0n7K5k5DGoP3ug8XNPREqdJHGHXmcOwhPrANpXJSDjU,2321
|
|
13
|
-
chatgraph-0.1.
|
|
14
|
-
chatgraph-0.1.
|
|
15
|
-
chatgraph-0.1.
|
|
16
|
-
chatgraph-0.1.
|
|
13
|
+
chatgraph-0.1.2.dist-info/LICENSE,sha256=rVJozpRzDlplOpvI8A1GvmfVS0ReYdZvMWc1j2jV0v8,1090
|
|
14
|
+
chatgraph-0.1.2.dist-info/METADATA,sha256=y28e5w0_NDqpeHuxaonBJuqTSUrtj8S8uNU8MZfCCxc,5829
|
|
15
|
+
chatgraph-0.1.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
16
|
+
chatgraph-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|