mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-09 01:36:57 +08:00
refactor: Recommended questions display ten by default.
This commit is contained in:
committed by
xuwei-fit2cloud
parent
a4e0a43ebe
commit
2b13dc7f93
@@ -328,8 +328,12 @@ export const chatApi = {
|
||||
predict: (record_id: number | undefined, controller?: AbortController) => {
|
||||
return request.fetchStream(`/chat/record/${record_id}/predict`, {}, controller)
|
||||
},
|
||||
recommendQuestions: (record_id: number | undefined, controller?: AbortController) => {
|
||||
return request.fetchStream(`/chat/recommend_questions/${record_id}`, {}, controller)
|
||||
recommendQuestions: (
|
||||
record_id: number | undefined,
|
||||
controller?: AbortController,
|
||||
params: any
|
||||
) => {
|
||||
return request.fetchStream(`/chat/recommend_questions/${record_id}${params}`, {}, controller)
|
||||
},
|
||||
recentQuestions: (datasource_id?: number): Promise<any> => {
|
||||
return request.get(`/chat/recent_questions/${datasource_id}`)
|
||||
|
||||
@@ -11,7 +11,7 @@ const recommendQuestionRef = ref()
|
||||
const recentQuestionRef = ref()
|
||||
const popoverRef = ref()
|
||||
const getRecommendQuestions = () => {
|
||||
recommendQuestionRef.value.getRecommendQuestions()
|
||||
recommendQuestionRef.value.getRecommendQuestions(10)
|
||||
}
|
||||
|
||||
const retrieveQuestions = () => {
|
||||
|
||||
@@ -58,12 +58,13 @@ function clickQuestion(question: string): void {
|
||||
|
||||
const stopFlag = ref(false)
|
||||
|
||||
async function getRecommendQuestions() {
|
||||
async function getRecommendQuestions(articles_number: number) {
|
||||
stopFlag.value = false
|
||||
loading.value = true
|
||||
try {
|
||||
const controller: AbortController = new AbortController()
|
||||
const response = await chatApi.recommendQuestions(props.recordId, controller)
|
||||
const params = articles_number ? '?articles_number=' + articles_number : ''
|
||||
const response = await chatApi.recommendQuestions(props.recordId, controller, params)
|
||||
const reader = response.body.getReader()
|
||||
const decoder = new TextDecoder('utf-8')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user