Commit fcbb821
committed
Resolves #3574 (FR-896)
# Refactor Chat Components for Better State Management
- Refactored `AIAgentSelect` to use the `useAIAgent` hook directly instead of requiring agents to be passed as props
- Simplified `ChatCard` component by removing redundant state management and using controlled components
- Added `onUpdateChat` callback to `ChatCard` to propagate changes to parent components
- Improved `ChatHeader` component by making it more declarative with explicit callbacks
- Enhanced `Conversation` component to properly update chat state using the new callback pattern
-Fetch default endpoint selection in `ChatPage` to improve initial user experience
- Removed unnecessary state variables and transitions for better performance
- Fixed prop types and interfaces across components for better type safety
1 parent 51835df commit fcbb821
7 files changed
Lines changed: 227 additions & 251 deletions
File tree
- react/src
- components/Chat
- pages
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 8 | + | |
12 | 9 | | |
13 | 10 | | |
14 | 11 | | |
| |||
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
27 | | - | |
28 | | - | |
29 | 24 | | |
30 | 25 | | |
31 | 26 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 27 | + | |
38 | 28 | | |
39 | 29 | | |
40 | 30 | | |
41 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
42 | 35 | | |
43 | 36 | | |
44 | 37 | | |
| |||
0 commit comments