2026-07-07 21:52:11 +08:00
|
|
|
classDiagram
|
2026-08-03 18:46:10 +08:00
|
|
|
class OptionSelectPayload {
|
|
|
|
|
+string conversation_id
|
|
|
|
|
+string option_label
|
|
|
|
|
+string option_value
|
|
|
|
|
+string selected_from_message_id
|
|
|
|
|
+UUID client_msg_id
|
|
|
|
|
+string question_id
|
|
|
|
|
+string option_id
|
|
|
|
|
+validate() bool
|
2026-07-07 21:52:11 +08:00
|
|
|
}
|
2026-07-17 23:08:59 +08:00
|
|
|
class Message {
|
2026-08-03 18:46:10 +08:00
|
|
|
+string id
|
|
|
|
|
+string conversation_id
|
|
|
|
|
+string sender_type
|
|
|
|
|
+string sender_id
|
|
|
|
|
+string content
|
|
|
|
|
+string msg_type
|
|
|
|
|
+dict extra_data
|
2026-07-17 23:08:59 +08:00
|
|
|
+datetime created_at
|
2026-08-03 18:46:10 +08:00
|
|
|
+__init__(...)
|
2026-07-09 11:50:19 +08:00
|
|
|
}
|
2026-08-03 18:46:10 +08:00
|
|
|
class OptionSelectHandler {
|
|
|
|
|
+__init__(session_factory, ws_manager)
|
|
|
|
|
+handle(payload, employee_id) Message
|
|
|
|
|
-acquire_advisory_lock(db, key) void
|
|
|
|
|
-find_duplicate(db, payload) Message
|
|
|
|
|
-persist(db, payload, employee_id) Message
|
|
|
|
|
-to_message_dict(message, masked) dict
|
2026-07-07 21:52:11 +08:00
|
|
|
}
|
2026-08-03 18:46:10 +08:00
|
|
|
class SensitiveMask {
|
|
|
|
|
+mask_sensitive_text(text) string
|
|
|
|
|
+mask_sensitive_value(value) string
|
2026-07-09 11:50:19 +08:00
|
|
|
}
|
2026-08-03 18:46:10 +08:00
|
|
|
class DifyFeedbackContext {
|
|
|
|
|
+string feedback_type
|
|
|
|
|
+string question_id
|
|
|
|
|
+string option_id
|
|
|
|
|
+string option_value
|
|
|
|
|
+string option_label
|
|
|
|
|
+to_inputs() dict
|
2026-07-07 21:52:11 +08:00
|
|
|
}
|
2026-08-03 18:46:10 +08:00
|
|
|
class SelectedOptionsSnapshotBuilder {
|
|
|
|
|
+__init__(db)
|
|
|
|
|
+build(conversation_id) list
|
2026-07-11 23:13:10 +08:00
|
|
|
}
|
2026-08-03 18:46:10 +08:00
|
|
|
class ConnectionManager {
|
|
|
|
|
+dict active_connections
|
|
|
|
|
+dict employee_connections
|
|
|
|
|
+__init__()
|
|
|
|
|
+broadcast(data) void
|
|
|
|
|
+broadcast_to_employees(ids, data) void
|
2026-07-17 23:08:59 +08:00
|
|
|
}
|
|
|
|
|
class ConversationStore {
|
2026-08-03 18:46:10 +08:00
|
|
|
+Message[] messages
|
|
|
|
|
+sendOptionSelect(selection) void
|
|
|
|
|
+handleNewMessage(data) void
|
|
|
|
|
+latestSelection(question_id) Message
|
2026-07-17 23:08:59 +08:00
|
|
|
}
|
|
|
|
|
class MessageBubble {
|
2026-08-03 18:46:10 +08:00
|
|
|
+Message message
|
|
|
|
|
+isLatestSelection() bool
|
|
|
|
|
+maskedContent() string
|
2026-07-17 23:08:59 +08:00
|
|
|
}
|
|
|
|
|
|
2026-08-03 18:46:10 +08:00
|
|
|
OptionSelectHandler --> OptionSelectPayload : validates
|
|
|
|
|
OptionSelectHandler --> Message : creates/returns
|
|
|
|
|
OptionSelectHandler --> SensitiveMask : masks outbound data
|
|
|
|
|
OptionSelectHandler --> ConnectionManager : broadcasts
|
|
|
|
|
OptionSelectHandler --> DifyFeedbackContext : creates after commit
|
|
|
|
|
SelectedOptionsSnapshotBuilder --> Message : queries latest per question
|
|
|
|
|
ConversationStore o-- Message : stores
|
|
|
|
|
MessageBubble --> ConversationStore : derives latest
|
|
|
|
|
MessageBubble --> Message : renders
|