7272 v-if =" currentChatId === undefined"
7373 size =" large"
7474 type =" primary"
75+ class =" greeting-btn"
7576 @click =" createNewChat"
7677 >
77- <el-icon >
78- <icon _new_chat_outlined />
79- </el-icon >
78+ <span class =" inner-icon" >
79+ <el-icon >
80+ <icon _new_chat_outlined />
81+ </el-icon >
82+ </span >
8083 {{ t('qa.start_sqlbot') }}
8184 </el-button >
8285 </div >
@@ -292,7 +295,7 @@ const createNewChat = async () => {
292295 if (isAssistant .value ) {
293296 const assistantChat = await assistantStore .setChat ()
294297 if (assistantChat ) {
295- onChatCreated (assistantChat as any )
298+ onChatCreatedQuick (assistantChat as any )
296299 }
297300 return
298301 }
@@ -317,6 +320,26 @@ function onClickHistory(chat: Chat) {
317320 scrollToBottom ()
318321}
319322
323+ function toAssistantHistory(chat : Chat ) {
324+ currentChat .value = new ChatInfo (chat )
325+ if (chat !== undefined && chat .id !== undefined && ! loading .value ) {
326+ currentChatId .value = chat .id
327+ loading .value = true
328+ chatApi
329+ .get (chat .id )
330+ .then ((res ) => {
331+ const info = chatApi .toChatInfo (res )
332+ if (info ) {
333+ currentChat .value = info
334+ onClickHistory (info )
335+ }
336+ })
337+ .finally (() => {
338+ loading .value = false
339+ })
340+ }
341+ }
342+
320343function onChatDeleted(id : number ) {
321344 console .log (' deleted' , id )
322345}
@@ -434,11 +457,6 @@ const sendMessage = async () => {
434457 loading .value = true
435458 isTyping .value = true
436459
437- /* const assistantChat = await assistantStore.setChat()
438- if (assistantChat) {
439- onChatCreated(assistantChat as any)
440- } */
441-
442460 const currentRecord = new ChatRecord ()
443461 currentRecord .create_time = new Date ()
444462 currentRecord .chat_id = currentChatId .value
@@ -833,10 +851,9 @@ const getCurrentChatId = () => {
833851}
834852defineExpose ({
835853 getHistoryList ,
836- onClickHistory ,
837- onChatDeleted ,
838- onChatRenamed ,
854+ toAssistantHistory ,
839855 getCurrentChatId ,
856+ createNewChat ,
840857})
841858 </script >
842859
@@ -879,7 +896,6 @@ defineExpose({
879896
880897 .chat-record-list {
881898 padding : 0 0 20px 0 ;
882- background : rgba (255 , 255 , 255 , 1 );
883899 border-radius : 0 12px 12px 0 ;
884900
885901 & .hide-sidebar {
@@ -974,6 +990,35 @@ defineExpose({
974990 font-size : 16px ;
975991 line-height : 24px ;
976992 }
993+
994+ .greeting-btn {
995+ width : 100% ;
996+ height : 88px ;
997+
998+ border-style : dashed ;
999+
1000+ .inner-icon {
1001+ display : flex ;
1002+ flex-direction : row ;
1003+ align-items : center ;
1004+
1005+ margin-right : 6px ;
1006+ }
1007+
1008+ font-size : 16px ;
1009+ line-height : 24px ;
1010+ font-weight : 500 ;
1011+
1012+ --ed-button-text-color : rgba (28 , 186 , 144 , 1 );
1013+ --ed-button-hover-text-color : rgba (28 , 186 , 144 , 1 );
1014+ --ed-button-active-text-color : rgba (28 , 186 , 144 , 1 );
1015+ --ed-button-bg-color : rgba (248 , 249 , 250 , 1 );
1016+ --ed-button-hover-bg-color : rgba (28 , 186 , 144 , 0.1 );
1017+ --ed-button-border-color : rgba (217 , 220 , 223 , 1 );
1018+ --ed-button-hover-border-color : rgba (28 , 186 , 144 , 1 );
1019+ --ed-button-active-bg-color : rgba (28 , 186 , 144 , 0.2 );
1020+ --ed-button-active-border-color : rgba (28 , 186 , 144 , 1 );
1021+ }
9771022 }
9781023}
9791024 </style >
0 commit comments