File tree Expand file tree Collapse file tree
apps/demos/Demos/DataGrid/AIAssistant/jQuery Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ $(() => {
2424 type : 'json_schema' ,
2525 json_schema : {
2626 name : 'grid_assistant_response' ,
27- strict : true ,
27+ strict : false ,
2828 schema : responseSchema ,
2929 } ,
3030 } ;
@@ -120,6 +120,9 @@ $(() => {
120120 onInitialized ( e ) {
121121 chatInstance = e . component ;
122122 } ,
123+ user : {
124+ id : 'user' ,
125+ } ,
123126 suggestions : {
124127 items : [
125128 {
@@ -151,19 +154,19 @@ $(() => {
151154 ] ,
152155 onItemClick ( e ) {
153156 const { prompt, text } = e . itemData ;
154-
155- if ( text === '💡 Help' ) {
156- const message = {
157- id : Date . now ( ) ,
158- timestamp : new Date ( ) ,
159- author : { id : 'user' } ,
160- text : prompt ,
161- } ;
162-
163- chatInstance . getDataSource ( ) . store ( ) . push ( [ { type : 'insert' , data : message } ] ) ;
164- } else {
165- chatInstance . option ( 'inputFieldText' , prompt ) ;
166- }
157+ const userId = text === '💡 Help' ? 'help' : 'user' ;
158+
159+ const message = {
160+ id : Date . now ( ) ,
161+ timestamp : new Date ( ) ,
162+ author : { id : userId } ,
163+ text : prompt ,
164+ } ;
165+
166+ chatInstance . getDataSource ( ) . store ( ) . push ( [ {
167+ type : 'insert' ,
168+ data : message ,
169+ } ] ) ;
167170 } ,
168171 } ,
169172 } ,
You can’t perform that action at this time.
0 commit comments