可信代码库-AI大模型猜你想问接口对接及功能优化
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
<!-- </McBubble>-->
|
||||
</template>
|
||||
<div v-if="followupQuestions.length>0" class="conversation-cnxw">
|
||||
<a class="flex conversation-cnxw-item">
|
||||
<a @click="handleResetQuestions" class="flex conversation-cnxw-item">
|
||||
<span class="span2">猜你想问</span>
|
||||
<img style="height: 15px;margin-right: 16px" width="16" src="@/assets/imgs/jyh/ai/icon_generate.png" />
|
||||
</a>
|
||||
@@ -251,6 +251,7 @@ const getAIAnswer = async (content) => {
|
||||
avatarPosition: 'side-left',
|
||||
avatarConfig: { ...aiModelAvatar },
|
||||
loading: true,
|
||||
question: content
|
||||
});
|
||||
|
||||
const response = await axios.post(`${VITE_AI_API_HOST}/api/v0/chat_use_sql`, {
|
||||
@@ -261,7 +262,7 @@ const getAIAnswer = async (content) => {
|
||||
|
||||
if(response.data.type) {
|
||||
const {text,type,id} = response.data;
|
||||
|
||||
messages.value[messages.value.length - 1].id = id;
|
||||
if(type==='text') {
|
||||
messages.value[messages.value.length - 1].content = text;
|
||||
messages.value[messages.value.length - 1].loading = false;
|
||||
@@ -365,6 +366,15 @@ const fetchFollowupQuestions = async (question,df_id,sql_id='') => {
|
||||
});
|
||||
};
|
||||
|
||||
// 刷新猜你想问
|
||||
const handleResetQuestions = () => {
|
||||
const lastItem = messages.value[messages.value.length - 1]
|
||||
if(lastItem.role = 'system') {
|
||||
debugger
|
||||
fetchFollowupQuestions(lastItem.question,lastItem.id); // 调用详情接口
|
||||
}
|
||||
};
|
||||
|
||||
const handleSelectConv = (convId: string) => {
|
||||
CONV_ID.value = convId; // 更新为选中的会话 ID
|
||||
getConversationDetail(convId); // 调用详情接口
|
||||
|
||||
Reference in New Issue
Block a user