@@ -164,7 +164,7 @@ Component({
164164 this . setData ( {
165165 bot,
166166 questions,
167- chatRecords : [ ... chatRecords , record ] ,
167+ chatRecords : chatRecords . length > 0 ? chatRecords : [ record ] ,
168168 showWebSearchSwitch : allowWebSearch ,
169169 showUploadFile : allowUploadFile ,
170170 showUploadImg : allowUploadImage ,
@@ -266,9 +266,9 @@ Component({
266266 try {
267267 if ( this . data . bot . botId ) {
268268 const res = await this . fetchConversationList ( true , this . data . bot . botId ) ;
269- if ( res ) {
270- const { data } = res
271- console . log ( ' data default' , data . code )
269+ if ( res ) {
270+ const { data } = res ;
271+ console . log ( " data default" , data . code ) ;
272272 if ( data && ! data . code ) {
273273 console . log ( "data" , data ) ;
274274 this . setData ( {
@@ -370,6 +370,9 @@ Component({
370370 // title: data.title,
371371 // },
372372 // });
373+ this . setData ( {
374+ refreshText : "下拉加载历史记录" ,
375+ } ) ;
373376 } ,
374377 scrollConToBottom : async function ( e ) {
375378 console . log ( "scrollConToBottom" , e ) ;
@@ -387,8 +390,8 @@ Component({
387390 // 调用分页接口查询更多
388391 if ( this . data . bot . botId ) {
389392 const res = await this . fetchConversationList ( false , this . data . bot . botId ) ;
390- if ( res ) {
391- const { data } = res
393+ if ( res ) {
394+ const { data } = res ;
392395 if ( data && ! data . code ) {
393396 const addConversations = [ ...this . data . conversations , ...data . data ] ;
394397 // TODO: 临时倒序处理
@@ -788,8 +791,12 @@ Component({
788791 return transformItem ;
789792 } )
790793 . filter ( ( item ) => item ) ;
794+ // 只有一条则一定是系统开头语,需要置前,否则则为真实对话,靠后
791795 this . setData ( {
792- chatRecords : [ ...freshChatRecords , ...this . data . chatRecords ] ,
796+ chatRecords :
797+ this . data . chatRecords . length === 1
798+ ? [ ...this . data . chatRecords , ...freshChatRecords ]
799+ : [ ...freshChatRecords , ...this . data . chatRecords ] ,
793800 } ) ;
794801 // console.log("totalChatRecords", this.data.chatRecords);
795802 }
@@ -801,6 +808,9 @@ Component({
801808 }
802809 ) ;
803810 } ,
811+ handleTapClear : function ( e ) {
812+ this . clearChatRecords ( ) ;
813+ } ,
804814 clearChatRecords : function ( ) {
805815 console . log ( "执行清理" ) ;
806816 const chatMode = this . data . chatMode ;
0 commit comments