feat: 完成对话结束的标签
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<view class="chat-ai">
|
<view class="chat-ai">
|
||||||
<ChatMarkdown v-if="text.length > 0" :text="text"></ChatMarkdown>
|
<ChatMarkdown :text="text"></ChatMarkdown>
|
||||||
<slot name="content"></slot>
|
<slot name="content"></slot>
|
||||||
</view>
|
</view>
|
||||||
<slot name="footer"></slot>
|
<slot name="footer"></slot>
|
||||||
|
|||||||
@@ -33,7 +33,8 @@
|
|||||||
<CreateServiceOrder v-else-if="item.toolCall.componentName === CompName.createWorkOrderCard"/>
|
<CreateServiceOrder v-else-if="item.toolCall.componentName === CompName.createWorkOrderCard"/>
|
||||||
</template>
|
</template>
|
||||||
<template #footer >
|
<template #footer >
|
||||||
<!-- <text> 这个是底部 </text> -->
|
<!-- 这个是底部 -->
|
||||||
|
<AttachListComponent v-if="item.question" :question="item.question" @replySent="handleReply"/>
|
||||||
</template>
|
</template>
|
||||||
</ChatCardAI>
|
</ChatCardAI>
|
||||||
</template>
|
</template>
|
||||||
@@ -93,6 +94,7 @@
|
|||||||
import DiscoveryCardComponent from '../module/discovery/DiscoveryCardComponent.vue';
|
import DiscoveryCardComponent from '../module/discovery/DiscoveryCardComponent.vue';
|
||||||
import ActivityListComponent from '../module/banner/ActivityListComponent.vue';
|
import ActivityListComponent from '../module/banner/ActivityListComponent.vue';
|
||||||
import RecommendPostsComponent from '../module/recommend/RecommendPostsComponent.vue';
|
import RecommendPostsComponent from '../module/recommend/RecommendPostsComponent.vue';
|
||||||
|
import AttachListComponent from '../module/attach/AttachListComponent.vue';
|
||||||
|
|
||||||
import CreateServiceOrder from '@/components/CreateServiceOrder/index.vue'
|
import CreateServiceOrder from '@/components/CreateServiceOrder/index.vue'
|
||||||
|
|
||||||
@@ -365,7 +367,6 @@
|
|||||||
if (chunk && chunk.finish) {
|
if (chunk && chunk.finish) {
|
||||||
// 结尾处理:确保剩余内容全部输出
|
// 结尾处理:确保剩余内容全部输出
|
||||||
const finishInterval = setInterval(() => {
|
const finishInterval = setInterval(() => {
|
||||||
console.log('aiMsgBuffer.length:', aiMsgBuffer.length)
|
|
||||||
if (aiMsgBuffer.length === 0) {
|
if (aiMsgBuffer.length === 0) {
|
||||||
clearInterval(finishInterval);
|
clearInterval(finishInterval);
|
||||||
clearInterval(loadingTimer);
|
clearInterval(loadingTimer);
|
||||||
@@ -382,12 +383,19 @@
|
|||||||
chatMsgList.value[aiMsgIndex].msg = '';
|
chatMsgList.value[aiMsgIndex].msg = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 如果有组件
|
||||||
if(chunk.toolCall) {
|
if(chunk.toolCall) {
|
||||||
console.log('chunk.toolCall:', chunk.toolCall)
|
console.log('chunk.toolCall:', chunk.toolCall)
|
||||||
chatMsgList.value[aiMsgIndex].toolCall = chunk.toolCall
|
chatMsgList.value[aiMsgIndex].toolCall = chunk.toolCall
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("============>", chunk.question)
|
||||||
|
|
||||||
|
// 如果有问题,则设置问题
|
||||||
|
if(chunk.question && chunk.question.length > 0) {
|
||||||
|
chatMsgList.value[aiMsgIndex].question = chunk.question
|
||||||
|
}
|
||||||
|
|
||||||
isSessionActive = false;
|
isSessionActive = false;
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<!-- :style="backgroundStyle" -->
|
<!-- :style="backgroundStyle" -->
|
||||||
<view class="top-item1-left">
|
<view class="top-item1-left">
|
||||||
<image :src="initPageImages.welcomeImageUrl"></image>
|
<image :src="initPageImages.welcomeImageUrl"></image>
|
||||||
<text>{{ currentDate }} 多云 -3~6℃ cc </text>
|
<text>{{ currentDate }} 多云 -3~6℃ ff </text>
|
||||||
</view>
|
</view>
|
||||||
<view class="top-item1-right">
|
<view class="top-item1-right">
|
||||||
<image :src="initPageImages.logoImageUrl"></image>
|
<image :src="initPageImages.logoImageUrl"></image>
|
||||||
|
|||||||
65
pages/module/attach/AttachListComponent.vue
Normal file
65
pages/module/attach/AttachListComponent.vue
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<template>
|
||||||
|
<view class="tag-list">
|
||||||
|
<view
|
||||||
|
v-for="(item, index) in tags"
|
||||||
|
:key="index"
|
||||||
|
class="tag-item"
|
||||||
|
@click="handleClick(item)"
|
||||||
|
>
|
||||||
|
<text class="tag-text">{{ item }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, nextTick, defineEmits } from 'vue'
|
||||||
|
import { onMounted } from 'vue'
|
||||||
|
import { SCROLL_TO_BOTTOM } from '@/constant/constant'
|
||||||
|
const props = defineProps({
|
||||||
|
question: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const tags = ref([])
|
||||||
|
const emits = defineEmits(['replySent']);
|
||||||
|
|
||||||
|
const handleClick = (item) => {
|
||||||
|
emits('replySent', item)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
tags.value = props.question.split('&').filter(tag => tag.trim() !== '')
|
||||||
|
nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.$emit(SCROLL_TO_BOTTOM, true)
|
||||||
|
}, 300)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.tag-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 6px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-item {
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 4px 10px;
|
||||||
|
margin-right: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-text {
|
||||||
|
color: #00A6FF; /* 蓝色文字,可根据设计调整 */
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user