11<script lang="ts" setup>
22import { onMounted , ref } from ' vue'
33import icon_quick_question from ' @/assets/svg/icon_quick_question.svg'
4- import icon_close from ' @/assets/svg/operate/ope-close.svg'
54import icon_replace_outlined from ' @/assets/svg/icon_replace_outlined.svg'
65import { ChatInfo } from ' @/api/chat.ts'
76import RecentQuestion from ' @/views/chat/RecentQuestion.vue'
@@ -38,6 +37,9 @@ const loadingOver = () => {
3837 emits (' loadingOver' )
3938}
4039
40+ const onTitleChange = (title : string ) => {
41+ activeName .value = title
42+ }
4143onMounted (() => {
4244 getRecommendQuestions ()
4345})
@@ -70,45 +72,54 @@ const props = withDefaults(
7072 popper-class =" quick_question_popover"
7173 placement =" top-start"
7274 trigger =" click"
73- :width =" 320 "
75+ :width =" 240 "
7476 >
75- <el-button class =" tool-btn close_icon" text @click =" hiddenProps" >
76- <el-icon size =" 18" >
77- <icon _close />
78- </el-icon >
79- </el-button >
8077 <el-tooltip effect =" dark" :offset =" 8" :content =" $t('qa.retrieve_again')" placement =" top" >
8178 <el-button class =" tool-btn refresh_icon" text :disabled =" disabled" @click =" retrieveQuestions" >
8279 <el-icon size =" 18" >
8380 <icon _replace_outlined />
8481 </el-icon >
8582 </el-button >
8683 </el-tooltip >
87- <el-tabs v-model =" activeName" class =" quick_question_tab" >
88- <el-tab-pane :label =" $t('qa.recommend')" name =" recommend" >
89- <RecommendQuestionQuick
90- ref =" recommendQuestionRef"
91- :current-chat =" currentChat"
92- :record-id =" recordId"
93- :questions =" questions"
94- :disabled =" disabled"
95- :first-chat =" firstChat"
96- position =" input"
97- @click-question =" quickAsk"
98- @stop =" onChatStop"
99- @loading-over =" loadingOver"
100- />
101- </el-tab-pane >
102- <el-tab-pane v-if =" datasourceId" :label =" $t('qa.recently')" name =" recently" >
103- <RecentQuestion
104- ref =" recentQuestionRef"
105- :disabled =" disabled"
106- :datasource-id =" datasourceId"
107- @click-question =" quickAsk"
108- >
109- </RecentQuestion >
110- </el-tab-pane >
111- </el-tabs >
84+ <div style =" display : flex " >
85+ <div
86+ class =" quick_question_title"
87+ :class =" { 'title-active': activeName == 'recommend' }"
88+ @click =" onTitleChange('recommend')"
89+ >
90+ {{ $t('qa.recommend') }}
91+ </div >
92+ <div
93+ class =" quick_question_title"
94+ :class =" { 'title-active': activeName == 'recently' }"
95+ @click =" onTitleChange('recently')"
96+ >
97+ {{ $t('qa.recently') }}
98+ </div >
99+ </div >
100+ <div class =" quick_question_content" >
101+ <RecommendQuestionQuick
102+ v-show =" activeName === 'recommend'"
103+ ref =" recommendQuestionRef"
104+ :current-chat =" currentChat"
105+ :record-id =" recordId"
106+ :questions =" questions"
107+ :disabled =" disabled"
108+ :first-chat =" firstChat"
109+ position =" input"
110+ @click-question =" quickAsk"
111+ @stop =" onChatStop"
112+ @loading-over =" loadingOver"
113+ />
114+ <RecentQuestion
115+ v-show =" activeName == 'recently'"
116+ ref =" recentQuestionRef"
117+ :disabled =" disabled"
118+ :datasource-id =" datasourceId"
119+ @click-question =" quickAsk"
120+ >
121+ </RecentQuestion >
122+ </div >
112123 <template #reference >
113124 <el-button plain size =" small" >
114125 <el-icon size =" 16" class =" el-icon--left" >
@@ -122,21 +133,43 @@ const props = withDefaults(
122133
123134<style lang="less">
124135.quick_question_popover {
125- .quick_question_tab {
126- height : 230px ;
127- }
128- .ed-tab-pane {
136+ padding : 4px !important ;
137+ .quick_question_title {
138+ width : 40px ;
139+ height : 24px ;
140+ border-radius : 6px ;
141+ opacity : 1 ;
142+ padding : 2px 8px ;
143+ font-size : 12px ;
129144 display : flex ;
130- align-items : normal ;
131- width : 100% ;
145+ align-items : center ;
146+ justify-content : center ;
147+ background : rgba (31 , 35 , 41 , 0.1 );
148+ cursor : pointer ;
149+ margin-left : 8px ;
150+ & :hover {
151+ color : rgba (24 , 158 , 122 , 0.5 );
152+ background : rgba (28 , 186 , 144 , 0.1 );
153+ }
132154 }
133- .ed-tabs__content {
134- overflow : auto ;
155+ .title-active {
156+ color : rgba (24 , 158 , 122 , 1 );
157+ background : rgba (28 , 186 , 144 , 0.2 );
158+ }
159+ .quick_question_content {
160+ height : 168px ;
161+ margin-top : 4px ;
162+ padding : 4px 4px 4px 4px ;
163+ overflow-y : auto ;
135164 }
136165 .ed-popover__title {
137166 font-size : 14px ;
138167 font-weight : 500 ;
139168 margin-bottom : 0 ;
169+ height : 32px ;
170+ display : flex ;
171+ align-items : center ;
172+ padding : 0 8px ;
140173 }
141174 .close_icon {
142175 position : absolute ;
0 commit comments