feat: 完成对话结束的标签

This commit is contained in:
2025-08-03 13:53:38 +08:00
parent fef285f98d
commit 73d3f164b9
4 changed files with 78 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
<template>
<view class="container">
<view class="chat-ai">
<ChatMarkdown v-if="text.length > 0" :text="text"></ChatMarkdown>
<ChatMarkdown :text="text"></ChatMarkdown>
<slot name="content"></slot>
</view>
<slot name="footer"></slot>

View File

@@ -33,7 +33,8 @@
<CreateServiceOrder v-else-if="item.toolCall.componentName === CompName.createWorkOrderCard"/>
</template>
<template #footer >
<!-- <text> 这个是底部 </text> -->
<!-- 这个是底部 -->
<AttachListComponent v-if="item.question" :question="item.question" @replySent="handleReply"/>
</template>
</ChatCardAI>
</template>
@@ -93,6 +94,7 @@
import DiscoveryCardComponent from '../module/discovery/DiscoveryCardComponent.vue';
import ActivityListComponent from '../module/banner/ActivityListComponent.vue';
import RecommendPostsComponent from '../module/recommend/RecommendPostsComponent.vue';
import AttachListComponent from '../module/attach/AttachListComponent.vue';
import CreateServiceOrder from '@/components/CreateServiceOrder/index.vue'
@@ -365,7 +367,6 @@
if (chunk && chunk.finish) {
// 结尾处理:确保剩余内容全部输出
const finishInterval = setInterval(() => {
console.log('aiMsgBuffer.length:', aiMsgBuffer.length)
if (aiMsgBuffer.length === 0) {
clearInterval(finishInterval);
clearInterval(loadingTimer);
@@ -382,12 +383,19 @@
chatMsgList.value[aiMsgIndex].msg = '';
}
}
// 如果有组件
if(chunk.toolCall) {
console.log('chunk.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;
scrollToBottom();
}

View File

@@ -4,7 +4,7 @@
<!-- :style="backgroundStyle" -->
<view class="top-item1-left">
<image :src="initPageImages.welcomeImageUrl"></image>
<text>{{ currentDate }} 多云 -36 cc </text>
<text>{{ currentDate }} 多云 -36 ff </text>
</view>
<view class="top-item1-right">
<image :src="initPageImages.logoImageUrl"></image>

View 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>