How cjz3899/smartchat works
SmartChat is a server-side messaging application with chat, contacts and rooms, user access, AI chat, and reusable infrastructure modules. The main user workflow is an API request to send a message, followed by message handling and delivery; room and contact operations provide conversation context, while read state, marks, and recall support message lifecycle features. AI handlers provide a separate capability. The README gives no product details, and most implementation files were not excerpted, so unverified application flows are shown as dashed links rather than asserted calls.
Main entry points: ChatServiceImpl.java Chat Service · RecallMsgHandler.java Recall Handler · ChatController.java Chat API · ChatAIHandlerFactory.java AI Providers
Components 24
Application API
- Chat API
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chat/controller/ChatController.java - Contact API
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chat/controller/ContactController.java - Room API
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chat/controller/RoomController.java
Messaging Domain
- Chat Service
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chat/service/impl/ChatServiceImpl.java - Message Handlers
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chat/service/strategy/msg/MsgHandlerFactory.java - Recall Handler
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chat/service/strategy/msg/RecallMsgHandler.java - Chat Persistence
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chat/dao/MessageDao.java - Chat Caches
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chat/service/cache/MsgCache.java - Message Events
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/common/event/MessageRecallEvent.java - Room Service
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chat/service/impl/RoomAppServiceImpl.java
Users And Contacts
- Contact Service
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chat/service/impl/ContactServiceImpl.java - Friend Service
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/user/service/FriendService.java - User Authentication
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/user/service/UserAuthService.java - WebSocket Delivery
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/user/service/WebSocketService.java - Push Service
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/user/service/impl/PushService.java
AI Chat
- AI Service
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chatai/service/impl/ChatAIServiceImpl.java - AI Providers
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chatai/handler/ChatAIHandlerFactory.java - GPT Provider
- ChatGLM Provider
Shared Infrastructure
- Message Queue
- Rate Control
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/common/service/frequencycontrol/AbstractFrequencyControlService.java - Reliable Invocation
smartchat-tools/smartchat-transaction/src/main/java/com/junzhecai/smartchat/transaction/service/SecureInvokeService.java - Retry Records
smartchat-tools/smartchat-transaction/src/main/java/com/junzhecai/smartchat/transaction/dao/SecureInvokeRecordDao.java
Other components
- Chat Client
Connections 20
- Chat Client → Chat API: requests
- Chat API → Chat Service: delegates
- Chat Service → Message Handlers: dispatches
- Message Handlers → Chat Persistence: persists
- Chat Service → Room Service: uses rooms
- Contact API → Contact Service: delegates
- Room API → Room Service: delegates
- Chat Client → User Authentication: authenticates
- Chat Service → Chat Caches: uses cache
- Recall Handler → Chat Persistence: updates
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chat/service/strategy/msg/RecallMsgHandler.java - Recall Handler → Message Events: publishes
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chat/service/strategy/msg/RecallMsgHandler.java - Recall Handler → Chat Caches: reads cache
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/chat/service/strategy/msg/RecallMsgHandler.java - Friend Service → Contact Service: supports contacts
- Push Service → Message Queue: produces messages
smartchat-chat-server/src/main/java/com/junzhecai/smartchat/user/service/impl/PushService.java - Message Queue → WebSocket Delivery: delivers
- AI Service → AI Providers: selects handler
- AI Providers → GPT Provider: routes
- AI Providers → ChatGLM Provider: routes
- Chat API → Rate Control: rate-limits
- Reliable Invocation → Retry Records: stores retries
smartchat-tools/smartchat-transaction/src/main/java/com/junzhecai/smartchat/transaction/service/SecureInvokeService.java