Skip to content

Commit a12a9b9

Browse files
committed
refactor ai chat & chat panel component
1 parent 11bb844 commit a12a9b9

6 files changed

Lines changed: 424 additions & 588 deletions

File tree

client/packages/lowcoder/src/comps/comps/chatComp/chatComp.tsx

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { dropdownControl } from "comps/controls/dropdownControl";
1111
import QuerySelectControl from "comps/controls/querySelectControl";
1212
import { eventHandlerControl, EventConfigType } from "comps/controls/eventHandlerControl";
1313
import { AutoHeightControl } from "comps/controls/autoHeightControl";
14-
import { ChatCore } from "./components/ChatCore";
14+
import { ChatContainer } from "./components/ChatContainer";
1515
import { ChatPropertyView } from "./chatPropertyView";
1616
import { createChatStorage } from "./utils/storageFactory";
1717
import { QueryHandler, createMessageHandler } from "./handlers/messageHandlers";
@@ -170,15 +170,17 @@ export const chatChildrenMap = {
170170
// Event Handlers
171171
onEvent: ChatEventHandlerControl,
172172

173-
// Style Controls
174-
style: styleControl(ChatStyle),
175-
sidebarStyle: styleControl(ChatSidebarStyle),
176-
messagesStyle: styleControl(ChatMessagesStyle),
177-
inputStyle: styleControl(ChatInputStyle),
173+
// Style Controls - Consolidated to reduce prop count
174+
style: styleControl(ChatStyle), // Main container
175+
sidebarStyle: styleControl(ChatSidebarStyle), // Sidebar (includes threads & new button)
176+
messagesStyle: styleControl(ChatMessagesStyle), // Messages area
177+
inputStyle: styleControl(ChatInputStyle), // Input + send button area
178+
animationStyle: styleControl(AnimationStyle), // Animations
179+
180+
// Legacy style props (kept for backward compatibility, consolidated internally)
178181
sendButtonStyle: styleControl(ChatSendButtonStyle),
179182
newThreadButtonStyle: styleControl(ChatNewThreadButtonStyle),
180183
threadItemStyle: styleControl(ChatThreadItemStyle),
181-
animationStyle: styleControl(AnimationStyle),
182184

183185
// Exposed Variables (not shown in Property View)
184186
currentMessage: stringExposingStateControl("currentMessage", ""),
@@ -287,8 +289,20 @@ const ChatTmpComp = new UICompBuilder(
287289
};
288290
}, []);
289291

292+
// Group all styles into single object for cleaner prop passing
293+
const styles = {
294+
style: props.style,
295+
sidebarStyle: props.sidebarStyle,
296+
messagesStyle: props.messagesStyle,
297+
inputStyle: props.inputStyle,
298+
sendButtonStyle: props.sendButtonStyle,
299+
newThreadButtonStyle: props.newThreadButtonStyle,
300+
threadItemStyle: props.threadItemStyle,
301+
animationStyle: props.animationStyle,
302+
};
303+
290304
return (
291-
<ChatCore
305+
<ChatContainer
292306
storage={storage}
293307
messageHandler={messageHandler}
294308
placeholder={props.placeholder}
@@ -297,14 +311,7 @@ const ChatTmpComp = new UICompBuilder(
297311
onMessageUpdate={handleMessageUpdate}
298312
onConversationUpdate={handleConversationUpdate}
299313
onEvent={props.onEvent}
300-
style={props.style}
301-
sidebarStyle={props.sidebarStyle}
302-
messagesStyle={props.messagesStyle}
303-
inputStyle={props.inputStyle}
304-
sendButtonStyle={props.sendButtonStyle}
305-
newThreadButtonStyle={props.newThreadButtonStyle}
306-
threadItemStyle={props.threadItemStyle}
307-
animationStyle={props.animationStyle}
314+
{...styles}
308315
/>
309316
);
310317
}

0 commit comments

Comments
 (0)