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