可信代码库-AI大模型猜你想问展示效果修改

This commit is contained in:
付民康
2025-07-09 11:29:48 +08:00
parent 40f2bf2563
commit 0bda268543

View File

@@ -245,6 +245,7 @@ const onInputIconClick = (e) => {
}; };
const onSubmit = async (e, answer = undefined) => { const onSubmit = async (e, answer = undefined) => {
debugger
let obj = { let obj = {
role: 'user', role: 'user',
avatarPosition: 'side-right', avatarPosition: 'side-right',
@@ -252,9 +253,11 @@ const onSubmit = async (e, answer = undefined) => {
if(e === '') { if(e === '') {
return; return;
} }
if (e?.sql) { if (e?.question) {
obj.content = e.question obj.content = e.question
if(e?.sql) {
obj.sql = e.sql obj.sql = e.sql
}
} else { } else {
obj.content = e obj.content = e
} }
@@ -354,9 +357,11 @@ const getAIAnswer = async (content) => {
loading: true, loading: true,
question: content question: content
} }
if (content.sql) { if (content?.question) {
obj.question = content.question obj.question = content.question
if(content?.sql) {
obj.sql = content.sql obj.sql = content.sql
}
} else { } else {
obj.question = content obj.question = content
} }
@@ -518,10 +523,14 @@ const fetchFollowupQuestions = async (question,df_id,sql_id='') => {
df_id: df_id || '', // 使用当前会话ID若无则为空 df_id: df_id || '', // 使用当前会话ID若无则为空
sql_id: sql_id || '' // 同上 sql_id: sql_id || '' // 同上
}; };
if (question?.sql) {
if (question?.question) {
params.question = question.question params.question = question.question
if(question?.sql) {
params.sql = question?.sql || '' params.sql = question?.sql || ''
} }
}
// const response = await axios.post( // const response = await axios.post(
// `${VITE_AI_API_HOST}/api/v0/provide_followup_questions`, // `${VITE_AI_API_HOST}/api/v0/provide_followup_questions`,
// params // params