chatgraph 1.2.5__tar.gz → 1.2.6__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.
Files changed (65) hide show
  1. {chatgraph-1.2.5 → chatgraph-1.2.6}/PKG-INFO +1 -1
  2. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/logger/user_logger.py +9 -0
  3. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/types/usercall.py +7 -2
  4. {chatgraph-1.2.5 → chatgraph-1.2.6}/pyproject.toml +1 -1
  5. {chatgraph-1.2.5 → chatgraph-1.2.6}/.env.example +0 -0
  6. {chatgraph-1.2.5 → chatgraph-1.2.6}/.github/agents/SkillManager.agent.md +0 -0
  7. {chatgraph-1.2.5 → chatgraph-1.2.6}/.github/agents/architect.agent.md +0 -0
  8. {chatgraph-1.2.5 → chatgraph-1.2.6}/.github/agents/code-reviewer.agent.md +0 -0
  9. {chatgraph-1.2.5 → chatgraph-1.2.6}/.github/agents/developer.agent.md +0 -0
  10. {chatgraph-1.2.5 → chatgraph-1.2.6}/.github/copilot-instructions.md +0 -0
  11. {chatgraph-1.2.5 → chatgraph-1.2.6}/.github/skills/chatgraph-framework/SKILL.md +0 -0
  12. {chatgraph-1.2.5 → chatgraph-1.2.6}/.gitignore +0 -0
  13. {chatgraph-1.2.5 → chatgraph-1.2.6}/.python-version +0 -0
  14. {chatgraph-1.2.5 → chatgraph-1.2.6}/LICENSE +0 -0
  15. {chatgraph-1.2.5 → chatgraph-1.2.6}/README.md +0 -0
  16. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/__init__.py +0 -0
  17. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/auth/credentials.py +0 -0
  18. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/bot/chatbot_model.py +0 -0
  19. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/bot/chatbot_router.py +0 -0
  20. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/bot/default_functions.py +0 -0
  21. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/bot/default_guard.py +0 -0
  22. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/cli/__init__.py +0 -0
  23. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/container/container.py +0 -0
  24. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/error/chatbot_error.py +0 -0
  25. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/error/route_error.py +0 -0
  26. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/gRPC/gRPCCall.py +0 -0
  27. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/logger/__init__.py +0 -0
  28. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/logger/logger.py +0 -0
  29. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/messages/message_consumer.py +0 -0
  30. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/models/actions.py +0 -0
  31. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/models/http_responses.py +0 -0
  32. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/models/message.py +0 -0
  33. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/models/platform_state.py +0 -0
  34. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/models/userstate.py +0 -0
  35. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/pb/router.proto +0 -0
  36. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/pb/router_pb2.py +0 -0
  37. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/pb/router_pb2_grpc.py +0 -0
  38. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/services/__init__.py +0 -0
  39. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/services/router_http_client.py +0 -0
  40. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/types/background_task.py +0 -0
  41. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/types/end_types.py +0 -0
  42. {chatgraph-1.2.5 → chatgraph-1.2.6}/chatgraph/types/route.py +0 -0
  43. {chatgraph-1.2.5 → chatgraph-1.2.6}/docs/gaps-go-to-python.md +0 -0
  44. {chatgraph-1.2.5 → chatgraph-1.2.6}/docs/gaps-python-to-go.md +0 -0
  45. {chatgraph-1.2.5 → chatgraph-1.2.6}/example.py +0 -0
  46. {chatgraph-1.2.5 → chatgraph-1.2.6}/example2.py +0 -0
  47. {chatgraph-1.2.5 → chatgraph-1.2.6}/jsons/voll_return.json +0 -0
  48. {chatgraph-1.2.5 → chatgraph-1.2.6}/poetry.lock +0 -0
  49. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/__init__.py +0 -0
  50. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/integration/__init__.py +0 -0
  51. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/integration/conftest.py +0 -0
  52. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/integration/test_router_client_integration.py +0 -0
  53. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/unit/__init__.py +0 -0
  54. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/unit/conftest.py +0 -0
  55. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/unit/test_default_guard.py +0 -0
  56. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/unit/test_guard.py +0 -0
  57. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/unit/test_message_consumer.py +0 -0
  58. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/unit/test_models_actions.py +0 -0
  59. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/unit/test_models_message.py +0 -0
  60. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/unit/test_models_platform_state.py +0 -0
  61. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/unit/test_models_userstate.py +0 -0
  62. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/unit/test_router_http_client.py +0 -0
  63. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/unit/test_user_logger.py +0 -0
  64. {chatgraph-1.2.5 → chatgraph-1.2.6}/tests/unit/test_usercall.py +0 -0
  65. {chatgraph-1.2.5 → chatgraph-1.2.6}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chatgraph
3
- Version: 1.2.5
3
+ Version: 1.2.6
4
4
  Summary: A user-friendly chatbot library
5
5
  Project-URL: Homepage, https://github.com/irissonnlima/chatgraph
6
6
  Project-URL: Repository, https://github.com/irissonnlima/chatgraph
@@ -9,6 +9,14 @@ _ENV_LEVEL = os.getenv("CHATGRAPH_LOG_LEVEL", "").upper()
9
9
  _DEFAULT_LEVEL: int = getattr(logging, _ENV_LEVEL, logging.INFO)
10
10
 
11
11
 
12
+ class ChatIDFilter(logging.Filter):
13
+ def filter(self, record: logging.LogRecord) -> bool:
14
+ chat_id = getattr(record, 'chat_id', None)
15
+ if chat_id:
16
+ record.msg = f'[ChatID: {chat_id}] - {record.msg}'
17
+ return True
18
+
19
+
12
20
  class UserLoggerManager:
13
21
  _loggers: dict[str, logging.Logger] = {}
14
22
  _level: int = _DEFAULT_LEVEL
@@ -48,6 +56,7 @@ class UserLoggerManager:
48
56
  stream_handler.setLevel(cls._level)
49
57
  stream_handler.setFormatter(logging.Formatter(LOG_FORMAT))
50
58
  logger.addHandler(stream_handler)
59
+ logger.addFilter(ChatIDFilter())
51
60
 
52
61
  cls._loggers[key] = logger
53
62
  return logger
@@ -43,8 +43,13 @@ class UserCall: # noqa: PLR0904
43
43
  self.__content_message = self.__message.text_message.detail
44
44
 
45
45
  @property
46
- def logger(self) -> logging.Logger:
47
- return UserLoggerManager.get_user_logger(self.user_id, self.company_id)
46
+ def logger(self) -> logging.LoggerAdapter:
47
+ base_logger = UserLoggerManager.get_user_logger(
48
+ self.user_id, self.company_id
49
+ )
50
+ return logging.LoggerAdapter(
51
+ base_logger, {'chat_id': str(self.__user_state.chat_id)}
52
+ )
48
53
 
49
54
  def __str__(self):
50
55
  return (
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "chatgraph"
3
- version = "1.2.5"
3
+ version = "1.2.6"
4
4
  description = "A user-friendly chatbot library"
5
5
  authors = [
6
6
  {name = "Irisson N. Lima", email = "irisson.lima@verdecard.com.br"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes