chatgraph 0.4.2__py3-none-any.whl → 0.5.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 +4 -3
- chatgraph/bot/chatbot_model.py +11 -8
- chatgraph/gRPC/gRPCCall.py +61 -145
- chatgraph/messages/message_consumer.py +74 -139
- chatgraph/pb/router.proto +127 -0
- chatgraph/pb/router_pb2.py +77 -0
- chatgraph/pb/router_pb2_grpc.py +669 -0
- chatgraph/types/message_types.py +79 -76
- chatgraph/types/request_types.py +176 -251
- {chatgraph-0.4.2.dist-info → chatgraph-0.5.0.dist-info}/METADATA +1 -1
- chatgraph-0.5.0.dist-info/RECORD +21 -0
- chatgraph/pb/userstate.proto +0 -41
- chatgraph/pb/userstate_pb2.py +0 -47
- chatgraph/pb/userstate_pb2_grpc.py +0 -269
- chatgraph/pb/voll.proto +0 -90
- chatgraph/pb/voll_pb2.py +0 -63
- chatgraph/pb/voll_pb2_grpc.py +0 -470
- chatgraph-0.4.2.dist-info/RECORD +0 -24
- {chatgraph-0.4.2.dist-info → chatgraph-0.5.0.dist-info}/LICENSE +0 -0
- {chatgraph-0.4.2.dist-info → chatgraph-0.5.0.dist-info}/WHEEL +0 -0
- {chatgraph-0.4.2.dist-info → chatgraph-0.5.0.dist-info}/entry_points.txt +0 -0
chatgraph/types/request_types.py
CHANGED
|
@@ -1,103 +1,129 @@
|
|
|
1
|
-
from chatgraph.gRPC.gRPCCall import
|
|
2
|
-
from chatgraph.types.message_types import Message, Button,
|
|
3
|
-
from dataclasses import dataclass
|
|
1
|
+
from chatgraph.gRPC.gRPCCall import RouterServiceClient
|
|
2
|
+
from chatgraph.types.message_types import Message, Button, MessageTypes, messageTypes
|
|
4
3
|
from typing import Optional
|
|
5
4
|
from datetime import datetime
|
|
6
5
|
import json, os
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
|
|
8
|
+
class ChatID:
|
|
9
|
+
"""
|
|
10
|
+
Representa o ID de um chat.
|
|
11
|
+
|
|
12
|
+
Atributos:
|
|
13
|
+
user_id (str): O ID do usuário.
|
|
14
|
+
company_id (str): O ID da empresa
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(
|
|
18
|
+
self,
|
|
19
|
+
user_id: str,
|
|
20
|
+
company_id: str,
|
|
21
|
+
):
|
|
22
|
+
self.user_id = user_id
|
|
23
|
+
self.company_id = company_id
|
|
24
|
+
|
|
25
|
+
def __str__(self):
|
|
26
|
+
return f"ChatID({self.user_id}, {self.company_id})"
|
|
27
|
+
|
|
28
|
+
def to_dict(self) -> dict:
|
|
29
|
+
return {
|
|
30
|
+
"user_id": self.user_id,
|
|
31
|
+
"company_id": self.company_id,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
9
35
|
class UserState:
|
|
10
36
|
"""
|
|
11
37
|
Representa o estado de um usuário.
|
|
12
|
-
|
|
38
|
+
|
|
13
39
|
Atributos:
|
|
14
|
-
|
|
40
|
+
chatID (ChatID): O ID do chat.
|
|
15
41
|
menu (str): O menu atual.
|
|
16
|
-
|
|
17
|
-
|
|
42
|
+
route (str): A rota atual.
|
|
43
|
+
protocol (str): O protocolo atual.
|
|
44
|
+
observations (dict): Observações do estado do usuário.
|
|
18
45
|
"""
|
|
46
|
+
|
|
19
47
|
def __init__(
|
|
20
48
|
self,
|
|
21
|
-
|
|
49
|
+
chatID: ChatID,
|
|
22
50
|
menu: str,
|
|
23
51
|
route: str,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
voll_id: Optional[str]=None,
|
|
27
|
-
lst_update: Optional[str]=None,
|
|
28
|
-
obs: Optional[dict] = None,
|
|
29
|
-
protocol: Optional[str] = None,
|
|
52
|
+
protocol: str,
|
|
53
|
+
observation: dict,
|
|
30
54
|
) -> None:
|
|
31
|
-
|
|
32
|
-
self.
|
|
55
|
+
|
|
56
|
+
self.chatID = chatID
|
|
33
57
|
self.menu = menu
|
|
34
58
|
self.route = route
|
|
35
|
-
self.
|
|
36
|
-
self.obs = obs
|
|
37
|
-
self.direction_in = direction_in
|
|
38
|
-
self.voll_id = voll_id
|
|
39
|
-
self.platform = platform
|
|
59
|
+
self.observation = observation
|
|
40
60
|
self.protocol = protocol
|
|
41
61
|
|
|
42
62
|
def __str__(self):
|
|
43
|
-
return f"UserState
|
|
63
|
+
return f"UserState({self.chatID}, {self.menu}, {self.route}, {self.protocol}, {self.observation})"
|
|
64
|
+
|
|
65
|
+
def __chat_id_to_dict(self) -> dict:
|
|
66
|
+
return {
|
|
67
|
+
"user_id": self.chatID.user_id,
|
|
68
|
+
"company_id": self.chatID.company_id,
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
def __user_state_to_dict(self) -> dict:
|
|
72
|
+
return {
|
|
73
|
+
"chat_id": {
|
|
74
|
+
"user_id": self.chatID.user_id,
|
|
75
|
+
"company_id": self.chatID.company_id,
|
|
76
|
+
},
|
|
77
|
+
"menu": self.menu,
|
|
78
|
+
"route": self.route,
|
|
79
|
+
"protocol": self.protocol,
|
|
80
|
+
"observation": json.dumps(self.observation),
|
|
81
|
+
}
|
|
44
82
|
|
|
45
83
|
def insert(self, grpc_uri: Optional[str] = None) -> None:
|
|
46
84
|
if grpc_uri is None:
|
|
47
|
-
grpc_uri = os.getenv(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
'obs': json.dumps(self.obs),
|
|
55
|
-
'direction': self.direction_in,
|
|
56
|
-
'voll_id': self.voll_id,
|
|
57
|
-
'platform': self.platform,
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
def update(self, grpc_uri: Optional[str] = None) -> None:
|
|
61
|
-
if grpc_uri is None:
|
|
62
|
-
grpc_uri = os.getenv('GRPC_URI')
|
|
63
|
-
user_state_client = UserStateServiceClient(grpc_uri)
|
|
64
|
-
|
|
65
|
-
user_state_client.update_user_state({
|
|
66
|
-
'user_id': self.customer_id,
|
|
67
|
-
'menu_id': self.menu,
|
|
68
|
-
'route': self.route,
|
|
69
|
-
'obs': json.dumps(self.obs),
|
|
70
|
-
})
|
|
71
|
-
|
|
85
|
+
grpc_uri = os.getenv("GRPC_URI")
|
|
86
|
+
router_client = RouterServiceClient(grpc_uri)
|
|
87
|
+
|
|
88
|
+
ustate = self.__user_state_to_dict()
|
|
89
|
+
result = router_client.insert_update_user_state(ustate)
|
|
90
|
+
return result
|
|
91
|
+
|
|
72
92
|
def delete(self, grpc_uri: Optional[str] = None) -> None:
|
|
73
93
|
if grpc_uri is None:
|
|
74
|
-
grpc_uri = os.getenv(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
94
|
+
grpc_uri = os.getenv("GRPC_URI")
|
|
95
|
+
router_client = RouterServiceClient(grpc_uri)
|
|
96
|
+
|
|
97
|
+
ustate = self.__user_state_to_dict()
|
|
98
|
+
response = router_client.delete_user_state(ustate["chat_id"])
|
|
99
|
+
return response
|
|
78
100
|
|
|
79
101
|
@classmethod
|
|
80
|
-
def get_user_state(
|
|
102
|
+
def get_user_state(
|
|
103
|
+
cls, user_id: str, company_id: str, grpc_uri: Optional[str] = None
|
|
104
|
+
) -> "UserState":
|
|
81
105
|
if grpc_uri is None:
|
|
82
|
-
grpc_uri = os.getenv(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
106
|
+
grpc_uri = os.getenv("GRPC_URI")
|
|
107
|
+
router_client = RouterServiceClient(grpc_uri)
|
|
108
|
+
|
|
109
|
+
chat_id = {"user_id": user_id, "company_id": company_id}
|
|
110
|
+
response = router_client.get_user_state(chat_id)
|
|
111
|
+
|
|
87
112
|
if not response:
|
|
88
113
|
raise ValueError("Erro ao buscar estado do usuário.")
|
|
89
|
-
|
|
90
|
-
date = datetime.strptime(response.date, "%Y-%m-%d %H:%M:%S")
|
|
114
|
+
|
|
91
115
|
return cls(
|
|
92
|
-
|
|
93
|
-
|
|
116
|
+
chatID=ChatID(
|
|
117
|
+
user_id=response.chat_id.user_id,
|
|
118
|
+
company_id=response.chat_id.company_id,
|
|
119
|
+
),
|
|
120
|
+
menu=response.menu,
|
|
94
121
|
route=response.route,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
voll_id=response.voll_id,
|
|
98
|
-
platform=response.platform,
|
|
99
|
-
lst_update=date,
|
|
122
|
+
protocol=response.protocol,
|
|
123
|
+
observation=json.loads(response.observation),
|
|
100
124
|
)
|
|
125
|
+
|
|
126
|
+
|
|
101
127
|
class UserCall:
|
|
102
128
|
"""
|
|
103
129
|
Representa uma mensagem recebida ou enviada pelo chatbot.
|
|
@@ -111,32 +137,31 @@ class UserCall:
|
|
|
111
137
|
company_phone (str): O número de telefone da empresa que está enviando ou recebendo a mensagem.
|
|
112
138
|
status (Optional[str]): O status da mensagem (por exemplo, enviada, recebida, lida, etc.). Este campo é opcional.
|
|
113
139
|
"""
|
|
140
|
+
|
|
114
141
|
def __init__(
|
|
115
142
|
self,
|
|
116
|
-
type: str,
|
|
117
|
-
text: str,
|
|
118
143
|
user_state: UserState,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
company_phone: str,
|
|
144
|
+
type_message: str,
|
|
145
|
+
content_message: str,
|
|
122
146
|
grpc_uri: str,
|
|
123
|
-
status: Optional[str] = None,
|
|
124
147
|
) -> None:
|
|
125
|
-
|
|
148
|
+
|
|
126
149
|
self.type = type
|
|
127
|
-
self.
|
|
150
|
+
self.__type_message = type_message
|
|
151
|
+
self.__content_message = content_message
|
|
128
152
|
self.__user_state = user_state
|
|
129
|
-
self.channel = channel
|
|
130
|
-
self.customer_phone = customer_phone
|
|
131
|
-
self.company_phone = company_phone
|
|
132
|
-
self.status = status
|
|
133
|
-
|
|
134
|
-
self.grpc_uri = grpc_uri
|
|
135
|
-
|
|
136
|
-
self.__wpp_server_client = WhatsappServiceClient(self.grpc_uri)
|
|
137
|
-
self.__user_state_client = UserStateServiceClient(self.grpc_uri)
|
|
138
153
|
|
|
139
|
-
|
|
154
|
+
self.__grpc_uri = grpc_uri
|
|
155
|
+
|
|
156
|
+
self.__router_client = RouterServiceClient(self.__grpc_uri)
|
|
157
|
+
|
|
158
|
+
def __str__(self):
|
|
159
|
+
return f"UserCall({self.type}, {self.__type_message}, {self.__content_message}, {self.__user_state})"
|
|
160
|
+
|
|
161
|
+
def send(
|
|
162
|
+
self,
|
|
163
|
+
message: messageTypes | Message,
|
|
164
|
+
) -> None:
|
|
140
165
|
"""
|
|
141
166
|
Envia uma mensagem ao cliente.
|
|
142
167
|
|
|
@@ -144,226 +169,126 @@ class UserCall:
|
|
|
144
169
|
message (Message|Button|ListElements): A mensagem a ser enviada.
|
|
145
170
|
"""
|
|
146
171
|
if isinstance(message, MessageTypes):
|
|
147
|
-
message = Message(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
self.__send_text(message.text, message.absolute_text)
|
|
151
|
-
|
|
152
|
-
elif isinstance(message, Button):
|
|
153
|
-
self.__send_button(
|
|
154
|
-
message.text,
|
|
155
|
-
message.buttons,
|
|
156
|
-
message.title,
|
|
157
|
-
message.caption
|
|
158
|
-
)
|
|
159
|
-
|
|
160
|
-
elif isinstance(message, ListElements):
|
|
161
|
-
self.__send_list(
|
|
162
|
-
text=message.text,
|
|
163
|
-
title=message.title,
|
|
164
|
-
button_title=message.button_title,
|
|
165
|
-
caption=message.caption,
|
|
166
|
-
element_list=message.elements,
|
|
172
|
+
message = Message(
|
|
173
|
+
type="message",
|
|
174
|
+
detail=str(message),
|
|
167
175
|
)
|
|
176
|
+
|
|
177
|
+
if isinstance(message, Message):
|
|
178
|
+
self.__send(message)
|
|
168
179
|
else:
|
|
169
180
|
raise ValueError("Tipo de mensagem inválido.")
|
|
170
|
-
|
|
171
|
-
def
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
response = self.
|
|
176
|
-
{
|
|
177
|
-
"hook_id": self.company_phone,
|
|
178
|
-
"enterprise_id": self.customer_phone,
|
|
179
|
-
"unique_customer_id": self.__user_state.voll_id,
|
|
180
|
-
"message_text": text,
|
|
181
|
-
"platform": self.channel,
|
|
182
|
-
}
|
|
183
|
-
)
|
|
181
|
+
|
|
182
|
+
def __send(self, message: Message) -> None:
|
|
183
|
+
|
|
184
|
+
dict_message = message.to_dict()
|
|
185
|
+
dict_message["chat_id"] = self.__user_state.chatID.to_dict()
|
|
186
|
+
response = self.__router_client.send_message(dict_message)
|
|
184
187
|
|
|
185
188
|
if not response.status:
|
|
186
189
|
raise ValueError("Erro ao enviar mensagem de texto.")
|
|
187
|
-
|
|
188
|
-
def __send_button(
|
|
189
|
-
self,
|
|
190
|
-
text:str,
|
|
191
|
-
buttons:list,
|
|
192
|
-
title: str|None = None,
|
|
193
|
-
caption: str|None = None,
|
|
194
|
-
) -> None:
|
|
195
|
-
if len(buttons) > 3:
|
|
196
|
-
raise ValueError("O número máximo de botões é 3.")
|
|
197
|
-
|
|
198
|
-
response = self.__wpp_server_client.send_button(
|
|
199
|
-
{
|
|
200
|
-
"hook_id": self.company_phone,
|
|
201
|
-
"enterprise_id": self.customer_phone,
|
|
202
|
-
"unique_customer_id": self.__user_state.voll_id,
|
|
203
|
-
"message_text": text,
|
|
204
|
-
"button_title": title,
|
|
205
|
-
"message_caption": caption,
|
|
206
|
-
"message_title": title,
|
|
207
|
-
"options": [{"title": b} for b in buttons],
|
|
208
|
-
}
|
|
209
|
-
)
|
|
210
190
|
|
|
211
191
|
if not response.status:
|
|
212
192
|
raise ValueError("Erro ao enviar mensagem de botões.")
|
|
213
193
|
|
|
214
|
-
def
|
|
215
|
-
self,
|
|
216
|
-
text:str,
|
|
217
|
-
button_title: str,
|
|
218
|
-
title: str|None = None,
|
|
219
|
-
element_list: list[dict] = None,
|
|
220
|
-
caption: str|None = None,
|
|
221
|
-
) -> None:
|
|
194
|
+
def transfer_to_human(self, message: str, campaign_name: str) -> None:
|
|
222
195
|
|
|
223
|
-
|
|
224
|
-
raise NameError('Button Title é um parâmetro obrigatório!')
|
|
196
|
+
campaign = self.__router_client.get_campaign_id({"name": campaign_name})
|
|
225
197
|
|
|
226
|
-
|
|
227
|
-
raise ValueError("O número máximo de elementos é 20.")
|
|
228
|
-
|
|
229
|
-
if not text:
|
|
230
|
-
raise ValueError("O corpo da mensagem não pode ser vazio.")
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
response = self.__wpp_server_client.send_list(
|
|
198
|
+
response = self.__router_client.transfer_to_human(
|
|
234
199
|
{
|
|
235
|
-
"
|
|
236
|
-
"
|
|
237
|
-
"unique_customer_id": self.__user_state.voll_id,
|
|
238
|
-
"message_text": text,
|
|
239
|
-
"button_title": button_title,
|
|
240
|
-
"message_caption": caption,
|
|
241
|
-
"message_title": title,
|
|
242
|
-
"options": [{"title": k, "description": v} for k,v in element_list.items()],
|
|
243
|
-
}
|
|
244
|
-
)
|
|
245
|
-
|
|
246
|
-
if not response.status:
|
|
247
|
-
raise ValueError("Erro ao enviar mensagem de lista.")
|
|
248
|
-
|
|
249
|
-
def transfer_to_human(self, message:str, campaign_name:str) -> None:
|
|
250
|
-
response = self.__wpp_server_client.transfer_to_human(
|
|
251
|
-
{
|
|
252
|
-
"hook_id": self.company_phone,
|
|
253
|
-
"enterprise_id": self.customer_phone,
|
|
254
|
-
"unique_customer_id": self.__user_state.customer_id,
|
|
255
|
-
"voll_id": self.__user_state.voll_id,
|
|
256
|
-
"message_text": message,
|
|
257
|
-
"platform": self.channel,
|
|
258
|
-
"campaign_name": campaign_name,
|
|
200
|
+
"chat_id": self.__user_state.chatID.to_dict(),
|
|
201
|
+
"campaign_id": campaign.id,
|
|
259
202
|
}
|
|
260
203
|
)
|
|
261
204
|
|
|
262
205
|
if not response.status:
|
|
263
206
|
raise ValueError("Erro ao transferir chat para humano.")
|
|
264
|
-
|
|
265
|
-
def end_chat(self, message:str, tabulation_name:str) -> None:
|
|
266
|
-
|
|
207
|
+
|
|
208
|
+
def end_chat(self, message: str, tabulation_name: str) -> None:
|
|
209
|
+
tabulation = self.__router_client.get_tabulation_id({"name": tabulation_name})
|
|
210
|
+
|
|
211
|
+
response = self.__router_client.end_chat(
|
|
267
212
|
{
|
|
268
|
-
"
|
|
269
|
-
"
|
|
270
|
-
"unique_customer_id": self.__user_state.customer_id,
|
|
271
|
-
"voll_id": self.__user_state.voll_id,
|
|
272
|
-
"message_text": message,
|
|
273
|
-
"platform": self.channel,
|
|
213
|
+
"chat_id": self.__user_state.chatID.to_dict(),
|
|
214
|
+
"tabulation_id": tabulation.id,
|
|
274
215
|
}
|
|
275
216
|
)
|
|
276
217
|
|
|
277
218
|
if not response.status:
|
|
278
219
|
raise ValueError("Erro ao encerrar chat.")
|
|
279
|
-
|
|
220
|
+
|
|
280
221
|
def delete_user_state(self) -> None:
|
|
281
|
-
response = self.
|
|
222
|
+
response = self.__user_state.delete(self.__grpc_uri)
|
|
282
223
|
|
|
283
224
|
if not response.status:
|
|
284
225
|
raise ValueError("Erro ao deletar estado do usuário.")
|
|
285
226
|
|
|
286
227
|
def update_user_state(
|
|
287
|
-
self,
|
|
228
|
+
self,
|
|
288
229
|
menu: str,
|
|
289
230
|
route: str,
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
response = self.__user_state_client.update_user_state({
|
|
294
|
-
"user_id": self.__user_state.customer_id,
|
|
295
|
-
"menu_id": menu,
|
|
296
|
-
"route": route,
|
|
297
|
-
"obs": json.dumps(obs),
|
|
298
|
-
})
|
|
231
|
+
observation: dict,
|
|
232
|
+
) -> None:
|
|
299
233
|
|
|
300
|
-
if not response.status:
|
|
301
|
-
raise ValueError("Erro ao atualizar estado do usuário.")
|
|
302
|
-
|
|
303
234
|
self.__user_state.menu = menu
|
|
304
235
|
self.__user_state.route = route
|
|
305
|
-
self.__user_state.
|
|
306
|
-
|
|
236
|
+
self.__user_state.observation = observation
|
|
237
|
+
self.__user_state.insert(self.__grpc_uri)
|
|
238
|
+
|
|
239
|
+
@property
|
|
240
|
+
def chatID(self):
|
|
241
|
+
return self.__user_state.chatID
|
|
242
|
+
|
|
243
|
+
@property
|
|
244
|
+
def user_id(self):
|
|
245
|
+
return self.__user_state.chatID.user_id
|
|
246
|
+
|
|
247
|
+
@property
|
|
248
|
+
def company_id(self):
|
|
249
|
+
return self.__user_state.chatID.company_id
|
|
250
|
+
|
|
307
251
|
@property
|
|
308
252
|
def menu(self):
|
|
309
253
|
return self.__user_state.menu
|
|
310
|
-
|
|
254
|
+
|
|
311
255
|
@property
|
|
312
256
|
def route(self):
|
|
313
257
|
return self.__user_state.route
|
|
314
|
-
|
|
315
|
-
@property
|
|
316
|
-
def obs(self):
|
|
317
|
-
return self.__user_state.obs
|
|
318
|
-
|
|
258
|
+
|
|
319
259
|
@property
|
|
320
260
|
def customer_id(self):
|
|
321
261
|
return self.__user_state.customer_id
|
|
322
|
-
|
|
323
|
-
@property
|
|
324
|
-
def voll_id(self):
|
|
325
|
-
return self.__user_state.voll_id
|
|
326
|
-
|
|
262
|
+
|
|
327
263
|
@property
|
|
328
|
-
def
|
|
329
|
-
return self.__user_state.
|
|
264
|
+
def protocol(self):
|
|
265
|
+
return self.__user_state.protocol
|
|
330
266
|
|
|
331
267
|
@property
|
|
332
|
-
def
|
|
333
|
-
return self.__user_state.
|
|
268
|
+
def observation(self):
|
|
269
|
+
return self.__user_state.observation
|
|
334
270
|
|
|
335
271
|
@property
|
|
336
|
-
def
|
|
337
|
-
return self.
|
|
272
|
+
def type_message(self):
|
|
273
|
+
return self.__type_message
|
|
338
274
|
|
|
339
275
|
@property
|
|
340
|
-
def
|
|
341
|
-
return self.
|
|
342
|
-
|
|
276
|
+
def content_message(self):
|
|
277
|
+
return self.__content_message
|
|
278
|
+
|
|
343
279
|
@menu.setter
|
|
344
280
|
def menu(self, menu):
|
|
345
|
-
|
|
346
|
-
self.update_user_state(
|
|
347
|
-
|
|
348
|
-
self.__user_state.route,
|
|
349
|
-
self.__user_state.obs
|
|
350
|
-
)
|
|
351
|
-
|
|
281
|
+
|
|
282
|
+
self.update_user_state(menu, self.__user_state.route, self.__user_state.observation)
|
|
283
|
+
|
|
352
284
|
@route.setter
|
|
353
285
|
def route(self, route):
|
|
354
|
-
|
|
355
|
-
self.update_user_state(
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
@obs.setter
|
|
362
|
-
def obs(self, obs):
|
|
363
|
-
|
|
286
|
+
|
|
287
|
+
self.update_user_state(self.__user_state.menu, route, self.__user_state.observation)
|
|
288
|
+
|
|
289
|
+
@observation.setter
|
|
290
|
+
def observation(self, observation):
|
|
291
|
+
|
|
364
292
|
self.update_user_state(
|
|
365
|
-
self.__user_state.menu,
|
|
366
|
-
self.__user_state.route,
|
|
367
|
-
obs
|
|
293
|
+
self.__user_state.menu, self.__user_state.route, observation
|
|
368
294
|
)
|
|
369
|
-
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
chatgraph/__init__.py,sha256=SAMzqUOZCW8K0mvWns1zjQFimsiZijAMwuJrH_EG-2M,713
|
|
2
|
+
chatgraph/auth/credentials.py,sha256=xsMEpLQnc66novPjL6upocMcnUnvFJ7yxINzUenkxmc,2388
|
|
3
|
+
chatgraph/bot/chatbot_model.py,sha256=GGeU-LZYqR7zhrP-B5gRloJi31_7Vmk7--H9bGKvcto,6826
|
|
4
|
+
chatgraph/bot/chatbot_router.py,sha256=bVbm9dBoC2OesetXlQJpCrkaiLM3GUro0GrOyCSgreI,2586
|
|
5
|
+
chatgraph/cli/__init__.py,sha256=tfgYhGoKy1nD4STN4xDh6J4VV55RICk7v1GZmzAg-bM,7413
|
|
6
|
+
chatgraph/error/chatbot_error.py,sha256=4sEcW8vz0eQk2QDmDygucVM4caHliZW5iH7XJvmLBuk,1897
|
|
7
|
+
chatgraph/error/route_error.py,sha256=CY8m82ap7-Sr-DXPsolltRW50TqD__5RyXBmNNJCWr8,793
|
|
8
|
+
chatgraph/gRPC/gRPCCall.py,sha256=8rxs_tGPY5UeP0dnoqL8zhTZ7XqJLOJcewlK8yB8Q_E,4669
|
|
9
|
+
chatgraph/messages/message_consumer.py,sha256=yHhfLYjtmXQYG44o7SNO6XUaeM4-jH8BpIpPHI-mt8Y,6116
|
|
10
|
+
chatgraph/pb/router.proto,sha256=pw3hTwjdMN8-yJIAlKHNigVKYqM-w2nme9-2bCTBiJ0,2853
|
|
11
|
+
chatgraph/pb/router_pb2.py,sha256=jw-Rg05NMwgOKrRsoubFFb82v_O80KgWY4tIqwUf2Aw,6571
|
|
12
|
+
chatgraph/pb/router_pb2_grpc.py,sha256=KxhVxCMVD9tpuX7CyXqIkzZ4P3zfXeVT92Bt_Hi7mrE,24109
|
|
13
|
+
chatgraph/types/end_types.py,sha256=--Ty2gM_y7J-yRAvZV26e4HMUpoguAMAhfOIS9-kQTk,1316
|
|
14
|
+
chatgraph/types/message_types.py,sha256=NM0kjiajKnZd-Yr56Stehdpr18xc857FZW8TzmqgUmU,3369
|
|
15
|
+
chatgraph/types/request_types.py,sha256=BeUI2l9XZpBf5c8xyPvKI68WZ5u6n98cC8DmUfWKlQ0,8788
|
|
16
|
+
chatgraph/types/route.py,sha256=FO5INy5UXgicuQ8FKEZKcPv6WS5YH10dPx2OaPu_0sE,2978
|
|
17
|
+
chatgraph-0.5.0.dist-info/entry_points.txt,sha256=bO9_Q-PqE5vCNNo6ke_-3j2gHfKQMDGnKDTkNuCdBuA,48
|
|
18
|
+
chatgraph-0.5.0.dist-info/LICENSE,sha256=rVJozpRzDlplOpvI8A1GvmfVS0ReYdZvMWc1j2jV0v8,1090
|
|
19
|
+
chatgraph-0.5.0.dist-info/METADATA,sha256=dDJI_cTfs7Ayhshv6VB7xTvP3aV3uN694bxMD6se65Y,12866
|
|
20
|
+
chatgraph-0.5.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
21
|
+
chatgraph-0.5.0.dist-info/RECORD,,
|
chatgraph/pb/userstate.proto
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
|
|
3
|
-
package userstate;
|
|
4
|
-
|
|
5
|
-
option go_package = "./pb/userstate";
|
|
6
|
-
|
|
7
|
-
service UserStateService {
|
|
8
|
-
rpc SelectUserState(UserStateId) returns (UserState);
|
|
9
|
-
rpc InsertUserState(UserState) returns (RequestStatus);
|
|
10
|
-
rpc UpdateUserState(UserState) returns (RequestStatus);
|
|
11
|
-
rpc DeleteUserState(UserStateId) returns (RequestStatus);
|
|
12
|
-
|
|
13
|
-
rpc GetAllUserStates(Void) returns (UserStatesList);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
message Void {
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
message UserState {
|
|
20
|
-
string user_id = 1;
|
|
21
|
-
string menu_id = 2;
|
|
22
|
-
string route = 3;
|
|
23
|
-
string obs = 4;
|
|
24
|
-
string date = 5;
|
|
25
|
-
bool direction = 6;
|
|
26
|
-
string voll_id = 7;
|
|
27
|
-
string platform = 8;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
message UserStateId {
|
|
31
|
-
string user_id = 1;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
message RequestStatus {
|
|
35
|
-
bool status = 1;
|
|
36
|
-
string message = 2;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
message UserStatesList {
|
|
40
|
-
repeated UserState user_states = 1;
|
|
41
|
-
}
|
chatgraph/pb/userstate_pb2.py
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
-
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
-
# source: userstate.proto
|
|
5
|
-
# Protobuf Python Version: 5.27.2
|
|
6
|
-
"""Generated protocol buffer code."""
|
|
7
|
-
from google.protobuf import descriptor as _descriptor
|
|
8
|
-
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
-
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
-
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
-
from google.protobuf.internal import builder as _builder
|
|
12
|
-
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
-
_runtime_version.Domain.PUBLIC,
|
|
14
|
-
5,
|
|
15
|
-
27,
|
|
16
|
-
2,
|
|
17
|
-
'',
|
|
18
|
-
'userstate.proto'
|
|
19
|
-
)
|
|
20
|
-
# @@protoc_insertion_point(imports)
|
|
21
|
-
|
|
22
|
-
_sym_db = _symbol_database.Default()
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fuserstate.proto\x12\tuserstate\"\x06\n\x04Void\"\x8d\x01\n\tUserState\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x0f\n\x07menu_id\x18\x02 \x01(\t\x12\r\n\x05route\x18\x03 \x01(\t\x12\x0b\n\x03obs\x18\x04 \x01(\t\x12\x0c\n\x04\x64\x61te\x18\x05 \x01(\t\x12\x11\n\tdirection\x18\x06 \x01(\x08\x12\x0f\n\x07voll_id\x18\x07 \x01(\t\x12\x10\n\x08platform\x18\x08 \x01(\t\"\x1e\n\x0bUserStateId\x12\x0f\n\x07user_id\x18\x01 \x01(\t\"0\n\rRequestStatus\x12\x0e\n\x06status\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t\";\n\x0eUserStatesList\x12)\n\x0buser_states\x18\x01 \x03(\x0b\x32\x14.userstate.UserState2\xde\x02\n\x10UserStateService\x12?\n\x0fSelectUserState\x12\x16.userstate.UserStateId\x1a\x14.userstate.UserState\x12\x41\n\x0fInsertUserState\x12\x14.userstate.UserState\x1a\x18.userstate.RequestStatus\x12\x41\n\x0fUpdateUserState\x12\x14.userstate.UserState\x1a\x18.userstate.RequestStatus\x12\x43\n\x0f\x44\x65leteUserState\x12\x16.userstate.UserStateId\x1a\x18.userstate.RequestStatus\x12>\n\x10GetAllUserStates\x12\x0f.userstate.Void\x1a\x19.userstate.UserStatesListB\x10Z\x0e./pb/userstateb\x06proto3')
|
|
28
|
-
|
|
29
|
-
_globals = globals()
|
|
30
|
-
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
31
|
-
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'userstate_pb2', _globals)
|
|
32
|
-
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
-
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
-
_globals['DESCRIPTOR']._serialized_options = b'Z\016./pb/userstate'
|
|
35
|
-
_globals['_VOID']._serialized_start=30
|
|
36
|
-
_globals['_VOID']._serialized_end=36
|
|
37
|
-
_globals['_USERSTATE']._serialized_start=39
|
|
38
|
-
_globals['_USERSTATE']._serialized_end=180
|
|
39
|
-
_globals['_USERSTATEID']._serialized_start=182
|
|
40
|
-
_globals['_USERSTATEID']._serialized_end=212
|
|
41
|
-
_globals['_REQUESTSTATUS']._serialized_start=214
|
|
42
|
-
_globals['_REQUESTSTATUS']._serialized_end=262
|
|
43
|
-
_globals['_USERSTATESLIST']._serialized_start=264
|
|
44
|
-
_globals['_USERSTATESLIST']._serialized_end=323
|
|
45
|
-
_globals['_USERSTATESERVICE']._serialized_start=326
|
|
46
|
-
_globals['_USERSTATESERVICE']._serialized_end=676
|
|
47
|
-
# @@protoc_insertion_point(module_scope)
|