An Enovate Wiki
Attachments
History
Blame
View Source
Changelog
Documentation
About An Otter Wiki
Toggle dark mode
Login
Home
A - Z
Page Index
CMMI
Governance
Template
Statement Of Work
Guidelines
Coding Standard
Android Coding Standards
Core Java
Front-End Styling (CSS)
Golang
iOS Coding Standard (Swift)
Java EE
Javascript
Python
Request structure guidelines
Scala
TypeScript
Product Integration
Practical Training PPT
Procedure
Configuration Management (CM)
Estimating (EST)
Managing Performance and Measurement (MPM)
Monitoring and Control (MC)
Peer Review (PR)
Planning (PLAN)
Process Management (PCM)
Process Quality Assurance (PQA)
Product Integration (PI)
Requirement Development Management(RDM)
Risk and Opportunity Management
Technical Solution (TS)
Verification and Validation (VV)
Process Areas
Process Areas - Documents & Evidences
Standard
Document Creation
Naming Convention Standard
Templates
Audit Plan
LLD
Enovate Tools
EnovateIT
Company Profile & Website Portfolio
Home
Local AI
Projects
Audit-matic
HLD
CommNet
Face Recognation
Document
Flowcast
Enovate IT-QMS-PL01-Project Plan-[FlowCast]-V10
HireGenius
SRS
Technical Document (LLD+HLD))
OptiQA
Sentify
SkillShift
HLD
LLD
Social Media Manager
Teams
Team Apex
Team Catalyst
Team Fusion
Team Nova
Team Orbit
Team Pulse
Team Quantum
Team Spark
Team Vision
Templates
Project Template
Team Template
Projects
CommNet
c8d48c
Commit
c8d48c
2025-10-16 07:09:56
Vaishnavi Shinde
: upadted db design
Projects/CommNet.md
..
@@ 45,14 45,14 @@
- **Customer-facing AI bot interface**: chat page embedded in client’s site, Telegram, email, etc.
- **Admin dashboard**: monitor conversations, override responses
-
## Backend (Node.js)
-
- **Core app framework**: NestJs
-
- **Authentication & Accounts**: BetterAuth
-
- **Project & Channel Management**: Store client configs (Telegram bot keys, email SMTP creds, AI model choice)
-
- **Message Orchestration**: Routes queries → preprocess → AI model → knowledge base → return response
-
- **Knowledge Base (MCP integration)**: Ingest docs, PDFs, Google Drive/OneDrive, index content, semantic search
-
- **AI Connector Layer**: Wrappers for ChatGPT, Gemini, and future LLMs
-
- **Monitoring & Logging**: Store all conversations, admin can review & edit
+
## Backend (Go)
+
- **Core framework**: Go (Golang) using a modular, clean architecture pattern (e.g., layered or hexagonal).
+
- **API layer: Standard** Go HTTP server with chi or Echo for routing.
+
- **Authentication & Accounts**: JWT-based multi-tenant authentication.
+
- **Project & Channel Management**: Business logic for workspaces, channels, and configurations.
+
- **Message Orchestration**: Handles incoming messages, context injection, AI processing pipeline, and logging.
+
- **Knowledge Base Integration**: Document ingestion, indexing, and retrieval pipeline in Go.
+
## Database
- **PostgreSQL**: for structured data (users, projects, configs, logs)
@@ 84,83 84,9 @@
## System Architecutre Diagram

-
```mermaid
-
flowchart TB
-
-
%% SECTION: External
-
subgraph EXT[External Environment]
-
Customer[Customer (End User)]
-
end
-
-
%% SECTION: Comnet Platform
-
subgraph COM[Comnet Platform]
-
Reg[User Registration & Auth Service]
-
TenantMgr[Workspace / Tenant Manager]
-
end
-
-
%% SECTION: Workspace Layer
-
subgraph WS[Workspace Layer (per Client)]
-
subgraph WM[Workspace Modules]
-
Users[User & Group Management]
-
Clients[Client Records]
-
Tasks[Task Management Module]
-
KB[Knowledge Base]
-
Analytics[Reports & Analytics]
-
end
-
Channels[Channel Integrations (Email, Telegram, SMS)]
-
Agents[Channel Agents]
-
end
-
-
%% SECTION: Core System
-
subgraph CORE[Core Processing Layer]
-
MCP[MCP Server (Message Coordination Processor)]
-
AIHub[AI Model Router]
-
subgraph AI[AI Services]
-
ChatGPT[(ChatGPT Model)]
-
Gemini[(Gemini Model)]
-
end
-
end
-
-
%% Data Stores
-
DB[(Database Storage)]
-
Logs[(Conversation Logs)]
-
-
%% External Connections
-
Customer <--> Channels
-
Channels --> Agents
-
Agents --> MCP
-
MCP --> AIHub
-
AIHub --> ChatGPT
-
AIHub --> Gemini
-
AIHub --> KB
-
KB --> MCP
-
MCP --> Tasks
-
MCP --> Agents
-
Tasks --> Users
-
Users --> Analytics
-
Agents --> Logs
-
WS --> DB
-
-
%% Comnet relationships
-
Reg --> TenantMgr
-
TenantMgr --> WS
-
-
%% Labels
-
classDef external fill:#f5f5f5,stroke:#999,stroke-width:1px;
-
classDef service fill:#e0f7fa,stroke:#0288d1,stroke-width:1px;
-
classDef ai fill:#fff3e0,stroke:#fb8c00,stroke-width:1px;
-
classDef storage fill:#f1f8e9,stroke:#7cb342,stroke-width:1px;
-
classDef core fill:#fce4ec,stroke:#ad1457,stroke-width:1px;
-
class COM,WS,CORE service;
-
class AI,AIHub ai;
-
class DB,Logs,KB storage;
-
class Customer external;
-
```
-
-
## 1. Tech Stack
-
- **Backend (Node.js)**
-
- **FastAPI** (async, lightweight, API-first approach) or Djangofeatures).
+
- **Backend (Go backend)**
+
- The backend is implemented in Go, providing a performant and scalable foundation for multi-tenant communication workflows.
- **Database**
- **PostgreSQL** (perfectly suited for multi-tenant, relational data storage).
- **Frontend**
@@ 226,18 152,217 @@
---
-
## 3. Database Design (Postgres)
-
**Tables (example):**
-
- `clients` → Client info (name, domain, etc.)
-
- `projects` → Linked to clients (stores project metadata).
-
- `channels` → Configured communication channels.
-
- `ai_models` → Available model connectors.
-
- `knowledge_base` → Documents & embeddings.
-
- `queries` → User queries & responses.
-
- `users` → Client admins & internal admins.
+
## 3. Database Design (PostgreSQL)
+
+
### Tables
+
+
- **`accounts`**
+
Stores client/organization information.
+
**Fields:**
+
- `id` (string, PK)
+
- `name` (varchar(150))
+
- `domain` (varchar(100))
+
- `description` (text)
+
+
- **`workspaces`**
+
Stores project metadata linked to an account.
+
**Fields:**
+
- `id` (string, PK)
+
- `account_id` (string, FK → accounts.id)
+
- `name` (varchar(150))
+
- `description` (text)
+
+
- **`users`**
+
Stores basic user profile information.
+
**Fields:**
+
- `id` (string, PK)
+
- `username` (varchar(50))
+
- `full_name` (varchar(150))
+
- `email` (varchar(150))
+
- `phone_number` (varchar(20))
+
- `password_hash` (varchar(255))
+
- `auth_token` (varchar(500))
+
+
- **`user_accounts`**
+
Maps users to accounts and optionally workspaces; stores roles and status.
+
**Fields:**
+
- `id` (string, PK)
+
- `user_id` (string, FK → users.id)
+
- `account_id` (string, FK → accounts.id)
+
- `workspace_id` (string, nullable, FK → workspaces.id)
+
- `role` (varchar(50))
+
- `status` (varchar(50))
+
+
- **`workspace_users`**
+
Maps users to workspaces for workspace-specific roles/status.
+
**Fields:**
+
- `id` (string, PK)
+
- `user_id` (string, FK → users.id)
+
- `workspace_id` (string, FK → workspaces.id)
+
- `role` (varchar(50))
+
- `status` (varchar(50))
+
+
- **`groups`**
+
Represents functional teams or user groups within a workspace.
+
**Fields:**
+
- `id` (string, PK)
+
- `workspace_id` (string, FK → workspaces.id)
+
- `name` (varchar(100))
+
- `description` (text)
+
+
- **`group_users`**
+
Maps users to groups.
+
**Fields:**
+
- `id` (string, PK)
+
- `group_id` (string, FK → groups.id)
+
- `user_id` (string, FK → users.id)
+
- `role` (varchar(50))
+
+
- **`channels`**
+
Configured communication channels within a workspace.
+
**Fields:**
+
- `id` (string, PK)
+
- `workspace_id` (string, FK → workspaces.id)
+
- `type` (varchar(50))
+
- `config` (jsonb)
+
- `description` (text)
+
+
- **`ai_models`**
+
Available AI model connectors for accounts.
+
**Fields:**
+
- `id` (string, PK)
+
- `account_id` (string, FK → accounts.id)
+
- `name` (varchar(100))
+
- `ai_type` (varchar(50))
+
- `version` (varchar(50))
+
- `config` (jsonb)
+
- `description` (text)
+
+
- **`ai_agents`**
+
Agents linked to a workspace and a single channel; connect to AI models.
+
**Fields:**
+
- `id` (string, PK)
+
- `workspace_id` (string, FK → workspaces.id)
+
- `channel_id` (string, unique, FK → channels.id)
+
- `ai_model_id` (string, FK → ai_models.id)
+
- `name` (varchar(100))
+
- `status` (varchar(50))
+
- `description` (text)
+
+
- **`mcp_connections`**
+
Stores Message Coordination Processor connection configuration.
+
**Fields:**
+
- `id` (string, PK)
+
- `workspace_id` (string, FK → workspaces.id)
+
- `type` (varchar(50))
+
- `config` (jsonb)
+
- `description` (text)
+
+
- **`mcp_logs`**
+
Stores request and response logs for MCP connections.
+
**Fields:**
+
- `id` (string, PK)
+
- `mcp_connection_id` (string, FK → mcp_connections.id)
+
- `request_data` (jsonb)
+
- `response_data` (jsonb)
+
- `status` (varchar(50))
+
- `log_timestamp` (timestamp)
+
+
- **`knowledge_bases`**
+
Stores knowledge base entries linked to workspaces.
+
**Fields:**
+
- `id` (string, PK)
+
- `workspace_id` (string, FK → workspaces.id)
+
- `title` (varchar(200))
+
- `description` (text)
+
+
- **`kb_files`**
+
Stores files uploaded to a knowledge base.
+
**Fields:**
+
- `id` (string, PK)
+
- `knowledge_base_id` (string, FK → knowledge_bases.id)
+
- `workspace_id` (string, FK → workspaces.id)
+
- `user_id` (string, FK → users.id)
+
- `file_name` (varchar(255))
+
- `file_path` (text)
+
- `mime_type` (varchar(100))
+
- `file_size` (bigint)
+
+
- **`kb_file_chunks`**
+
Stores content chunks for each knowledge base file, along with vector embeddings.
+
**Fields:**
+
- `id` (string, PK)
+
- `kb_file_id` (string, FK → kb_files.id)
+
- `chunk_index` (int)
+
- `content` (text)
+
- `vector_embedding` (text)
+
+
- **`tasks`**
+
Tracks tasks created in a workspace (optionally linked to a conversation).
+
**Fields:**
+
- `id` (string, PK)
+
- `workspace_id` (string, FK → workspaces.id)
+
- `agent_id` (string, FK → ai_agents.id)
+
- `user_id` (string, FK → users.id)
+
- `conversation_id` (string, nullable, FK → conversations.id)
+
- `title` (varchar(200))
+
- `description` (text)
+
- `status` (varchar(50))
+
+
- **`task_activity`**
+
Logs actions and updates performed on tasks.
+
**Fields:**
+
- `id` (string, PK)
+
- `task_id` (string, FK → tasks.id)
+
- `action` (varchar(100))
+
- `performed_by` (string)
+
- `details` (jsonb)
+
- `activity_timestamp` (timestamp)
+
+
- **`conversations`**
+
Stores conversation metadata within a workspace.
+
**Fields:**
+
- `id` (string, PK)
+
- `workspace_id` (string, FK → workspaces.id)
+
- `channel_id` (string, FK → channels.id)
+
- `agent_id` (string, FK → ai_agents.id)
+
- `title` (varchar(200))
+
- `status` (varchar(50))
+
+
- **`messages`**
+
Stores messages in a conversation, including prompts and memory/archive info.
+
**Fields:**
+
- `id` (string, PK)
+
- `conversation_id` (string, FK → conversations.id)
+
- `user_id` (string, FK → users.id)
+
- `sender_type` (varchar(50))
+
- `prompt_id` (string, nullable)
+
- `content` (text)
+
- `is_memory_archived` (bool)
+
- `metadata` (jsonb)
+
+
- **`memories`**
+
Stores memory entries for agents within a conversation.
+
**Fields:**
+
- `id` (string, PK)
+
- `agent_id` (string, FK → ai_agents.id)
+
- `conversation_id` (string, FK → conversations.id)
+
- `memory_type` (varchar(50))
+
- `content` (text)
+
+
- **`invites`**
+
Stores workspace invitation records for users.
+
**Fields:**
+
- `id` (string, PK)
+
- `workspace_id` (string, FK → workspaces.id)
+
- `email` (varchar(150))
+
- `role` (varchar(50))
+
- `token` (varchar(255))
+
- `status` (varchar(50))
+
- `invited_by` (string, FK → users.id)
+
- `expires_at` (timestamp)
-
Use **pgvector** for embeddings storage and similarity search.
---
@@ 259,338 384,87 @@
- Caching layer (Redis) for session storage & rate limiting.
---
-
# ERD Diagram - [Click to View](https://getu.at/njSIwX)
-
```mermaid
-
%%----------------------------------------------------
-
%% Collaborative AI Workspace Platform Data Model (Updated)
-
%%----------------------------------------------------
-
erDiagram
-
-
ACCOUNTS {
-
string id PK
-
varchar name
-
varchar domain
-
text description
-
}
-
-
WORKSPACES {
-
string id PK
-
string account_id
-
varchar name
-
text description
-
}
-
-
WORKSPACE_USERS {
-
string id PK
-
string user_id
-
string workspace_id
-
varchar role
-
varchar status
-
}
-
-
GROUPS {
-
string id PK
-
string workspace_id
-
varchar name
-
text description
-
}
-
-
GROUP_USERS {
-
string id PK
-
string group_id
-
string user_id
-
varchar role
-
}
-
-
USERS {
-
string id PK
-
varchar username
-
varchar full_name
-
varchar email
-
varchar phone_number
-
varchar password_hash
-
varchar auth_token
-
}
-
-
USER_ACCOUNTS {
-
string id PK
-
string user_id
-
string account_id
-
varchar role
-
varchar status
-
}
-
-
CHANNELS {
-
string id PK
-
string workspace_id
-
varchar type
-
jsonb config
-
text description
-
}
-
-
AI_MODELS {
-
string id PK
-
string account_id
-
varchar name
-
varchar ai_type
-
varchar version
-
jsonb config
-
text description
-
}
-
-
AI_AGENTS {
-
string id PK
-
string workspace_id
-
string channel_id
-
string ai_model_id
-
varchar name
-
varchar status
-
text description
-
}
-
-
MCP_CONNECTIONS {
-
string id PK
-
string workspace_id
-
varchar type
-
jsonb config
-
text description
-
}
-
-
MCP_LOGS {
-
string id PK
-
string mcp_connection_id
-
jsonb request_data
-
jsonb response_data
-
varchar status
-
timestamp log_timestamp
-
}
-
-
KNOWLEDGE_BASES {
-
string id PK
-
string workspace_id
-
varchar title
-
text description
-
}
-
-
KB_FILES {
-
string id PK
-
string knowledge_base_id
-
string workspace_id
-
string user_id
-
varchar file_name
-
text file_path
-
varchar mime_type
-
bigint file_size
-
}
-
-
KB_FILE_CHUNKS {
-
string id PK
-
string kb_file_id
-
int chunk_index
-
text content
-
text vector_embedding
-
}
-
-
TASKS {
-
string id PK
-
string workspace_id
-
string agent_id
-
string user_id
-
string conversation_id
-
varchar title
-
text description
-
varchar status
-
}
-
-
TASK_ACTIVITY {
-
string id PK
-
string task_id
-
varchar action
-
string performed_by
-
jsonb details
-
timestamp activity_timestamp
-
}
-
-
CONVERSATIONS {
-
string id PK
-
string workspace_id
-
string channel_id
-
string agent_id
-
varchar title
-
varchar status
-
}
-
-
MESSAGES {
-
string id PK
-
string conversation_id
-
string user_id
-
varchar sender_type
-
string prompt_id
-
text content
-
bool is_memory_archived
-
jsonb metadata
-
}
-
-
MEMORIES {
-
string id PK
-
string agent_id
-
string conversation_id
-
varchar memory_type
-
text content
-
}
-
-
INVITES {
-
string id PK
-
string workspace_id
-
varchar email
-
varchar role
-
varchar token
-
varchar status
-
string invited_by
-
timestamp expires_at
-
}
-
-
%%---------------------------------------------
-
%% Relationships
-
%%---------------------------------------------
-
-
WORKSPACES }o--|| ACCOUNTS : "belongs_to"
-
USER_ACCOUNTS }o--|| USERS : "belongs_to"
-
USER_ACCOUNTS }o--|| ACCOUNTS : "belongs_to"
-
WORKSPACE_USERS }o--|| USERS : "assigned_to"
-
WORKSPACE_USERS }o--|| WORKSPACES : "in"
-
-
GROUPS }o--|| WORKSPACES : "belongs_to"
-
GROUP_USERS }o--|| GROUPS : "belongs_to"
-
GROUP_USERS }o--|| USERS : "includes"
-
-
CHANNELS }o--|| WORKSPACES : "belongs_to"
-
-
AI_AGENTS }o--|| WORKSPACES : "belongs_to"
-
AI_AGENTS ||--|| CHANNELS : "linked_to"
-
AI_AGENTS }o--|| AI_MODELS : "uses"
-
-
MCP_CONNECTIONS }o--|| WORKSPACES : "belongs_to"
-
MCP_LOGS }o--|| MCP_CONNECTIONS : "logs_for"
-
-
KNOWLEDGE_BASES }o--|| WORKSPACES : "belongs_to"
-
KB_FILES }o--|| KNOWLEDGE_BASES : "belongs_to"
-
KB_FILES }o--|| WORKSPACES : "in"
-
KB_FILES }o--|| USERS : "uploaded_by"
-
KB_FILE_CHUNKS }o--|| KB_FILES : "part_of"
-
-
TASKS }o--|| WORKSPACES : "belongs_to"
-
TASKS }o--|| AI_AGENTS : "handled_by"
-
TASKS }o--|| USERS : "assigned_to"
-
TASKS }o--|| CONVERSATIONS : "related_to"
-
-
TASK_ACTIVITY }o--|| TASKS : "logs"
-
-
CONVERSATIONS }o--|| WORKSPACES : "belongs_to"
-
CONVERSATIONS }o--|| CHANNELS : "occurs_in"
-
CONVERSATIONS }o--|| AI_AGENTS : "handled_by"
-
-
MESSAGES }o--|| CONVERSATIONS : "belongs_to"
-
MESSAGES }o--|| USERS : "sent_by"
-
-
MEMORIES }o--|| AI_AGENTS : "associated_with"
-
MEMORIES }o--|| CONVERSATIONS : "linked_to"
-
-
INVITES }o--|| WORKSPACES : "for"
-
INVITES }o--|| USERS : "invited_by"
-
```
-
-
# Sequence Diagram - [Click to View](https://getu.at/kDgGCA)
+
# Sequence Diagram - [Click to View](https://getu.at/hWuEId)
```mermaid
sequenceDiagram
-
autonumber
-
-
%% ===== PARTICIPANTS =====
-
participant Client as 🧑 Client (Workspace Owner)
-
participant Comnet as 🌐 Comnet Portal
-
participant WS as 🏢 Workspace Service
-
participant Channel as 💬 Communication Channel (Email/Telegram)
-
participant Agent as 🤖 Channel Agent
-
participant MCP as 🧠 MCP Server
-
participant AI as 🧩 AI Model Router (ChatGPT/Gemini)
-
participant KB as 📚 Knowledge Base Service
-
participant Task as 📋 Task Service
-
participant DB as 🗄️ PostgreSQL Database
-
-
%% ===== REGISTRATION & WORKSPACE CREATION =====
-
Client->>Comnet: Register on Comnet
-
Comnet->>DB: INSERT client credentials and org record
-
Comnet-->>Client: Return registration success + auth token
-
-
Client->>WS: Create Workspace
-
WS->>DB: INSERT workspace details linked to client
-
WS-->>Client: Workspace created successfully
-
-
%% ===== WORKSPACE CONFIGURATION =====
-
Client->>WS: Add Users, Groups, Clients
-
WS->>DB: INSERT user/group/client records
-
Client->>KB: Upload KB documents / FAQs / SOPs
-
KB->>DB: INSERT KB entries + embeddings
-
KB-->>Client: KB indexed successfully
-
Client->>WS: Configure Communication Channels (Email, Telegram, SMS)
-
WS->>DB: UPDATE workspace with channel settings
-
WS-->>Client: Channel configuration saved
-
-
%% ===== AI & MCP CONFIGURATION =====
-
Client->>AI: Configure AI Models (ChatGPT, Gemini)
-
AI->>DB: INSERT model config (API keys, version, workspace linkage)
-
AI-->>Client: Model configuration confirmed
-
-
Client->>MCP: Configure MCP routing rules (channel–AI mapping)
-
MCP->>DB: INSERT routing and message handling configuration
-
MCP-->>Client: MCP configured successfully
-
-
Note over Client,DB: Workspace setup completed (Users, Channels, AI, MCP, KB)
-
-
%% ===== CUSTOMER COMMUNICATION FLOW =====
-
Note over Channel,Agent: Customer sends query via selected channel
-
Channel->>Agent: Receive inbound message
-
Agent->>MCP: Forward message + workspace/channel context
-
MCP->>DB: SELECT workspace configuration + routing rules
-
MCP->>AI: Route message to appropriate AI model
-
-
%% ===== AI PROCESSING & KB INTERACTION =====
-
AI->>KB: Request contextual KB data
-
KB->>DB: SELECT related knowledge entries
-
DB-->>KB: Return matching KB results
-
KB-->>AI: Provide relevant context
-
AI-->>MCP: Return AI-generated response + detected intent
-
-
%% ===== TASK MANAGEMENT =====
-
alt Actionable Intent Detected
-
MCP->>Task: Create new task (assigned to group)
-
Task->>DB: INSERT new task entry
-
Task-->>MCP: Task creation success
-
else Informational Only
-
MCP-->>Agent: Return AI response for delivery
+
%% Participants
+
participant ClientUser as Client (Registers on Comnet)
+
participant Comnet as Comnet System
+
participant Workspace as Workspace (Project)
+
participant WorkspaceOwner as Workspace Owner (ClientUser Role)
+
participant ChannelConfig as Channel Configuration
+
participant Channel as Communication Channel (Email/Telegram/SMS)
+
participant Agent as Channel Agent
+
participant Customer as Customer (Client's customer)
+
participant MCP as MCP Server (Message Coordination Processor)
+
participant AI as AI Model (ChatGPT/Gemini)
+
participant KB as Knowledge Base
+
participant Task as Task Management Module
+
participant Group as Group (Managers & Members)
+
participant Member as Group Member
+
+
%% Registration and Workspace Creation by Client (Workspace Owner)
+
ClientUser->>Comnet: Register account
+
Comnet-->>ClientUser: Account created
+
ClientUser->>Workspace: Create new workspace (project)
+
Workspace-->>ClientUser: Workspace created
+
ClientUser->>WorkspaceOwner: Become workspace owner
+
+
%% Workspace Setup & Channel Configuration (done by workspace owner)
+
+
WorkspaceOwner->>Workspace: Create groups and assign roles (Manager / Member)
+
WorkspaceOwner->>ChannelConfig: Add and configure channels (Email / Telegram / SMS)
+
ChannelConfig-->>Workspace: Channels registered and linked to workspace
+
ChannelConfig->>Agent: Provision Channel Agents for each channel
+
Agent-->>Workspace: Channel Agents ready and bound to workspace
+
+
%% Normal flow: Customer raises query on a configured channel
+
Customer->>Channel: Send message/query (via configured channel)
+
Channel->>Agent: Channel Agent receives and forwards message
+
Agent->>MCP: Forward message + workspace context (client id, channel id, conversation history)
+
+
%% AI processing using KB and workspace context
+
MCP->>AI: Send message + workspace context + KB pointers
+
AI->>KB: Request relevant KB entries and workspace-specific context
+
KB-->>AI: Return KB results and context
+
AI-->>MCP: Return generated response + intent detection (actionable? yes/no) + confidence
+
+
%% Conditional: If AI detects actionable intent -> create task in same workspace and assign to group
+
alt Actionable intent detected
+
MCP->>Task: Create Task in Workspace (details, priority, assignee group)
+
Task->>Group: Assign task to specific group or manager
+
Group-->>Task: Acknowledgement of task assignment
+
Task->>Workspace: Log task creation and link it to conversation
+
Workspace-->>WorkspaceOwner: Notify workspace members (or assigned group) of new task
end
-
%% ===== RESPONSE DELIVERY =====
-
MCP->>Agent: Send AI response payload
-
Agent->>Channel: Deliver reply back to customer
-
Channel-->>Customer: Message displayed
-
-
%% ===== KNOWLEDGE UPDATE (Learning Loop) =====
-
alt New Insight Identified
-
AI->>KB: Suggest KB entry addition/update
-
KB->>DB: INSERT or UPDATE KB record
-
KB-->>AI: Update acknowledged
+
%% Response delivery back to customer via same channel
+
MCP-->>Agent: Return AI-generated reply (and task info if created)
+
Agent-->>Channel: Send reply via originating channel
+
Channel-->>Customer: Deliver AI response to customer
+
+
%% Group resolves task (if created)
+
alt Task exists
+
Member->>Task: View task and start work
+
Member->>Group: Update task status / add comments / attach files
+
Group-->>Task: Mark task progress or resolution
+
Task-->>Workspace: Update task log and notify conversation thread
+
Workspace-->>Customer: Optionally send status update (via Channel) if configured
end
-
%% ===== LOGGING & ANALYTICS =====
-
MCP->>DB: INSERT message, AI response, metadata
-
Task->>DB: UPDATE task progress or completion
-
WS->>DB: UPDATE analytics data (response time, task count, sentiment)
-
DB-->>WS: Return metrics for dashboard display
+
%% Logging, KB updates and analytics (always)
+
Agent->>Workspace: Log conversation and response metadata
+
AI->>Workspace: (optional) Suggest KB update based on conversation
+
Workspace->>KB: Update KB (optional manual review or auto-suggest)
+
Workspace-->>WorkspaceOwner: Update analytics / reports / conversation history
+
+
%% Ongoing conversation loop
+
Customer-->>Channel: Follow-up messages (loop continues)
+
Channel->>Agent: Forward follow-ups
+
Agent->>MCP: Repeat AI processing with updated context
-
Note over DB: PostgreSQL stores all entities (clients, workspaces, channels, AI configs, KB, tasks, analytics)
```
# Future Scope
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9