chatgraph 0.1.1__tar.gz → 0.1.2__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chatgraph
3
- Version: 0.1.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("/HELP")
115
+ @router.route(".HELP")
116
116
  def provide_help():
117
117
  return ChatbotResponse(message="Here are some things I can help with: ...")
118
118
 
@@ -93,9 +93,9 @@ router = ChatbotRouter()
93
93
 
94
94
  @router.route("START")
95
95
  def say_hello():
96
- return ChatbotResponse(message="Hello! How can I assist you today?", route="HELP")
96
+ return ChatbotResponse(message="Hello! How can I assist you today?", route=".HELP")
97
97
 
98
- @router.route("/HELP")
98
+ @router.route(".HELP")
99
99
  def provide_help():
100
100
  return ChatbotResponse(message="Here are some things I can help with: ...")
101
101
 
@@ -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 = '/'.join(self.current.split('/')[:-1])
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('/')}{next_part}"
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
  [tool.poetry]
2
2
  name = "chatgraph"
3
- version = "0.1.1"
3
+ version = "0.1.2"
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