Browse Source

Merge branch 'milestone-20251031-简版功能开发' of http://39.101.133.168:8807/qimaohong/deepChartVueApp into milestone-20251031-简版功能开发

dongqian/feature-20251022181325-deepmate简版
宋杰 3 weeks ago
parent
commit
7359e08343
  1. 13
      api/deepMate/deepMate.js
  2. 4
      pages/deepExploration/deepExploration.vue
  3. 61
      pages/deepMate/deepMate.vue
  4. 4
      pages/home/member.vue

13
api/deepMate/deepMate.js

@ -54,6 +54,19 @@ export const postHistory = (data) => {
/** /**
* 删除历史记录
*/
export const postDeleteHistory = (data) => {
return http({
method: 'POST',
url: '/api/deepMate/deleteRecord',
data
})
}
/**
* 历史记录详情 * 历史记录详情
*/ */

4
pages/deepExploration/deepExploration.vue

@ -46,7 +46,7 @@
</view> </view>
<view class="stockSelection_content"> <view class="stockSelection_content">
<view class="selectionItem">
<view class="selectionItem" @click="viewAll">
<view class="header"> <view class="header">
<view class="left"> <view class="left">
<image src="/static/deepExploration-images/plus.png" mode="aspectFill"></image> <image src="/static/deepExploration-images/plus.png" mode="aspectFill"></image>
@ -75,7 +75,7 @@
</view> </view>
<view class="stockSelection_content"> <view class="stockSelection_content">
<view class="selectionItem">
<view class="selectionItem" @click="viewAll">
<view class="header"> <view class="header">
<view class="left"> <view class="left">
<image src="/static/deepExploration-images/plus.png" mode="aspectFill"></image> <image src="/static/deepExploration-images/plus.png" mode="aspectFill"></image>

61
pages/deepMate/deepMate.vue

@ -250,7 +250,8 @@
<view class="delete-all-container"> <view class="delete-all-container">
<image <image
class="delete-icon" class="delete-icon"
src="/static/icons/Group_48095481.svg" @click="clearAllHistory"
src="/static/icons/Group_48095481.svg"
@click="clearAllHistory"
></image> ></image>
<text class="delete-all" @click="clearAllHistory">删除全部</text> <text class="delete-all" @click="clearAllHistory">删除全部</text>
</view> </view>
@ -312,6 +313,7 @@ import {
postIntent, postIntent,
postHistory, postHistory,
postHistoryDetail, postHistoryDetail,
postDeleteHistory,
} from "../../api/deepMate/deepMate"; } from "../../api/deepMate/deepMate";
import { useUserStore } from "../../stores/modules/userInfo"; import { useUserStore } from "../../stores/modules/userInfo";
@ -597,22 +599,36 @@ const groupedHistory = computed(() => {
const clearAllHistory = () => { const clearAllHistory = () => {
uni.showModal({ uni.showModal({
title: '确认删除',
content: '确定要删除全部历史记录吗?该操作不可撤销。',
confirmText: '删除',
cancelText: '取消',
title: "确认删除",
content: "确定要删除全部历史记录吗?该操作不可撤销。",
confirmText: "删除",
cancelText: "取消",
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
// historyList searchHistory
historyList.value = [];
// 使
// uni.setStorageSync("search_history", []);
uni.showToast({ title: '历史已清空', icon: 'none' });
deleteHistory();
} }
}
})
},
});
}; };
//
async function deleteHistory(historyId) {
// historyList searchHistory
// 使
const res = await postDeleteHistory({
model: 5,
});
if (res.code === 200) {
historyList.value = [];
// uni.setStorageSync("search_history", []);
uni.showToast({ title: "历史已清空", icon: "none" });
}
else {
uni.showToast({ title: res.message, icon: "none" });
}
}
// //
const sendMessage = () => { const sendMessage = () => {
if (inputMessage.value.trim() === "" || isSending.value) return; if (inputMessage.value.trim() === "" || isSending.value) return;
@ -694,18 +710,18 @@ const simulateBotResponse = async (userMessage) => {
let ch = responseText.charAt(index); let ch = responseText.charAt(index);
let charsToAdd = ch; let charsToAdd = ch;
let newIndex = index + 1; let newIndex = index + 1;
// HTML // HTML
if (ch === '<') {
if (ch === "<") {
// //
let tagEndIndex = responseText.indexOf('>', index);
let tagEndIndex = responseText.indexOf(">", index);
if (tagEndIndex !== -1) { if (tagEndIndex !== -1) {
// //
charsToAdd = responseText.substring(index, tagEndIndex + 1); charsToAdd = responseText.substring(index, tagEndIndex + 1);
newIndex = tagEndIndex + 1; newIndex = tagEndIndex + 1;
} }
} }
const current = messages.value[botIndex]; const current = messages.value[botIndex];
// //
messages.value.splice(botIndex, 1, { messages.value.splice(botIndex, 1, {
@ -720,10 +736,10 @@ const simulateBotResponse = async (userMessage) => {
const baseDelay = 5; // const baseDelay = 5; //
const slowPunct = /[。!?!?;;]/; // const slowPunct = /[。!?!?;;]/; //
const midPunct = /[,、,::]/; // const midPunct = /[,、,::]/; //
// 使 // 使
let delay; let delay;
if (charsToAdd.startsWith('<')) {
if (charsToAdd.startsWith("<")) {
delay = 1; // delay = 1; //
} else { } else {
delay = slowPunct.test(ch) delay = slowPunct.test(ch)
@ -826,11 +842,11 @@ const simulateBotResponse = async (userMessage) => {
let charsToAdd = ch; let charsToAdd = ch;
let newIndex = index + 1; let newIndex = index + 1;
let delay = baseDelay; let delay = baseDelay;
// HTML // HTML
if (ch === '<') {
if (ch === "<") {
// //
let tagEndIndex = responseText.indexOf('>', index);
let tagEndIndex = responseText.indexOf(">", index);
if (tagEndIndex !== -1) { if (tagEndIndex !== -1) {
// //
charsToAdd = responseText.substring(index, tagEndIndex + 1); charsToAdd = responseText.substring(index, tagEndIndex + 1);
@ -838,7 +854,7 @@ const simulateBotResponse = async (userMessage) => {
delay = 1; // delay = 1; //
} }
} }
const current = messages.value[botIndex]; const current = messages.value[botIndex];
// //
messages.value.splice(botIndex, 1, { messages.value.splice(botIndex, 1, {
@ -1841,7 +1857,6 @@ async function itemClick(item) {
to { to {
transform: scaleY(1); transform: scaleY(1);
} }
} }
.thinking-item { .thinking-item {

4
pages/home/member.vue

@ -129,8 +129,8 @@ const goToAbout = () => {
} }
const goToShare = () => { const goToShare = () => {
console.log('用户信息==========',userInfoRes.value.data)
if (!userInfoRes.value.data) {
console.log('用户信息==========',userStore.userInfo.isVisitor)
if (userStore.userInfo.isVisitor) {
uni.showToast({ uni.showToast({
title: '请先登录', title: '请先登录',
icon: 'none' icon: 'none'

Loading…
Cancel
Save