@@ -7,34 +7,35 @@ AI-powered task management interface built with **Next.js 16**, **React 19**, an
77### Core Functionality
88
99- 🤖 ** AI Chat Interface** - Natural language task management
10+ - 🎯 ** Custom AG-UI Integration** - SSE streaming with ` /api/agent/chat ` endpoint
1011- 💡 ** Smart Suggestions** - Clickable contextual suggestions from AI agent
11- - 📂 ** Conversation Management** - List, load, and delete conversations
12- - 🗂️ ** Sidebar Navigation** - Collapsible sidebar with conversation history
12+ - 📂 ** Chat Management** - List, load, and delete chats
13+ - 🗂️ ** Sidebar Navigation** - Collapsible sidebar with chat history
1314- 🏷️ ** Auto-generated Titles** - Titles extracted from first user message
1415- ⏳ ** Enhanced Loading States** - Contextual loading messages with animations
1516- 📱 ** Responsive Design** - Works on desktop, tablet, and mobile
1617- 🎨 ** Modern UI** - ChatGPT-inspired clean design with Tailwind CSS
1718- 📐 ** Adaptive Layout** - Centered welcome state, fixed input when chatting
1819- 🔄 ** Smart Scrolling** - Independent message scroll with fixed header and input
19- - 💾 ** localStorage Persistence** - Remembers current conversation across sessions
20+ - 💾 ** localStorage Persistence** - Remembers current chat across sessions
2021
2122### Recent Updates (November 2025)
2223
2324#### v2.1 - Content Safety UX Enhancements
2425
2526- ✅ ** Blocked Messages in Chat** - Content Safety violations appear as assistant messages (not toasts)
26- - ✅ ** Thread Continuity** - Blocked conversations create threads for seamless continuation
27+ - ✅ ** Thread Continuity** - Blocked chats create threads for seamless continuation
2728- ✅ ** Smart Title Updates** - Titles regenerate when first valid message sent after block
2829- ✅ ** Optimized Sidebar Refresh** - Only reloads when title changes (efficient flag-based approach)
29- - ✅ ** ChatGPT-like Behavior** - Natural conversation flow even with blocked messages
30+ - ✅ ** ChatGPT-like Behavior** - Natural chat flow even with blocked messages
3031
31- #### v2.0 - Conversation Management
32+ #### v2.0 - Chat Management
3233
33- - ✅ ** ConversationSidebar Component** - Full conversation history with search
34+ - ✅ ** ConversationSidebar Component** - Full chat history with search
3435- ✅ ** ConversationList Component** - Paginated list with auto-generated titles
35- - ✅ ** ConversationItem Component** - Individual conversation cards with metadata
36+ - ✅ ** ConversationItem Component** - Individual chat cards with metadata
3637- ✅ ** DeleteConfirmModal Component** - Confirmation dialog with smooth animations
37- - ✅ ** useConversations Hook** - Conversation state management
38+ - ✅ ** useConversations Hook** - Chat state management
3839- ✅ ** localStorage Integration** - Persists current thread ID
3940- ✅ ** API Integration** - List, load, and delete endpoints
4041
@@ -134,29 +135,78 @@ src/frontend/task-agent-web/
134135│ │ ├── SuggestionsBar.tsx # Clickable suggestion buttons
135136│ │ ├── ErrorToast.tsx # Error display
136137│ │ └── LoadingIndicator.tsx # Contextual loading states
137- │ ├── conversations/ # Conversation management
138+ │ ├── conversations/ # Chat management
138139│ │ ├── ConversationSidebar.tsx # Sidebar layout
139- │ │ ├── ConversationList.tsx # List of conversations
140- │ │ ├── ConversationItem.tsx # Individual conversation card
140+ │ │ ├── ConversationList.tsx # List of chats
141+ │ │ ├── ConversationItem.tsx # Individual chat card
141142│ │ └── DeleteConfirmModal.tsx # Delete confirmation
142143│ └── shared/ # Shared components
143144│ └── LoadingIndicator.tsx # Reusable loading component
144145├── hooks/ # Custom React hooks
145146│ ├── use-chat.ts # Chat state management
146- │ └── use-conversations.ts # Conversation management
147+ │ └── use-conversations.ts # Chat management
147148├── lib/ # Utilities
148149│ ├── utils.ts # Helper functions (cn utility)
149150│ ├── constants.ts # App constants
150151│ └── api/ # API client functions
151- │ └── chat-service.ts # Chat & conversation API
152+ │ └── chat-service.ts # Chat & API client
152153├── types/ # TypeScript definitions
153154│ ├── chat.ts # Chat types
154- │ └── conversation.ts # Conversation types
155+ │ └── conversation.ts # Thread/conversation types (technical)
155156├── public/ # Static assets
156157└── types/ # TypeScript definitions
157158 └── chat.ts # Chat types
158159```
159160
161+ ## 🏗️ Architecture
162+
163+ **Custom Implementation with AG-UI Foundation**:
164+
165+ ```
166+ Frontend (Next.js)
167+ ├── Custom UI Components
168+ │ ├── ChatInterface.tsx
169+ │ ├── ConversationSidebar.tsx
170+ │ ├── ChatMessagesList.tsx
171+ │ └── use-chat.ts hook
172+ │
173+ ↕️ SSE Streaming (Server-Sent Events)
174+ │ POST /api/agent/chat
175+ │ • serializedState → Backend
176+ │ • SSE events ← Backend
177+ │ • THREAD_STATE event (new serializedState)
178+ │
179+ Backend (.NET)
180+ ├── AgentController (Custom SSE endpoint)
181+ │ └── Wraps Microsoft Agent Framework
182+ │ • Deserializes thread from serializedState
183+ │ • Streams responses via RunStreamingAsync
184+ │ • Returns updated serializedState
185+ │
186+ └── PostgresChatMessageStore
187+ └── Automatic persistence in PostgreSQL
188+ ```
189+
190+ **Why Custom AG-UI Endpoint (not standard `/agui`)?**
191+ - ✅ **Full SSE control**: Custom event types (`CONTENT_START`, `CONTENT_DELTA`, `THREAD_STATE`)
192+ - ✅ **serializedState pattern**: Frontend receives updated state after each response
193+ - ✅ **Chat continuity**: Backend deserializes full thread from PostgreSQL
194+ - ✅ **No protocol limitations**: Can add custom events as needed
195+ - ✅ **Integrated chat sidebar**: 291 lines with auto-generated titles
196+ - ❌ Standard `/agui` doesn't return `serializedState` in streaming mode
197+
198+ **Why Custom UI (not CopilotKit)?**
199+ - ✅ **Chat-first application**: Not auxiliary chat over another app
200+ - ✅ **Full UX control**: ChatGPT-inspired adaptive layout
201+ - ✅ **Minimal dependencies**: No heavy UI framework
202+ - ❌ CopilotKit designed for auxiliary chat, not main application
203+
204+ **Microsoft Agent Framework Benefits**:
205+ - 🔄 Automatic message persistence via `ChatMessageStore`
206+ - 📡 SSE streaming with `RunStreamingAsync`
207+ - 🧵 Thread serialization/deserialization built-in
208+ - 📦 Function calling with `AIFunctionFactory`
209+
160210## 🎯 Key Technologies
161211
162212- **Next.js 16** - React framework with App Router
@@ -211,11 +261,11 @@ Main color palette:
211261- ` POST /api/Chat/send ` - Send message (non-streaming)
212262- ` POST /api/Chat/stream ` - Streaming support (paused for future releases)
213263
214- #### Conversation Management
264+ #### Chat Management
215265
216- - ` GET /api/Chat/threads ` - List conversations with pagination
217- - ` GET /api/Chat/threads/{threadId}/messages ` - Get conversation history
218- - ` DELETE /api/Chat/threads/{threadId} ` - Delete conversation
266+ - ` GET /api/Chat/threads ` - List chats with pagination
267+ - ` GET /api/Chat/threads/{threadId}/messages ` - Get chat history
268+ - ` DELETE /api/Chat/threads/{threadId} ` - Delete chat
219269
220270### Request/Response Formats
221271
@@ -248,7 +298,7 @@ POST /api/Chat/send
248298}
249299```
250300
251- #### List Conversations
301+ #### List Chats
252302
253303``` typescript
254304// Request
@@ -274,7 +324,7 @@ GET /api/Chat/threads?page=1&pageSize=20&sortBy=UpdatedAt&sortOrder=desc&isActiv
274324}
275325` ` `
276326
277- #### Get Conversation History
327+ #### Get Chat History
278328
279329` ` ` typescript
280330// Request
0 commit comments