@@ -6,16 +6,14 @@ import { StringControl } from "comps/controls/codeControl";
66import { arrayObjectExposingStateControl , stringExposingStateControl } from "comps/controls/codeStateControl" ;
77import { JSONObject } from "util/jsonTypes" ;
88import { withDefault } from "comps/generators" ;
9- import { BoolControl } from "comps/controls/boolControl" ;
10- import { dropdownControl } from "comps/controls/dropdownControl" ;
119import QuerySelectControl from "comps/controls/querySelectControl" ;
1210import { eventHandlerControl , EventConfigType } from "comps/controls/eventHandlerControl" ;
1311import { AutoHeightControl } from "comps/controls/autoHeightControl" ;
1412import { ChatContainer } from "./components/ChatContainer" ;
1513import { ChatProvider } from "./components/context/ChatContext" ;
1614import { ChatPropertyView } from "./chatPropertyView" ;
1715import { createChatStorage } from "./utils/storageFactory" ;
18- import { QueryHandler , createMessageHandler } from "./handlers/messageHandlers" ;
16+ import { QueryHandler } from "./handlers/messageHandlers" ;
1917import { useMemo , useRef , useEffect } from "react" ;
2018import { changeChildAction } from "lowcoder-core" ;
2119import { ChatMessage } from "./types/chatTypes" ;
@@ -143,21 +141,13 @@ function generateUniqueTableName(): string {
143141 return `chat${ Math . floor ( 1000 + Math . random ( ) * 9000 ) } ` ;
144142 }
145143
146- const ModelTypeOptions = [
147- { label : trans ( "chat.handlerTypeQuery" ) , value : "query" } ,
148- { label : trans ( "chat.handlerTypeN8N" ) , value : "n8n" } ,
149- ] as const ;
150-
151144export const chatChildrenMap = {
152- // Storage
153- // Storage (add the hidden property here)
145+ // Storage (internal, hidden)
154146 _internalDbName : withDefault ( StringControl , "" ) ,
147+
155148 // Message Handler Configuration
156- handlerType : dropdownControl ( ModelTypeOptions , "query" ) ,
157- chatQuery : QuerySelectControl , // Only used for "query" type
158- modelHost : withDefault ( StringControl , "" ) , // Only used for "n8n" type
149+ chatQuery : QuerySelectControl ,
159150 systemPrompt : withDefault ( StringControl , trans ( "chat.defaultSystemPrompt" ) ) ,
160- streaming : BoolControl . DEFAULT_TRUE ,
161151
162152 // UI Configuration
163153 placeholder : withDefault ( StringControl , trans ( "chat.defaultPlaceholder" ) ) ,
@@ -220,36 +210,14 @@ const ChatTmpComp = new UICompBuilder(
220210 [ ]
221211 ) ;
222212
223- // Create message handler based on type
213+ // Create message handler (Query only)
224214 const messageHandler = useMemo ( ( ) => {
225- const handlerType = props . handlerType ;
226-
227- if ( handlerType === "query" ) {
228- return new QueryHandler ( {
229- chatQuery : props . chatQuery . value ,
230- dispatch,
231- streaming : props . streaming ,
232- } ) ;
233- } else if ( handlerType === "n8n" ) {
234- return createMessageHandler ( "n8n" , {
235- modelHost : props . modelHost ,
236- systemPrompt : props . systemPrompt ,
237- streaming : props . streaming
238- } ) ;
239- } else {
240- // Fallback to mock handler
241- return createMessageHandler ( "mock" , {
242- chatQuery : props . chatQuery . value ,
243- dispatch,
244- streaming : props . streaming
245- } ) ;
246- }
215+ return new QueryHandler ( {
216+ chatQuery : props . chatQuery . value ,
217+ dispatch,
218+ } ) ;
247219 } , [
248- props . handlerType ,
249220 props . chatQuery ,
250- props . modelHost ,
251- props . systemPrompt ,
252- props . streaming ,
253221 dispatch ,
254222 ] ) ;
255223
0 commit comments