Skip to content

Commit be6c69f

Browse files
committed
refactor: refactor quick question style
1 parent 955c9be commit be6c69f

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

frontend/src/views/chat/QuickQuestion.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@ import { Close } from '@element-plus/icons-vue'
55
import RecommendQuestion from '@/views/chat/RecommendQuestion.vue'
66
import { ChatInfo } from '@/api/chat.ts'
77
import RecentQuestion from '@/views/chat/RecentQuestion.vue'
8-
const visible = ref(false)
98
const activeName = ref('recommend')
109
const recommendQuestionRef = ref()
11-
10+
const popoverRef = ref()
1211
const getRecommendQuestions = () => {
1312
recommendQuestionRef.value.getRecommendQuestions()
1413
}
1514
const quickAsk = (question: string) => {
1615
emits('quickAsk', question)
17-
visible.value = false
16+
hiddenProps()
1817
}
1918
19+
const hiddenProps = () => {
20+
popoverRef.value.hide()
21+
}
2022
const onChatStop = () => {
2123
emits('stop')
2224
}
@@ -50,13 +52,14 @@ const props = withDefaults(
5052

5153
<template>
5254
<el-popover
55+
ref="popoverRef"
5356
:title="$t('qa.quick_question')"
54-
:visible="visible"
5557
popper-class="quick_question_popover"
5658
placement="top-start"
59+
trigger="click"
5760
:width="320"
5861
>
59-
<el-icon class="close_icon"><Close @click="visible = false" /></el-icon>
62+
<el-icon class="close_icon"><Close @click="hiddenProps" /></el-icon>
6063
<el-tabs v-model="activeName" class="quick_question_tab">
6164
<el-tab-pane :label="$t('qa.recommend')" name="recommend">
6265
<RecommendQuestion
@@ -73,12 +76,11 @@ const props = withDefaults(
7376
/>
7477
</el-tab-pane>
7578
<el-tab-pane v-if="datasourceId" :label="$t('qa.recently')" name="recently">
76-
<RecentQuestion v-if="visible" :datasource-id="datasourceId" @click-question="quickAsk">
77-
</RecentQuestion>
79+
<RecentQuestion :datasource-id="datasourceId" @click-question="quickAsk"> </RecentQuestion>
7880
</el-tab-pane>
7981
</el-tabs>
8082
<template #reference>
81-
<el-button plain size="small" @click="visible = true">
83+
<el-button plain size="small">
8284
<el-icon size="16" class="el-icon--left">
8385
<icon_quick_question />
8486
</el-icon>

frontend/src/views/chat/RecommendQuestion.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ defineExpose({ getRecommendQuestions, id: () => props.recordId, stop })
160160
<div v-else class="continue-ask">{{ t('qa.continue_to_ask') }}</div>
161161
</template>
162162
<div v-if="loading">
163+
<div v-if="position === 'input'" style="margin-bottom: 8px">{{ t('qa.guess_u_ask') }}</div>
163164
<el-button style="min-width: unset" type="primary" link loading />
164165
</div>
165166
<div v-else-if="position === 'input'" class="question-grid-input">

0 commit comments

Comments
 (0)