You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1647 lines
39 KiB

4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
  1. <template>
  2. <view class="deepMate-page">
  3. <!-- 顶部导航栏 -->
  4. <view class="header" :style="{ paddingTop: safeAreaInsets?.top + 'px' }">
  5. <view class="header-left">
  6. <image
  7. src="https://d31zlh4on95l9h.cloudfront.net/images/f91e09b5987802185e7679055dafd272.svg"
  8. class="icon"
  9. >
  10. </image>
  11. </view>
  12. <view class="header-center">
  13. <text class="title" :style="{ paddingTop: safeAreaInsets?.top + 'px' }"
  14. >DeepMate</text
  15. >
  16. </view>
  17. <view class="header-right">
  18. <image
  19. src="https://d31zlh4on95l9h.cloudfront.net/images/d7c4e74201213a25dd9574e908233928.svg"
  20. class="icon"
  21. >
  22. </image>
  23. <image
  24. style="margin-left: 10px"
  25. src="https://d31zlh4on95l9h.cloudfront.net/images/099903c4aabf5713488b5cb60815e3f7.svg"
  26. class="icon"
  27. @click="openHistoryDrawer"
  28. ></image>
  29. <!-- 新增新会话按钮
  30. <button class="new-chat-button" @click="newChat">
  31. <text class="new-chat-text">新会话</text>
  32. </button> -->
  33. </view>
  34. </view>
  35. <!-- 主要内容区域 -->
  36. <view class="main-content">
  37. <view class="banner-panel" v-if="messages.length === 0">
  38. <image
  39. src="https://d31zlh4on95l9h.cloudfront.net/images/42e18bd7fe97d4f4f37aa70439a0990b.svg"
  40. class="pray-banner"
  41. ></image>
  42. <view class="contain">
  43. <!-- 机器人头像和欢迎语 -->
  44. <view class="robot-container" v-if="messages.length === 0">
  45. <image src="/static/icons/机器人.svg" class="robot-avatar"></image>
  46. <view class="welcome-message">
  47. <text class="greeting">Hi, 我是您的股市随身顾问~</text>
  48. <text class="description"
  49. >个股诊断市场情绪解读都可以找我</text
  50. >
  51. </view>
  52. </view>
  53. <!-- 功能标签栏 -->
  54. <!-- <view class="function-tabs" v-if="messages.length === 0">
  55. <view ref="tabsTrack" class="tabs-track" :style="{ transform: 'translate3d(-' + marqueeOffset + 'px,0,0)' }">
  56. <view class="tab-item" v-for="(tab, idx) in marqueeList" :key="idx">{{ tab }}</view>
  57. </view>
  58. </view> -->
  59. <!-- 特斯拉推荐卡片 -->
  60. <view
  61. class="recommend-card"
  62. v-if="messages.length === 0"
  63. @click="goBlank"
  64. >
  65. <view class="arrow" v-if="messages.length === 0"></view>
  66. <view class="card-content">
  67. <image
  68. src="../../static/images/tesla-logo.png"
  69. class="logo"
  70. ></image>
  71. <view class="card-text">
  72. <text class="main-question">当前特斯拉该如何布局</text>
  73. <text class="stock-code">TSLA</text>
  74. </view>
  75. <image
  76. src="https://d31zlh4on95l9h.cloudfront.net/images/40d94054644f6e3f1c366751f07f0010.svg"
  77. class="arrow-icon"
  78. @click="goBlank"
  79. ></image>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <!-- 可能感兴趣的话题 -->
  85. <!-- <view v-if="messages.length === 0" class="interest-section">
  86. <text class="section-title">- 您可能感兴趣 -</text>
  87. <view class="topics-list">
  88. <view class="topic-item" v-for="topic in hotTopics" :key="topic.id">
  89. <image :src="topic.icon" class="tag-icon"></image>
  90. <text class="topic-text" @click="sendMessageList(topic.text)">{{
  91. topic.text
  92. }}</text>
  93. </view>
  94. </view>
  95. </view> -->
  96. <view v-if="messages.length === 0" class="welcome-section"> </view>
  97. <!-- 聊天区域 -->
  98. <!-- 顶部粘性欢迎块始终保留在聊天上方 -->
  99. <view class="chat-header" v-if="messages.length > 0">
  100. <view class="robot-container">
  101. <image src="/static/icons/机器人.svg" class="robot-avatar"></image>
  102. <view class="welcome-message">
  103. <text class="greeting">Hi, 我是您的股市随身顾问~</text>
  104. </view>
  105. </view>
  106. </view>
  107. <scroll-view
  108. class="chat-container"
  109. scroll-y="true"
  110. :scroll-top="chatScrollTop"
  111. :scroll-with-animation="!isSending"
  112. @scroll="onChatScroll"
  113. v-if="messages.length > 0"
  114. >
  115. <view class="message-list" id="messageList">
  116. <view
  117. v-for="(message, index) in messages"
  118. :key="index"
  119. :class="
  120. message.isUser ? 'message user-message' : 'message bot-message'
  121. "
  122. >
  123. <!-- 会话图标 -->
  124. <text
  125. :class="
  126. message.isUser
  127. ? 'fa-solid fa-user message-icon'
  128. : 'fa-solid fa-robot message-icon'
  129. "
  130. ></text>
  131. <!-- 会话内容 -->
  132. <view class="message-content">
  133. <!-- <text class="message-text">{{ message.content }}</text> -->
  134. <!-- loading -->
  135. <view
  136. class="loading-dots"
  137. v-if="message.isThinking || !message.isUser"
  138. >
  139. <view class="thinking-process">
  140. <view class="thinking-header">
  141. <view class="thinking-icon"></view>
  142. <view class="thinking-title">{{
  143. message.isTyping ? "正在思考" : "思考完成"
  144. }}</view>
  145. <view class="thinking-count"> </view>
  146. <view
  147. class="thinking-toggle"
  148. @click="message.isThinking = !message.isThinking"
  149. >
  150. <span v-if="message.isThinking"></span>
  151. <span v-else></span>
  152. </view>
  153. </view>
  154. <view v-show="message.isThinking" class="thinking-content">
  155. <view class="thinking-item">
  156. <view class="item-status">
  157. <span class="checkmark"></span>
  158. </view>
  159. <view class="item-text">问题分析完成</view>
  160. </view>
  161. <view class="thinking-item">
  162. <view class="item-status">
  163. <span class="checkmark"></span>
  164. </view>
  165. <view class="item-text">收集相关信息</view>
  166. </view>
  167. </view>
  168. </view>
  169. </view>
  170. <!-- 使用 rich-text 渲染 Markdown 内容 -->
  171. <rich-text
  172. v-if="!message.isUser"
  173. class="message-text"
  174. :nodes="renderMarkdown(message.content)"
  175. ></rich-text>
  176. <text v-else class="message-text">{{ message.content }}</text>
  177. </view>
  178. </view>
  179. </view>
  180. </scroll-view>
  181. </view>
  182. <!-- 输入框区域 -->
  183. <view class="input-area">
  184. <view class="input-wrapper">
  185. <input
  186. type="text"
  187. placeholder="请输入股票代码/名称,获取AI洞察"
  188. placeholder-style="color:#fff;opacity:1"
  189. class="input-field"
  190. v-model="inputMessage"
  191. @confirm="sendMessage"
  192. />
  193. <image class="send-button" @click="sendMessage" :disabled="isSending">
  194. <!-- <image
  195. src="https://d31zlh4on95l9h.cloudfront.net/images/95f1ea2262e9157db13c93c0dc1c5d96.svg"
  196. class="send-icon"
  197. ></image> -->
  198. </image>
  199. </view>
  200. <text class="disclaimer"
  201. >以上数据由AI生成不作为最终投资建议决策需独立</text
  202. >
  203. </view>
  204. <image
  205. class="back-to-top"
  206. src="https://d31zlh4on95l9h.cloudfront.net/images/ba357635d2bb480241952bb1cabacd73.svg"
  207. :style="{
  208. transform: 'translate3d(' + backTopX + 'px,' + backTopY + 'px,0)',
  209. }"
  210. @touchstart="onBackTopTouchStart"
  211. @touchmove="onBackTopTouchMove"
  212. @touchend="onBackTopTouchEnd"
  213. @click="onBackTopClick"
  214. ></image>
  215. <!-- 搜索历史侧拉框 -->
  216. <view class="drawer-overlay" v-show="showHistoryDrawer"></view>
  217. <!-- <view class="drawer-panel" v-show="showHistoryDrawer" @click.stop @touchmove.stop.prevent
  218. :style="{ transform: 'translateY(' + drawerOffsetY + 'px)' }">
  219. <view class="drawer-header">
  220. <text class="drawer-title">历史对话</text>
  221. <view class="drawer-actions">
  222. <view class="delete-all-container">
  223. <image class="delete-icon" src="/static/icons/Group_48095481.svg"></image>
  224. <text class="delete-all" @click="clearAllHistory">删除全部</text>
  225. </view>
  226. <view class="drawer-close" @click="onDrawerBackClick"><text class="drawer-close-icon"></text></view>
  227. </view>
  228. </view>
  229. <scroll-view scroll-y="true" class="drawer-content">
  230. <view class="drawer-inner">
  231. <view v-if="groupedHistory.length === 0" class="empty-history">
  232. <text>暂无历史记录</text>
  233. </view>
  234. <view v-for="(section, sIdx) in groupedHistory" :key="sIdx" class="history-section">
  235. <text class="section-title">{{ section.title }}</text>
  236. <view v-for="(item, idx) in section.items" :key="idx" class="history-item">
  237. <view class="history-left">
  238. <view class="flag-circle"><text class="flag-emoji">🇺🇸</text></view>
  239. </view>
  240. <view class="history-main">
  241. <text class="history-query">{{ item.query }}</text>
  242. </view>
  243. <text class="history-time">{{ formatTime(item.time) }}</text>
  244. </view>
  245. </view>
  246. </view>
  247. </scroll-view>
  248. </view> -->
  249. <view
  250. class="drawer-panel"
  251. v-show="showHistoryDrawer"
  252. @click.stop
  253. @touchmove.stop.prevent
  254. :style="{ transform: 'translateY(' + drawerOffsetY + 'px)' }"
  255. >
  256. <view class="drawer-header">
  257. <text class="drawer-title">历史对话</text>
  258. <view class="drawer-actions">
  259. <view class="delete-all-container">
  260. <image
  261. class="delete-icon"
  262. src="/static/icons/Group_48095481.svg"
  263. ></image>
  264. <text class="delete-all" @click="clearAllHistory">删除全部</text>
  265. </view>
  266. <view class="drawer-close" @click="onDrawerBackClick"
  267. ><text class="drawer-close-icon"></text
  268. ></view>
  269. </view>
  270. </view>
  271. <scroll-view scroll-y="true" class="drawer-content">
  272. <view class="drawer-inner">
  273. <view v-if="historyList.length === 0" class="empty-history">
  274. <text>暂无历史记录</text>
  275. </view>
  276. <view
  277. v-for="(section, sIdx) in historyList"
  278. :key="sIdx"
  279. class="history-section"
  280. >
  281. <text class="section-title">{{ section.title }}</text>
  282. <view
  283. v-for="(item, idx) in section.items"
  284. :key="idx"
  285. class="history-item"
  286. >
  287. <view class="history-left">
  288. <view class="flag-circle"
  289. ><text class="flag-emoji">🇺🇸</text></view
  290. >
  291. </view>
  292. <view class="history-main" @click="itemClick(item)">
  293. <text class="history-query">{{ item.stockName }}</text>
  294. <text class="history-query">{{ item.stockCode }}</text>
  295. </view>
  296. <text class="history-time">{{ item.createdTime }}</text>
  297. </view>
  298. </view>
  299. </view>
  300. </scroll-view>
  301. </view>
  302. <footerBar class="static-footer" :type="type"></footerBar>
  303. </view>
  304. </template>
  305. <script setup>
  306. const { safeAreaInsets } = uni.getSystemInfoSync();
  307. import { ref, computed, onMounted, onUnmounted, watch, nextTick } from "vue";
  308. import footerBar from "../../components/footerBar";
  309. import marked from "marked"; // 引入 marked 库
  310. import { onPageScroll } from "@dcloudio/uni-app";
  311. import {
  312. postStock,
  313. postIntent,
  314. postHistory,
  315. postHistoryDetail,
  316. } from "../../api/deepMate/deepMate";
  317. // 设置 marked 选项
  318. marked.setOptions({
  319. renderer: new marked.Renderer(),
  320. highlight: null, // 如果需要代码高亮,可以设置适当的函数
  321. langPrefix: "language-",
  322. pedantic: false,
  323. gfm: true,
  324. breaks: false,
  325. sanitize: false,
  326. smartLists: true,
  327. smartypants: false,
  328. xhtml: false,
  329. });
  330. // 创建一个用于渲染 Markdown 的函数
  331. const renderMarkdown = (content) => {
  332. if (!content) return "";
  333. return marked.parse(content);
  334. };
  335. const type = ref("member");
  336. const inputMessage = ref("");
  337. const showThinking = ref(true);
  338. const isSending = ref(false);
  339. const chatScrollTop = ref(0);
  340. const chatContainerHeight = ref(0);
  341. const uuid = ref("");
  342. const messages = ref([]);
  343. const showHistoryDrawer = ref(false);
  344. const drawerOffsetY = ref(0);
  345. const searchHistory = ref([]);
  346. const historyList = ref([]);
  347. const hotTopics = ref([
  348. {
  349. id: 1,
  350. text: "英伟达(NVDA)股票情绪温度?",
  351. icon: "https://d31zlh4on95l9h.cloudfront.net/images/7ed58be0f4b81aeb398d9ba2534a624b.svg",
  352. },
  353. {
  354. id: 2,
  355. text: "博通(AVGO)明天还能涨吗?",
  356. icon: "https://d31zlh4on95l9h.cloudfront.net/images/7ed58be0f4b81aeb398d9ba2534a624b.svg",
  357. },
  358. {
  359. id: 3,
  360. text: "为什么Fluence Energy(FLNC)会暴涨?",
  361. icon: "https://d31zlh4on95l9h.cloudfront.net/images/7ed58be0f4b81aeb398d9ba2534a624b.svg",
  362. },
  363. {
  364. id: 4,
  365. text: "为什么Fluence Energy(FLNC)会暴涨?",
  366. icon: "https://d31zlh4on95l9h.cloudfront.net/images/7ed58be0f4b81aeb398d9ba2534a624b.svg",
  367. },
  368. ]);
  369. // 初始化
  370. onMounted(() => {
  371. const sys = uni.getSystemInfoSync();
  372. const iconSize = uni.upx2px(100); // 和样式保持一致
  373. const reserveBottom = uni.upx2px(260); // 预留底部输入区域空间
  374. const initX = Math.max(0, sys.windowWidth - iconSize - uni.upx2px(30));
  375. const initY = Math.max(0, Math.floor(sys.windowHeight * 0.65) - iconSize);
  376. backTopTargetX.value = initX;
  377. backTopTargetY.value = initY;
  378. backTopX.value = initX;
  379. backTopY.value = initY;
  380. initUUID();
  381. if (messages.value.length === 0) {
  382. // nextTick(startTabsMarquee);
  383. }
  384. if (messages.value.length > 0) {
  385. nextTick(() => {
  386. measureChatContainer();
  387. scrollToBottom();
  388. });
  389. }
  390. // 载入历史
  391. const hist = uni.getStorageSync("search_history") || [];
  392. searchHistory.value = Array.isArray(hist) ? hist : [];
  393. // 缓存今天日期(YYYY-MM-DD)
  394. const todayStr = new Date().toISOString().slice(0, 10);
  395. uni.setStorageSync("today_date", todayStr);
  396. });
  397. // 初始化 UUID
  398. const initUUID = () => {
  399. let storedUUID = uni.getStorageSync("user_uuid");
  400. if (!storedUUID) {
  401. storedUUID = generateUUID();
  402. uni.setStorageSync("user_uuid", storedUUID);
  403. }
  404. uuid.value = storedUUID;
  405. };
  406. // 生成简单UUID
  407. const generateUUID = () => {
  408. return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
  409. var r = (Math.random() * 16) | 0,
  410. v = c == "x" ? r : (r & 0x3) | 0x8;
  411. return v.toString(16);
  412. });
  413. };
  414. // 计算聊天容器可视高度
  415. const measureChatContainer = () => {
  416. const q = uni.createSelectorQuery();
  417. q.select(".chat-container").boundingClientRect();
  418. q.exec((res) => {
  419. chatContainerHeight.value = res[0]?.height || 0;
  420. });
  421. };
  422. // 新会话
  423. const newChat = () => {
  424. messages.value = [];
  425. uni.removeStorageSync("user_uuid");
  426. initUUID();
  427. };
  428. // 跳转到空白页
  429. const goBlank = () => {
  430. uni.navigateTo({
  431. url: "/pages/blank/blank",
  432. });
  433. };
  434. // 历史抽屉控制
  435. const openHistoryDrawer = () => {
  436. const res = postHistory({
  437. model: 5,
  438. });
  439. if (res.code === 200) {
  440. historyList.value = res.data;
  441. }
  442. console.log("historyList.value", historyList.value);
  443. const hideDistance = uni.upx2px(900);
  444. drawerOffsetY.value = hideDistance;
  445. showHistoryDrawer.value = true;
  446. setTimeout(() => {
  447. drawerOffsetY.value = 0;
  448. }, 10);
  449. };
  450. const closeHistoryDrawer = () => {
  451. showHistoryDrawer.value = false;
  452. };
  453. const onDrawerBackClick = () => {
  454. const hideDistance = uni.upx2px(900);
  455. drawerOffsetY.value = hideDistance;
  456. setTimeout(() => {
  457. closeHistoryDrawer();
  458. drawerOffsetY.value = 0;
  459. }, 180);
  460. };
  461. // 时间格式化:YYYY-MM-DD HH:mm
  462. const pad2 = (n) => (n < 10 ? "0" + n : "" + n);
  463. const formatTime = (t) => {
  464. const d = new Date(t);
  465. const y = d.getFullYear();
  466. const m = pad2(d.getMonth() + 1);
  467. const day = pad2(d.getDate());
  468. const hh = pad2(d.getHours());
  469. const mm = pad2(d.getMinutes());
  470. return `${y}-${m}-${day} ${hh}:${mm}`;
  471. };
  472. // // 历史分组(今天/昨天/近一周/按月)
  473. // const groupedHistory = computed(() => {
  474. // const sections = [];
  475. // // 从缓存获取今天日期,如果没有则使用当前日期
  476. // const cachedTodayStr = uni.getStorageSync('today_date');
  477. // const now = cachedTodayStr ? new Date(cachedTodayStr + 'T00:00:00') : new Date();
  478. // const startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
  479. // const isSameDay = (a, b) => startOfDay(a).getTime() === startOfDay(b).getTime();
  480. // const isYesterday = (d) => {
  481. // const y = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1);
  482. // return isSameDay(d, y);
  483. // };
  484. // const isToday = (d) => isSameDay(d, now);
  485. // const withinLast7Days = (d) => {
  486. // const seven = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 7);
  487. // return d >= seven && !isToday(d) && !isYesterday(d);
  488. // };
  489. // const monthLabel = (d) => `${d.getMonth() + 1}月`;
  490. // const today = [];
  491. // const yesterday = [];
  492. // const last7 = [];
  493. // const byMonth = new Map();
  494. // searchHistory.value.forEach((item) => {
  495. // const dt = new Date(item.time);
  496. // if (isToday(dt)) {
  497. // today.push(item);
  498. // } else if (isYesterday(dt)) {
  499. // yesterday.push(item);
  500. // } else if (withinLast7Days(dt)) {
  501. // last7.push(item);
  502. // } else {
  503. // const year = dt.getFullYear();
  504. // const month = dt.getMonth() + 1;
  505. // const key = `${year}-${month}`;
  506. // if (!byMonth.has(key)) byMonth.set(key, { title: `${month}月`, year, month, items: [] });
  507. // byMonth.get(key).items.push(item);
  508. // }
  509. // });
  510. // if (today.length) sections.push({ title: '今天', items: today });
  511. // if (yesterday.length) sections.push({ title: '昨天', items: yesterday });
  512. // if (last7.length) sections.push({ title: '近一周', items: last7 });
  513. // const monthSections = Array.from(byMonth.values()).sort((a, b) => {
  514. // if (a.year !== b.year) return b.year - a.year;
  515. // return b.month - a.month; // 月份倒序,如 10月 在 9月 之前
  516. // });
  517. // sections.push(...monthSections);
  518. // return sections;
  519. // });
  520. const clearAllHistory = () => {
  521. searchHistory.value = [];
  522. uni.setStorageSync("search_history", []);
  523. };
  524. // 发送消息
  525. const sendMessage = () => {
  526. if (inputMessage.value.trim() === "" || isSending.value) return;
  527. const userMessage = {
  528. content: inputMessage.value,
  529. isUser: true,
  530. isThinking: false,
  531. isTyping: false,
  532. };
  533. messages.value.push(userMessage);
  534. inputMessage.value = "";
  535. // 记录搜索历史
  536. const entry = { query: userMessage.content, time: Date.now() };
  537. searchHistory.value.unshift(entry);
  538. uni.setStorageSync("search_history", searchHistory.value);
  539. // 发送后强制恢复并滚到底部
  540. shouldAutoScroll.value = true;
  541. nextTick(() => {
  542. scrollToBottom();
  543. });
  544. // 模拟机器人回复
  545. simulateBotResponse(userMessage.content);
  546. };
  547. // 模拟机器人回复
  548. const simulateBotResponse = async (userMessage) => {
  549. // 添加机器人加载消息
  550. const botMsg = {
  551. content: "",
  552. isUser: false,
  553. isTyping: true,
  554. isThinking: true,
  555. };
  556. messages.value.push(botMsg);
  557. isSending.value = true;
  558. // 首先进行意图识别
  559. const res = await postIntent({
  560. content: userMessage,
  561. language: 'cn',
  562. marketList: 'hk,cn,usa,my,sg,vi,in,gb',
  563. token: "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q",
  564. });
  565. console.log("res" + res);
  566. // 意图识别不通过
  567. if (res.code !== 200) {
  568. return;
  569. }
  570. // 获取意图识别结果
  571. const recordId = res.data.recordId;
  572. const parentId = res.data.parentId;
  573. const stockId = res.data.stockId;
  574. // 获取股票信息
  575. const StockInfo = await postStock({
  576. recordId: "42",
  577. parentId: "0",
  578. stockId:"42",
  579. token: memberStore.userInfo?.token || '',
  580. language: "cn",
  581. });
  582. console.log("StockInfo", StockInfo);
  583. // if (StockInfo.code !== 200) {
  584. // return ;
  585. // }
  586. const markdown = StockInfo.markdown;
  587. console.log("StockInfo", StockInfo);
  588. // 添加请求延迟
  589. // const toDataInfo = await getData();
  590. // console.log(toDataInfo);
  591. // dataInfo.value = toDataInfo.data;
  592. // console.log(dataInfo.value);
  593. messages.value[messages.value.length - 1].isThinking = false;
  594. // 滚动到底部
  595. nextTick(() => {
  596. scrollToBottom();
  597. });
  598. // 模拟流式响应
  599. let responseText = `我已经收到您的消息: "${userMessage}"。+"${markdown}" `;
  600. let index = 0;
  601. const botIndex = messages.value.length - 1;
  602. const baseDelay = 5; // 普通字符基础延迟(毫秒)
  603. const slowPunct = /[。!?!?;;]/; // 句号、感叹号、分号等较长停顿
  604. const midPunct = /[,、,::]/; // 逗号、顿号、冒号等中等停顿
  605. const typeWriter = () => {
  606. if (index < responseText.length) {
  607. const ch = responseText.charAt(index);
  608. const current = messages.value[botIndex];
  609. // 通过数组替换触发渲染,避免部分平台对子项属性变更不响应
  610. messages.value.splice(botIndex, 1, {
  611. ...current,
  612. content: current.content + ch,
  613. isTyping: true,
  614. });
  615. index++;
  616. scrollToBottom();
  617. const delay = slowPunct.test(ch)
  618. ? 220
  619. : midPunct.test(ch)
  620. ? 120
  621. : baseDelay;
  622. setTimeout(typeWriter, delay);
  623. } else {
  624. const current = messages.value[botIndex];
  625. messages.value.splice(botIndex, 1, { ...current, isTyping: false });
  626. isSending.value = false;
  627. nextTick(() => {
  628. scrollToBottom();
  629. });
  630. }
  631. };
  632. // 启动前稍作停顿,避免过快开始
  633. setTimeout(typeWriter, 500);
  634. console.log("messages", messages);
  635. };
  636. // 当消息出现或变化时,测量容器并滚到底部
  637. watch(messages, (arr) => {
  638. if (arr.length > 0) {
  639. nextTick(() => {
  640. measureChatContainer();
  641. scrollToBottom();
  642. });
  643. }
  644. });
  645. // 滚动到底部(仅聊天区域滚动)
  646. const scrollToBottom = () => {
  647. if (!shouldAutoScroll.value) return;
  648. const query = uni.createSelectorQuery();
  649. query.select("#messageList").boundingClientRect();
  650. query.exec((res) => {
  651. if (res[0]) {
  652. latestContentHeight.value = res[0].height;
  653. chatScrollTop.value = res[0].height; // scroll-view 会自动夹紧到最大位置
  654. }
  655. });
  656. };
  657. const scrollToTop = () => {
  658. chatScrollTop.value = 0;
  659. };
  660. // 自动滚动控制:用户向上滚动时暂停自动滚到底部
  661. const shouldAutoScroll = ref(true);
  662. const latestContentHeight = ref(0);
  663. const lastScrollTop = ref(0);
  664. const windowHeight = uni.getSystemInfoSync().windowHeight;
  665. const AUTO_SCROLL_REENABLE_THRESHOLD = 40000; // px,接近底部时恢复自动滚动
  666. const onChatScroll = (e) => {
  667. const st = e.detail?.scrollTop || 0;
  668. const delta = st - lastScrollTop.value;
  669. lastScrollTop.value = st;
  670. if (delta < 0) {
  671. shouldAutoScroll.value = false;
  672. return;
  673. }
  674. const distanceToBottom =
  675. latestContentHeight.value - st - chatContainerHeight.value;
  676. if (distanceToBottom <= AUTO_SCROLL_REENABLE_THRESHOLD) {
  677. shouldAutoScroll.value = true;
  678. }
  679. };
  680. // 回到顶部图标拖拽状态
  681. const backTopX = ref(0);
  682. const backTopY = ref(0);
  683. const backTopDragging = ref(false);
  684. const backTopDragOffset = ref({ x: 0, y: 0 });
  685. const backTopTargetX = ref(0);
  686. const backTopTargetY = ref(0);
  687. let backTopRAF = 0;
  688. const backTopSmoothing = 0.15; // 越大越跟手,越小越顺滑
  689. const backTopEpsilon = 0.5; // 收敛阈值
  690. const raf =
  691. typeof requestAnimationFrame === "function"
  692. ? requestAnimationFrame
  693. : (fn) => setTimeout(fn, 16);
  694. const caf =
  695. typeof cancelAnimationFrame === "function"
  696. ? cancelAnimationFrame
  697. : (id) => clearTimeout(id);
  698. function stepBackTop() {
  699. const dx = backTopTargetX.value - backTopX.value;
  700. const dy = backTopTargetY.value - backTopY.value;
  701. // 插值缓动,避免每帧重排
  702. backTopX.value += dx * backTopSmoothing;
  703. backTopY.value += dy * backTopSmoothing;
  704. if (Math.abs(dx) > backTopEpsilon || Math.abs(dy) > backTopEpsilon) {
  705. backTopRAF = raf(stepBackTop);
  706. } else {
  707. backTopX.value = backTopTargetX.value;
  708. backTopY.value = backTopTargetY.value;
  709. backTopRAF = 0;
  710. }
  711. }
  712. function ensureBackTopRAF() {
  713. if (!backTopRAF) {
  714. backTopRAF = raf(stepBackTop);
  715. }
  716. }
  717. const clamp = (val, min, max) => Math.max(min, Math.min(val, max));
  718. const onBackTopTouchStart = (e) => {
  719. const t = e.touches && e.touches[0];
  720. if (!t) return;
  721. backTopDragging.value = false;
  722. backTopDragOffset.value = {
  723. x: t.pageX - backTopX.value,
  724. y: t.pageY - backTopY.value,
  725. };
  726. };
  727. const onBackTopTouchMove = (e) => {
  728. const t = e.touches && e.touches[0];
  729. if (!t) return;
  730. const sys = uni.getSystemInfoSync();
  731. const iconSize = uni.upx2px(100);
  732. const reserveBottom = uni.upx2px(260);
  733. const nx = t.pageX - backTopDragOffset.value.x;
  734. const ny = t.pageY - backTopDragOffset.value.y;
  735. const clampedX = clamp(nx, 0, sys.windowWidth - iconSize);
  736. const clampedY = clamp(ny, 0, sys.windowHeight - reserveBottom - iconSize);
  737. if (
  738. Math.abs(clampedX - backTopX.value) + Math.abs(clampedY - backTopY.value) >
  739. 3
  740. ) {
  741. backTopDragging.value = true;
  742. }
  743. backTopTargetX.value = clampedX;
  744. backTopTargetY.value = clampedY;
  745. ensureBackTopRAF();
  746. };
  747. const onBackTopTouchEnd = () => {
  748. // 结束拖拽即可
  749. };
  750. const onBackTopClick = () => {
  751. if (backTopDragging.value) return; // 拖拽时不触发点击回到顶部
  752. scrollToTop();
  753. };
  754. // 历史记录详情
  755. async function itemClick(item) {
  756. const res = await postHistoryDetail({
  757. recordId: item.id,
  758. parentId: item.parentId,
  759. model: 5,
  760. });
  761. if (res.code == 200) {
  762. const message = res.data.wokeFlowData.One.markdown;
  763. messages.value = [];
  764. const botMsg = {
  765. content: message,
  766. isUser: false,
  767. isTyping: false,
  768. isThinking: false,
  769. };
  770. messages.value.push(botMsg);
  771. }
  772. }
  773. </script>
  774. <style scoped>
  775. .deepMate-page {
  776. display: flex;
  777. flex-direction: column;
  778. position: fixed;
  779. /* 充满视口,彻底禁用页面滚动 */
  780. top: 0;
  781. left: 0;
  782. right: 0;
  783. bottom: 0;
  784. height: 100vh;
  785. overflow: hidden;
  786. /* 锁定页面滚动 */
  787. background-color: #ffffff;
  788. padding: 20rpx 0rpx;
  789. }
  790. .header {
  791. display: flex;
  792. justify-content: space-between;
  793. align-items: center;
  794. padding: 20rpx 30rpx;
  795. background-color: #ffffff;
  796. box-shadow: 0 2rpx rgba(0, 0, 0, 0.1);
  797. }
  798. .header-left,
  799. .header-right {
  800. display: flex;
  801. align-items: center;
  802. }
  803. .header-left .icon,
  804. .header-right .icon {
  805. width: 40rpx;
  806. height: 40rpx;
  807. /* margin-right: 20rpx; */
  808. }
  809. .header-center .title {
  810. position: fixed;
  811. top: 10rpx;
  812. left: 50%;
  813. transform: translateX(-50%);
  814. font-size: 36rpx;
  815. font-weight: bold;
  816. color: #333333;
  817. }
  818. .new-chat-button {
  819. background-color: #ff6600;
  820. border: none;
  821. border-radius: 8rpx;
  822. padding: 10rpx 20rpx;
  823. }
  824. .new-chat-text {
  825. color: white;
  826. font-size: 24rpx;
  827. }
  828. .main-content {
  829. background-color: #fff;
  830. flex: 1;
  831. display: flex;
  832. flex-direction: column;
  833. overflow: hidden;
  834. /* 内部滚动交给聊天容器 */
  835. padding: 20rpx;
  836. margin-top: 1rpx;
  837. margin-bottom: 280rpx;
  838. }
  839. /* 聊天顶部粘性欢迎块样式 */
  840. .chat-header {
  841. position: sticky;
  842. top: 0;
  843. /* 在页面滚动时始终贴顶 */
  844. z-index: 50;
  845. background-color: #ffffff;
  846. padding: 3rpx 20rpx;
  847. }
  848. .robot-container {
  849. display: flex;
  850. align-items: center;
  851. margin-top: 30rpx;
  852. }
  853. .robot-avatar {
  854. width: 130rpx;
  855. height: 130rpx;
  856. border-radius: 50%;
  857. margin-left: 20rpx;
  858. }
  859. .welcome-message {
  860. flex: 1;
  861. }
  862. .greeting {
  863. font-size: 32rpx;
  864. margin-left: 50rpx;
  865. top: 40rpx;
  866. font-weight: bold;
  867. color: #333333;
  868. line-height: 48rpx;
  869. }
  870. .description {
  871. display: block;
  872. font-size: 24rpx;
  873. color: #666666;
  874. line-height: 36rpx;
  875. margin-top: 10rpx;
  876. margin-left: 45rpx;
  877. }
  878. .function-tabs {
  879. display: block;
  880. overflow: hidden;
  881. margin-bottom: 30rpx;
  882. }
  883. .tabs-track {
  884. display: inline-flex;
  885. white-space: nowrap;
  886. will-change: transform;
  887. }
  888. .tab-item {
  889. padding: 5rpx 20rpx;
  890. border-radius: 20rpx;
  891. font-size: 20rpx;
  892. font-weight: 700;
  893. color: #666666;
  894. background-color: #fffefe;
  895. margin-right: 20rpx;
  896. transition: all 0.3s;
  897. }
  898. .tab-item.active {
  899. color: #ff6600;
  900. background-color: #fff;
  901. border: 1rpx solid #ff6600;
  902. }
  903. .recommend-card {
  904. background: url("https://d31zlh4on95l9h.cloudfront.net/images/4da1d629a55c307c3605ca15bf15189a.svg");
  905. background-repeat: no-repeat;
  906. background-position: center bottom;
  907. background-size: contain;
  908. /* min-height: 20rpx; */
  909. /* border-radius: 20rpx; */
  910. padding: 40rpx;
  911. margin-top: 20rpx;
  912. margin-bottom: 10rpx;
  913. /* box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05); */
  914. }
  915. .welcome-section {
  916. /* 灰色卡片(recommend-card)之后展示背景图 */
  917. margin-top: 10rpx;
  918. display: flex;
  919. align-items: center;
  920. justify-content: center;
  921. background: url("https://d31zlh4on95l9h.cloudfront.net/images/eca84d9fb54712cb3bc6c6174773b83b.svg");
  922. background-repeat: no-repeat;
  923. background-position: center top;
  924. /* 放在容器顶部,正好在灰色卡片下方 */
  925. background-size: 80% auto;
  926. /* 缩放以适配宽度 */
  927. height: 460rpx;
  928. /* 提供可视高度,让背景图可见 */
  929. }
  930. .card-content {
  931. display: flex;
  932. align-items: center;
  933. justify-content: space-between;
  934. margin-left: 40rpx;
  935. }
  936. .logo {
  937. width: 80rpx;
  938. height: 80rpx;
  939. background-color: #ff0000;
  940. border-radius: 10rpx;
  941. display: flex;
  942. align-items: center;
  943. justify-content: center;
  944. margin-right: 20rpx;
  945. }
  946. .card-text {
  947. flex: 1;
  948. margin-left: 20rpx;
  949. }
  950. .main-question {
  951. font-size: 32rpx;
  952. color: #333333;
  953. line-height: 48rpx;
  954. }
  955. .stock-code {
  956. display: block;
  957. font-size: 24rpx;
  958. color: #ff3b30;
  959. background-color: #ffffff;
  960. padding: 2rpx 15rpx;
  961. border-radius: 12rpx;
  962. margin-top: 8rpx;
  963. width: fit-content;
  964. border: 1rpx solid #ff3b30;
  965. }
  966. .arrow-icon {
  967. background: url("https://d31zlh4on95l9h.cloudfront.net/images/40d94054644f6e3f1c366751f07f0010.svg");
  968. background-repeat: no-repeat;
  969. left: 0.5rem;
  970. top: 1.8rem;
  971. background-size: 100% 100%;
  972. width: 60rpx;
  973. height: 60rpx;
  974. }
  975. .interest-section {
  976. margin-bottom: 30rpx;
  977. }
  978. .section-title {
  979. display: block;
  980. text-align: left;
  981. font-size: 26rpx;
  982. color: #666666;
  983. margin-bottom: 20rpx;
  984. }
  985. .topics-list {
  986. display: flex;
  987. flex-direction: column;
  988. gap: 15rpx;
  989. }
  990. .topic-item {
  991. display: flex;
  992. align-items: center;
  993. padding: 15rpx 20rpx;
  994. background-color: #f0f0f0;
  995. border-radius: 15rpx;
  996. width: fit-content;
  997. }
  998. .tag-icon {
  999. width: 24rpx;
  1000. height: 24rpx;
  1001. margin-right: 10rpx;
  1002. }
  1003. .topic-text {
  1004. font-size: 28rpx;
  1005. color: #333333;
  1006. flex: 1;
  1007. }
  1008. /* 聊天区域样式 */
  1009. .chat-container {
  1010. margin-top: 30rpx;
  1011. border-radius: 10rpx;
  1012. height: calc(100vh - 50rpx);
  1013. /* 缩短滚动区域,避免被输入框覆盖 */
  1014. overflow-y: auto;
  1015. -webkit-overflow-scrolling: touch;
  1016. }
  1017. .message-list {
  1018. background-color: #fff;
  1019. margin-bottom: 400rpx;
  1020. /* padding: 20rpx; */
  1021. }
  1022. .message {
  1023. display: flex;
  1024. align-items: flex-start;
  1025. margin-bottom: 30rpx;
  1026. }
  1027. .user-message {
  1028. flex-direction: row-reverse;
  1029. justify-content: flex-start;
  1030. }
  1031. .message-icon {
  1032. font-size: 24rpx;
  1033. margin: 0 10rpx;
  1034. padding: 10rpx;
  1035. border-radius: 50%;
  1036. background-color: #ddd;
  1037. width: 40rpx;
  1038. height: 40rpx;
  1039. display: flex;
  1040. align-items: center;
  1041. justify-content: center;
  1042. }
  1043. .user-message .message-icon {
  1044. background-color: #007aff;
  1045. border-radius: 50%;
  1046. color: #fff;
  1047. /* box-shadow: 0 0 12rpx rgba(0, 122, 255, 0.4); */
  1048. }
  1049. .bot-message .message-icon {
  1050. background: url("/static/images/机器人 (1).svg");
  1051. color: white;
  1052. }
  1053. .message-content {
  1054. max-width: 70%;
  1055. position: relative;
  1056. word-wrap: break-word;
  1057. word-break: break-all;
  1058. overflow-wrap: break-word;
  1059. }
  1060. .user-message .message-content {
  1061. /* background-color: #007aff; */
  1062. border: 2rpx solid #f3908f;
  1063. border-radius: 20rpx;
  1064. padding: 10rpx;
  1065. }
  1066. .bot-message .message-content {
  1067. background-color: #f0f0f0;
  1068. border-radius: 10rpx;
  1069. padding: 15rpx;
  1070. }
  1071. .message-text {
  1072. font-size: 28rpx;
  1073. line-height: 40rpx;
  1074. }
  1075. .user-message .message-text {
  1076. color: black;
  1077. }
  1078. .bot-message .message-text {
  1079. color: #333;
  1080. }
  1081. .loading-dots {
  1082. display: flex;
  1083. align-items: center;
  1084. /* padding-top: 10rpx; */
  1085. }
  1086. .dot {
  1087. width: 10rpx;
  1088. height: 10rpx;
  1089. background-color: #666;
  1090. border-radius: 50%;
  1091. margin: 0 4rpx;
  1092. animation: loading 1.4s infinite ease-in-out both;
  1093. }
  1094. .user-message .dot {
  1095. background-color: white;
  1096. }
  1097. .dot:nth-child(1) {
  1098. animation-delay: -0.32s;
  1099. }
  1100. .dot:nth-child(2) {
  1101. animation-delay: -0.16s;
  1102. }
  1103. @keyframes loading {
  1104. 0%,
  1105. 80%,
  1106. 100% {
  1107. transform: scale(0);
  1108. }
  1109. 40% {
  1110. transform: scale(1);
  1111. }
  1112. }
  1113. .input-area {
  1114. position: fixed;
  1115. margin-top: 20rpx;
  1116. bottom: 70rpx;
  1117. left: 0;
  1118. right: 0;
  1119. padding: 0 40rpx 80rpx 40rpx;
  1120. background-color: #ffffff;
  1121. }
  1122. .input-wrapper {
  1123. position: relative;
  1124. display: flex;
  1125. align-items: center;
  1126. padding: 15rpx 20rpx;
  1127. background-color: rgb(220, 31, 29);
  1128. border-radius: 100rpx;
  1129. display: flex;
  1130. align-items: center;
  1131. justify-content: center;
  1132. height: 50rpx;
  1133. }
  1134. .mic-icon {
  1135. width: 36rpx;
  1136. height: 36rpx;
  1137. margin-right: 20rpx;
  1138. }
  1139. .input-field {
  1140. flex: 1;
  1141. font-size: 28rpx;
  1142. color: #fff;
  1143. display: flex;
  1144. align-items: center;
  1145. justify-content: center;
  1146. margin-left: 60rpx;
  1147. background: none;
  1148. border: none;
  1149. outline: none;
  1150. }
  1151. .input-field::placeholder {
  1152. color: #ffffff !important;
  1153. opacity: 1;
  1154. }
  1155. /* .uni-scroll-view{
  1156. height: 92%;
  1157. } */
  1158. .send-button {
  1159. background: url("https://d31zlh4on95l9h.cloudfront.net/images/95f1ea2262e9157db13c93c0dc1c5d96.svg");
  1160. background-repeat: no-repeat;
  1161. background-size: 100% 100%;
  1162. height: 50rpx;
  1163. width: 50rpx;
  1164. padding: 0;
  1165. border: 1rpx solid transparent;
  1166. margin-left: 20rpx;
  1167. }
  1168. .send-icon {
  1169. width: 36rpx;
  1170. height: 36rpx;
  1171. }
  1172. .disclaimer {
  1173. font-size: 15rpx;
  1174. color: #4d4c4c;
  1175. display: flex;
  1176. align-items: center;
  1177. justify-content: center;
  1178. margin-top: 15rpx;
  1179. }
  1180. .banner-panel {
  1181. position: relative;
  1182. height: 480rpx;
  1183. /* 拉长容器,灰色背景跟随变高 */
  1184. overflow: hidden;
  1185. /* 让圆角和内部层剪裁一致 */
  1186. border-radius: 15rpx;
  1187. }
  1188. .panelShow {
  1189. height: 12%;
  1190. }
  1191. .pray-banner {
  1192. position: absolute;
  1193. /* background-size: 100% 100%; */
  1194. inset: 0;
  1195. /* 顶部、底部、左、右都贴合容器 */
  1196. width: 100%;
  1197. height: 81%;
  1198. border-radius: 15rpx;
  1199. z-index: 1;
  1200. /* 在灰底之上、内容之下 */
  1201. }
  1202. .contain {
  1203. margin: 0 20rpx;
  1204. gap: 5rpx;
  1205. }
  1206. .banner-panel .robot-container,
  1207. .banner-panel .function-tabs,
  1208. .banner-panel .recommend-card {
  1209. position: relative;
  1210. z-index: 2;
  1211. }
  1212. .back-to-top {
  1213. position: fixed;
  1214. left: 0;
  1215. top: 0;
  1216. width: 100rpx;
  1217. height: 100rpx;
  1218. z-index: 1000;
  1219. }
  1220. .back-to-top:active {
  1221. transform: scale(0.96);
  1222. }
  1223. .static-footer {
  1224. position: fixed;
  1225. bottom: 0;
  1226. }
  1227. /* 搜索历史侧拉框样式 */
  1228. .drawer-overlay {
  1229. position: fixed;
  1230. left: 0;
  1231. top: 0;
  1232. right: 0;
  1233. bottom: 0;
  1234. background-color: rgba(0, 0, 0, 0.35);
  1235. z-index: 900;
  1236. }
  1237. .drawer-panel {
  1238. position: fixed;
  1239. left: 0;
  1240. right: 0;
  1241. bottom: 0;
  1242. height: 75vh;
  1243. max-height: 80vh;
  1244. width: 100%;
  1245. background: #ffffff;
  1246. box-shadow: 0 -8rpx 20rpx rgba(0, 0, 0, 0.06);
  1247. z-index: 1000;
  1248. display: flex;
  1249. flex-direction: column;
  1250. border-top-left-radius: 20rpx;
  1251. border-top-right-radius: 20rpx;
  1252. transition: transform 0.22s ease;
  1253. }
  1254. .drawer-back {
  1255. position: absolute;
  1256. left: 50%;
  1257. top: -14px;
  1258. transform: translateX(-50%);
  1259. width: 28px;
  1260. height: 48px;
  1261. border-radius: 12px;
  1262. background: #fff;
  1263. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  1264. display: flex;
  1265. align-items: center;
  1266. justify-content: center;
  1267. }
  1268. .drawer-back-icon {
  1269. font-size: 16px;
  1270. color: #8a8a8a;
  1271. }
  1272. .drawer-actions {
  1273. display: flex;
  1274. align-items: center;
  1275. gap: 40rpx;
  1276. }
  1277. .delete-all-container {
  1278. display: flex;
  1279. align-items: center;
  1280. gap: 14rpx;
  1281. }
  1282. .delete-icon {
  1283. width: 45rpx;
  1284. height: 40rpx;
  1285. }
  1286. .delete-all {
  1287. font-size: 28rpx;
  1288. }
  1289. .drawer-close {
  1290. background: url("/static/icons/关闭2.svg");
  1291. width: 48rpx;
  1292. height: 48rpx;
  1293. border-radius: 24rpx;
  1294. /* background: #f5f5f5; */
  1295. /* box-shadow: 0 2px 8px rgba(0,0,0,0.08); */
  1296. display: flex;
  1297. align-items: center;
  1298. justify-content: center;
  1299. }
  1300. .drawer-close-icon {
  1301. font-size: 24rpx;
  1302. color: #8a8a8a;
  1303. }
  1304. .drawer-header {
  1305. display: flex;
  1306. align-items: center;
  1307. justify-content: space-between;
  1308. padding: 52rpx 28rpx 0rpx 28rpx;
  1309. /* border-bottom: 2rpx solid #f0f0f0; */
  1310. }
  1311. .drawer-title {
  1312. font-size: 32rpx;
  1313. font-weight: 600;
  1314. color: #333333;
  1315. }
  1316. /* .drawer-close {
  1317. font-size: 42rpx;
  1318. color: #999999;
  1319. } */
  1320. .drawer-content {
  1321. flex: 1;
  1322. min-height: 0;
  1323. /* 让 flex 子元素可在容器内收缩以启用滚动 */
  1324. height: 100%;
  1325. overscroll-behavior-y: contain;
  1326. /* 防止滚动串联到页面 */
  1327. -webkit-overflow-scrolling: touch;
  1328. /* iOS 惯性滚动 */
  1329. touch-action: pan-y;
  1330. /* 优化触控滚动,仅垂直 */
  1331. }
  1332. .drawer-inner {
  1333. padding: 20rpx 24rpx 20rpx 24rpx;
  1334. }
  1335. .history-section {
  1336. margin-bottom: 20rpx;
  1337. /* margin: 0 24rpx; */
  1338. }
  1339. .section-title {
  1340. font-size: 26rpx;
  1341. color: #888;
  1342. margin: 10rpx 6rpx 16rpx;
  1343. }
  1344. .history-item {
  1345. display: flex;
  1346. align-items: center;
  1347. padding: 19rpx 18rpx;
  1348. background-color: #f6f7f9;
  1349. border-radius: 12rpx;
  1350. margin-bottom: 12rpx;
  1351. }
  1352. .history-left {
  1353. margin-right: 12rpx;
  1354. }
  1355. .flag-circle {
  1356. width: 36rpx;
  1357. height: 36rpx;
  1358. border-radius: 50%;
  1359. background: #fff;
  1360. border: 2rpx solid #eee;
  1361. display: flex;
  1362. align-items: center;
  1363. justify-content: center;
  1364. }
  1365. .flag-emoji {
  1366. font-size: 24rpx;
  1367. }
  1368. .history-main {
  1369. flex: 1;
  1370. }
  1371. .history-query {
  1372. font-size: 28rpx;
  1373. color: #333;
  1374. }
  1375. .history-time {
  1376. font-size: 22rpx;
  1377. color: #999;
  1378. }
  1379. .history-card {
  1380. background-color: #fff;
  1381. border: 2rpx solid #f2f2f2;
  1382. border-left: 8rpx solid rgb(220, 31, 29);
  1383. border-radius: 12rpx;
  1384. padding: 18rpx 20rpx;
  1385. margin-bottom: 16rpx;
  1386. box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.03);
  1387. }
  1388. .history-query {
  1389. font-size: 28rpx;
  1390. color: #333333;
  1391. font-weight: 500;
  1392. }
  1393. .history-time {
  1394. margin-top: 8rpx;
  1395. font-size: 22rpx;
  1396. color: #888888;
  1397. }
  1398. .empty-history {
  1399. padding: 40rpx;
  1400. color: #999999;
  1401. text-align: center;
  1402. }
  1403. .thinking-process {
  1404. margin: 10rpx 0;
  1405. border: 2rpx solid #e5e5e5;
  1406. border-radius: 20rpx;
  1407. background-color: #f9f9f9;
  1408. }
  1409. .thinking-header {
  1410. display: flex;
  1411. align-items: center;
  1412. padding: 20rpx 30rpx;
  1413. cursor: pointer;
  1414. background-color: #fff;
  1415. border-radius: 20rpx;
  1416. border-bottom: 2rpx solid #e5e5e5;
  1417. }
  1418. .thinking-icon {
  1419. font-size: 32rpx;
  1420. margin-right: 16rpx;
  1421. color: #d47c45;
  1422. }
  1423. .thinking-title {
  1424. font-size: 28rpx;
  1425. font-weight: 500;
  1426. color: #d47c45;
  1427. margin-right: 16rpx;
  1428. }
  1429. .thinking-count {
  1430. font-size: 24rpx;
  1431. color: #666;
  1432. margin-right: 16rpx;
  1433. }
  1434. .thinking-toggle {
  1435. font-size: 24rpx;
  1436. color: #999;
  1437. }
  1438. .thinking-content {
  1439. padding: 20rpx 30rpx;
  1440. }
  1441. .thinking-item {
  1442. display: flex;
  1443. align-items: center;
  1444. margin-bottom: 16rpx;
  1445. padding: 8rpx 0;
  1446. }
  1447. .item-status {
  1448. width: 32rpx;
  1449. height: 32rpx;
  1450. border-radius: 50%;
  1451. background-color: #f0f0f0;
  1452. display: flex;
  1453. justify-content: center;
  1454. align-items: center;
  1455. margin-right: 16rpx;
  1456. }
  1457. .checkmark {
  1458. font-size: 20rpx;
  1459. color: #ff0000;
  1460. }
  1461. .item-text {
  1462. font-size: 24rpx;
  1463. color: #333;
  1464. }
  1465. </style>