123
This commit is contained in:
parent
2714be0bf7
commit
e7f95921d7
@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>title</title>
|
||||
<title>洛阳弘义智慧城市建设服务有限公司</title>
|
||||
<meta name="keywords" content="title" />
|
||||
<meta name="description" content="title" />
|
||||
<style>
|
||||
|
@ -97,6 +97,12 @@
|
||||
<div class="ds-markdown ds-markdown--block" style="--ds-md-zoom: 1.143;">
|
||||
<div v-html="item.content"></div>
|
||||
</div>
|
||||
<div v-if="item.emptyShow">
|
||||
<div class="a6d716f5 db5991dd">
|
||||
<div class="ds-icon acbf4957" style="font-size: 12px; width: 12px; height: 12px;"><svg t="1741138938671" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2618" width="200" height="200"><path d="M512 29.538462a482.461538 482.461538 0 1 0 482.461538 482.461538A482.461538 482.461538 0 0 0 512 29.538462z m55.138462 206.178461l-15.753847 354.461539h-78.76923l-15.753847-354.461539zM512 788.283077a68.923077 68.923077 0 1 1 68.923077-68.923077 68.923077 68.923077 0 0 1-68.923077 68.923077z" p-id="2619"></path></svg>
|
||||
</div>系统访问超时,请稍候重试...
|
||||
</div>
|
||||
</div>
|
||||
<div class="ds-flex" style="margin-top: 12px; height: 20px; align-items: center; gap: 12px;">
|
||||
<div class="ds-flex abe97156" style="align-items: center; gap: 12px;">
|
||||
<div class="ds-icon-button" tabindex="0"
|
||||
@ -159,7 +165,7 @@
|
||||
<div class="cefa5c26">
|
||||
<div class="dd442025 b699646e" @click="focusTextarea">
|
||||
<div class="fad49dec">
|
||||
<textarea v-model="message" id="chat-input" class="c92459f0" placeholder="给 DeepSeek 发送消息 "
|
||||
<textarea v-model="message" id="chat-input" class="c92459f0" placeholder="给 DeepSeek 发送消息 "
|
||||
rows="2" @keyup.enter.prevent="handleEnterPress" ref="textareaRef"
|
||||
maxlength="200"></textarea>
|
||||
<div class="b13855df">
|
||||
@ -275,19 +281,19 @@ const handleScroll = (event: WheelEvent) => {
|
||||
onMounted(() => {
|
||||
Nevkey.value = Date.now().toString();
|
||||
})
|
||||
//查询超时次数
|
||||
const emptyCount = ref(0);
|
||||
|
||||
//提问回答列表
|
||||
const getQuestionList = () => {
|
||||
|
||||
if (storp.value == true) {
|
||||
storp.value = false;
|
||||
chatHdEnd.value = true;
|
||||
return;
|
||||
}
|
||||
const index = paramMsg.value.length - 1;
|
||||
|
||||
if (paramMsg.value[index].role != 'assistant') {
|
||||
paramMsg.value.push({ role: 'assistant', sk: '', content: '', skLong: false, msgCode: 1 });
|
||||
paramMsg.value.push({ role: 'assistant', sk: '', content: '', skLong: false, msgCode: 1,emptyShow:false });
|
||||
}
|
||||
if (paramMsg.value[index].msgCode == 0) {
|
||||
storp.value = false;
|
||||
@ -296,6 +302,28 @@ const getQuestionList = () => {
|
||||
}
|
||||
getQuestion({ 'key': Nevkey.value, 'page': page.page, 'limit': page.limit }).then(res => {
|
||||
if (res.code == 1) {
|
||||
// 检查是否为空数组
|
||||
if (res.data.list.length === 0) {
|
||||
emptyCount.value++;
|
||||
|
||||
// 如果空数组计数达到30次,结束递归
|
||||
if (emptyCount.value >= 100) {
|
||||
const lIndex = paramMsg.value.length - 1;
|
||||
paramMsg.value[lIndex].content = marked(paramMsg.value[lIndex].content);
|
||||
paramMsg.value[lIndex].skLong = false;
|
||||
chatHdEnd.value = true;
|
||||
paramMsg.value[lIndex].emptyShow = true;
|
||||
// 重置计数器
|
||||
emptyCount.value = 0;
|
||||
return;
|
||||
}
|
||||
// 继续轮询
|
||||
getQuestionList();
|
||||
return;
|
||||
}
|
||||
// 如果收到非空数据,重置计数器
|
||||
emptyCount.value = 0;
|
||||
// ... 原有的数据处理逻辑 ...
|
||||
for (let i = 0; i < res.data.list.length; i++) {
|
||||
const item = res.data.list[i];
|
||||
if (!processedIds.value.has(item.id)) {
|
||||
@ -305,7 +333,6 @@ const getQuestionList = () => {
|
||||
paramMsg.value[lastIndex].skLong = true;
|
||||
paramMsg.value[lastIndex].sk += item.content;
|
||||
} else {
|
||||
//paramMsg.value[lastIndex].sk = '';
|
||||
paramMsg.value[lastIndex].skLong = false;
|
||||
paramMsg.value[lastIndex].content += item.content;
|
||||
}
|
||||
@ -317,8 +344,9 @@ const getQuestionList = () => {
|
||||
chatHdEnd.value = true;
|
||||
return;
|
||||
}
|
||||
scrollToBottom(); // 每次添加新消息后滚动
|
||||
scrollToBottom();
|
||||
}
|
||||
|
||||
if (res.data.list.length == page.limit) {
|
||||
page.page++;
|
||||
getQuestionList();
|
||||
@ -604,5 +632,6 @@ pre[class*=language-] {
|
||||
.support-units a {
|
||||
color: #1A9BFF;
|
||||
text-decoration: none;
|
||||
line-height: 25px;
|
||||
}
|
||||
</style>
|
@ -89,6 +89,7 @@ const startChat = () => {
|
||||
}
|
||||
|
||||
.company-title {
|
||||
line-height: 40px;
|
||||
font-size: 60px;
|
||||
color: #4D6BFE;
|
||||
text-align: center;
|
||||
|
Loading…
x
Reference in New Issue
Block a user