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.

1697 lines
41 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.stockName }}</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 = async() => {
  436. const res = await 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:
  564. "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q",
  565. });
  566. console.log("res" + res);
  567. // 意图识别不通过
  568. if (res.code !== 200) {
  569. console.log("未通过意图识别");
  570. // 更新机器人的消息内容
  571. const errorMessage = res.message || "请求失败,请稍后重试";
  572. let responseText = `我已经收到您的消息: "${userMessage}"。错误信息: "${errorMessage}"`;
  573. // 开始打字机效果显示错误信息
  574. let index = 0;
  575. const botIndex = messages.value.length - 1;
  576. const typeWriter = () => {
  577. if (index < responseText.length) {
  578. const ch = responseText.charAt(index);
  579. const current = messages.value[botIndex];
  580. // 通过数组替换触发渲染,避免部分平台对子项属性变更不响应
  581. messages.value.splice(botIndex, 1, {
  582. ...current,
  583. content: current.content + ch,
  584. isTyping: true,
  585. });
  586. index++;
  587. scrollToBottom();
  588. // 字符间延迟,模拟打字效果
  589. const baseDelay = 5; // 普通字符基础延迟(毫秒)
  590. const slowPunct = /[。!?!?;;]/; // 句号、感叹号、分号等较长停顿
  591. const midPunct = /[,、,::]/; // 逗号、顿号、冒号等中等停顿
  592. const delay = slowPunct.test(ch)
  593. ? 220
  594. : midPunct.test(ch)
  595. ? 120
  596. : baseDelay;
  597. setTimeout(typeWriter, delay);
  598. } else {
  599. // 打字完成,更新状态
  600. const current = messages.value[botIndex];
  601. messages.value.splice(botIndex, 1, { ...current, isTyping: false });
  602. isSending.value = false;
  603. nextTick(() => {
  604. scrollToBottom();
  605. });
  606. }
  607. };
  608. // 启动打字机效果
  609. setTimeout(typeWriter, 300);
  610. return;
  611. }
  612. console.log("通过意图识别");
  613. // 获取意图识别结果
  614. const recordId = res.data.recordId;
  615. const parentId = res.data.parentId;
  616. const stockId = res.data.stockId;
  617. // 获取股票信息
  618. const StockInfo = await postStock({
  619. recordId: recordId,
  620. parentId: parentId,
  621. stockId: stockId,
  622. token:
  623. "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q",
  624. language: "cn",
  625. });
  626. console.log("StockInfo", StockInfo);
  627. // if (StockInfo.code !== 200) {
  628. // return ;
  629. // }
  630. const markdown = StockInfo.data.markdown;
  631. console.log("StockInfo", StockInfo);
  632. // 添加请求延迟
  633. // const toDataInfo = await getData();
  634. // console.log(toDataInfo);
  635. // dataInfo.value = toDataInfo.data;
  636. // console.log(dataInfo.value);
  637. messages.value[messages.value.length - 1].isThinking = false;
  638. // 滚动到底部
  639. nextTick(() => {
  640. scrollToBottom();
  641. });
  642. // 模拟流式响应
  643. let responseText = `我已经收到您的消息: "${userMessage}"。+"${markdown}" `;
  644. let index = 0;
  645. const botIndex = messages.value.length - 1;
  646. const baseDelay = 5; // 普通字符基础延迟(毫秒)
  647. const slowPunct = /[。!?!?;;]/; // 句号、感叹号、分号等较长停顿
  648. const midPunct = /[,、,::]/; // 逗号、顿号、冒号等中等停顿
  649. const typeWriter = () => {
  650. if (index < responseText.length) {
  651. const ch = responseText.charAt(index);
  652. const current = messages.value[botIndex];
  653. // 通过数组替换触发渲染,避免部分平台对子项属性变更不响应
  654. messages.value.splice(botIndex, 1, {
  655. ...current,
  656. content: current.content + ch,
  657. isTyping: true,
  658. });
  659. index++;
  660. scrollToBottom();
  661. const delay = slowPunct.test(ch)
  662. ? 220
  663. : midPunct.test(ch)
  664. ? 120
  665. : baseDelay;
  666. setTimeout(typeWriter, delay);
  667. } else {
  668. const current = messages.value[botIndex];
  669. messages.value.splice(botIndex, 1, { ...current, isTyping: false });
  670. isSending.value = false;
  671. nextTick(() => {
  672. scrollToBottom();
  673. });
  674. }
  675. };
  676. // 启动前稍作停顿,避免过快开始
  677. setTimeout(typeWriter, 500);
  678. console.log("messages", messages);
  679. };
  680. // 当消息出现或变化时,测量容器并滚到底部
  681. watch(messages, (arr) => {
  682. if (arr.length > 0) {
  683. nextTick(() => {
  684. measureChatContainer();
  685. scrollToBottom();
  686. });
  687. }
  688. });
  689. // 滚动到底部(仅聊天区域滚动)
  690. const scrollToBottom = () => {
  691. if (!shouldAutoScroll.value) return;
  692. const query = uni.createSelectorQuery();
  693. query.select("#messageList").boundingClientRect();
  694. query.exec((res) => {
  695. if (res[0]) {
  696. latestContentHeight.value = res[0].height;
  697. chatScrollTop.value = res[0].height; // scroll-view 会自动夹紧到最大位置
  698. }
  699. });
  700. };
  701. const scrollToTop = () => {
  702. chatScrollTop.value = 0;
  703. };
  704. // 自动滚动控制:用户向上滚动时暂停自动滚到底部
  705. const shouldAutoScroll = ref(true);
  706. const latestContentHeight = ref(0);
  707. const lastScrollTop = ref(0);
  708. const windowHeight = uni.getSystemInfoSync().windowHeight;
  709. const AUTO_SCROLL_REENABLE_THRESHOLD = 40000; // px,接近底部时恢复自动滚动
  710. const onChatScroll = (e) => {
  711. const st = e.detail?.scrollTop || 0;
  712. const delta = st - lastScrollTop.value;
  713. lastScrollTop.value = st;
  714. if (delta < 0) {
  715. shouldAutoScroll.value = false;
  716. return;
  717. }
  718. const distanceToBottom =
  719. latestContentHeight.value - st - chatContainerHeight.value;
  720. if (distanceToBottom <= AUTO_SCROLL_REENABLE_THRESHOLD) {
  721. shouldAutoScroll.value = true;
  722. }
  723. };
  724. // 回到顶部图标拖拽状态
  725. const backTopX = ref(0);
  726. const backTopY = ref(0);
  727. const backTopDragging = ref(false);
  728. const backTopDragOffset = ref({ x: 0, y: 0 });
  729. const backTopTargetX = ref(0);
  730. const backTopTargetY = ref(0);
  731. let backTopRAF = 0;
  732. const backTopSmoothing = 0.15; // 越大越跟手,越小越顺滑
  733. const backTopEpsilon = 0.5; // 收敛阈值
  734. const raf =
  735. typeof requestAnimationFrame === "function"
  736. ? requestAnimationFrame
  737. : (fn) => setTimeout(fn, 16);
  738. const caf =
  739. typeof cancelAnimationFrame === "function"
  740. ? cancelAnimationFrame
  741. : (id) => clearTimeout(id);
  742. function stepBackTop() {
  743. const dx = backTopTargetX.value - backTopX.value;
  744. const dy = backTopTargetY.value - backTopY.value;
  745. // 插值缓动,避免每帧重排
  746. backTopX.value += dx * backTopSmoothing;
  747. backTopY.value += dy * backTopSmoothing;
  748. if (Math.abs(dx) > backTopEpsilon || Math.abs(dy) > backTopEpsilon) {
  749. backTopRAF = raf(stepBackTop);
  750. } else {
  751. backTopX.value = backTopTargetX.value;
  752. backTopY.value = backTopTargetY.value;
  753. backTopRAF = 0;
  754. }
  755. }
  756. function ensureBackTopRAF() {
  757. if (!backTopRAF) {
  758. backTopRAF = raf(stepBackTop);
  759. }
  760. }
  761. const clamp = (val, min, max) => Math.max(min, Math.min(val, max));
  762. const onBackTopTouchStart = (e) => {
  763. const t = e.touches && e.touches[0];
  764. if (!t) return;
  765. backTopDragging.value = false;
  766. backTopDragOffset.value = {
  767. x: t.pageX - backTopX.value,
  768. y: t.pageY - backTopY.value,
  769. };
  770. };
  771. const onBackTopTouchMove = (e) => {
  772. const t = e.touches && e.touches[0];
  773. if (!t) return;
  774. const sys = uni.getSystemInfoSync();
  775. const iconSize = uni.upx2px(100);
  776. const reserveBottom = uni.upx2px(260);
  777. const nx = t.pageX - backTopDragOffset.value.x;
  778. const ny = t.pageY - backTopDragOffset.value.y;
  779. const clampedX = clamp(nx, 0, sys.windowWidth - iconSize);
  780. const clampedY = clamp(ny, 0, sys.windowHeight - reserveBottom - iconSize);
  781. if (
  782. Math.abs(clampedX - backTopX.value) + Math.abs(clampedY - backTopY.value) >
  783. 3
  784. ) {
  785. backTopDragging.value = true;
  786. }
  787. backTopTargetX.value = clampedX;
  788. backTopTargetY.value = clampedY;
  789. ensureBackTopRAF();
  790. };
  791. const onBackTopTouchEnd = () => {
  792. // 结束拖拽即可
  793. };
  794. const onBackTopClick = () => {
  795. if (backTopDragging.value) return; // 拖拽时不触发点击回到顶部
  796. scrollToTop();
  797. };
  798. // 历史记录详情
  799. async function itemClick(item) {
  800. const res = await postHistoryDetail({
  801. recordId: item.id,
  802. parentId: item.parentId,
  803. model: 5,
  804. });
  805. if (res.code == 200) {
  806. const message = res.data.wokeFlowData.One.markdown;
  807. messages.value = [];
  808. const botMsg = {
  809. content: message,
  810. isUser: false,
  811. isTyping: false,
  812. isThinking: false,
  813. };
  814. messages.value.push(botMsg);
  815. }
  816. }
  817. </script>
  818. <style scoped>
  819. .deepMate-page {
  820. display: flex;
  821. flex-direction: column;
  822. position: fixed;
  823. /* 充满视口,彻底禁用页面滚动 */
  824. top: 0;
  825. left: 0;
  826. right: 0;
  827. bottom: 0;
  828. height: 100vh;
  829. overflow: hidden;
  830. /* 锁定页面滚动 */
  831. background-color: #ffffff;
  832. padding: 20rpx 0rpx;
  833. }
  834. .header {
  835. display: flex;
  836. justify-content: space-between;
  837. align-items: center;
  838. padding: 20rpx 30rpx;
  839. background-color: #ffffff;
  840. box-shadow: 0 2rpx rgba(0, 0, 0, 0.1);
  841. }
  842. .header-left,
  843. .header-right {
  844. display: flex;
  845. align-items: center;
  846. }
  847. .header-left .icon,
  848. .header-right .icon {
  849. width: 40rpx;
  850. height: 40rpx;
  851. /* margin-right: 20rpx; */
  852. }
  853. .header-center .title {
  854. position: fixed;
  855. top: 10rpx;
  856. left: 50%;
  857. transform: translateX(-50%);
  858. font-size: 36rpx;
  859. font-weight: bold;
  860. color: #333333;
  861. }
  862. .new-chat-button {
  863. background-color: #ff6600;
  864. border: none;
  865. border-radius: 8rpx;
  866. padding: 10rpx 20rpx;
  867. }
  868. .new-chat-text {
  869. color: white;
  870. font-size: 24rpx;
  871. }
  872. .main-content {
  873. background-color: #fff;
  874. flex: 1;
  875. display: flex;
  876. flex-direction: column;
  877. overflow: hidden;
  878. /* 内部滚动交给聊天容器 */
  879. padding: 20rpx;
  880. margin-top: 1rpx;
  881. margin-bottom: 280rpx;
  882. }
  883. /* 聊天顶部粘性欢迎块样式 */
  884. .chat-header {
  885. position: sticky;
  886. top: 0;
  887. /* 在页面滚动时始终贴顶 */
  888. z-index: 50;
  889. background-color: #ffffff;
  890. padding: 3rpx 20rpx;
  891. }
  892. .robot-container {
  893. display: flex;
  894. align-items: center;
  895. margin-top: 30rpx;
  896. }
  897. .robot-avatar {
  898. width: 130rpx;
  899. height: 130rpx;
  900. border-radius: 50%;
  901. margin-left: 20rpx;
  902. }
  903. .welcome-message {
  904. flex: 1;
  905. }
  906. .greeting {
  907. font-size: 32rpx;
  908. margin-left: 50rpx;
  909. top: 40rpx;
  910. font-weight: bold;
  911. color: #333333;
  912. line-height: 48rpx;
  913. }
  914. .description {
  915. display: block;
  916. font-size: 24rpx;
  917. color: #666666;
  918. line-height: 36rpx;
  919. margin-top: 10rpx;
  920. margin-left: 45rpx;
  921. }
  922. .function-tabs {
  923. display: block;
  924. overflow: hidden;
  925. margin-bottom: 30rpx;
  926. }
  927. .tabs-track {
  928. display: inline-flex;
  929. white-space: nowrap;
  930. will-change: transform;
  931. }
  932. .tab-item {
  933. padding: 5rpx 20rpx;
  934. border-radius: 20rpx;
  935. font-size: 20rpx;
  936. font-weight: 700;
  937. color: #666666;
  938. background-color: #fffefe;
  939. margin-right: 20rpx;
  940. transition: all 0.3s;
  941. }
  942. .tab-item.active {
  943. color: #ff6600;
  944. background-color: #fff;
  945. border: 1rpx solid #ff6600;
  946. }
  947. .recommend-card {
  948. background: url("https://d31zlh4on95l9h.cloudfront.net/images/4da1d629a55c307c3605ca15bf15189a.svg");
  949. background-repeat: no-repeat;
  950. background-position: center bottom;
  951. background-size: contain;
  952. /* min-height: 20rpx; */
  953. /* border-radius: 20rpx; */
  954. padding: 40rpx;
  955. margin-top: 20rpx;
  956. margin-bottom: 10rpx;
  957. /* box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05); */
  958. }
  959. .welcome-section {
  960. /* 灰色卡片(recommend-card)之后展示背景图 */
  961. margin-top: 10rpx;
  962. display: flex;
  963. align-items: center;
  964. justify-content: center;
  965. background: url("https://d31zlh4on95l9h.cloudfront.net/images/eca84d9fb54712cb3bc6c6174773b83b.svg");
  966. background-repeat: no-repeat;
  967. background-position: center top;
  968. /* 放在容器顶部,正好在灰色卡片下方 */
  969. background-size: 80% auto;
  970. /* 缩放以适配宽度 */
  971. height: 460rpx;
  972. /* 提供可视高度,让背景图可见 */
  973. }
  974. .card-content {
  975. display: flex;
  976. align-items: center;
  977. justify-content: space-between;
  978. margin-left: 40rpx;
  979. }
  980. .logo {
  981. width: 80rpx;
  982. height: 80rpx;
  983. background-color: #ff0000;
  984. border-radius: 10rpx;
  985. display: flex;
  986. align-items: center;
  987. justify-content: center;
  988. margin-right: 20rpx;
  989. }
  990. .card-text {
  991. flex: 1;
  992. margin-left: 20rpx;
  993. }
  994. .main-question {
  995. font-size: 32rpx;
  996. color: #333333;
  997. line-height: 48rpx;
  998. }
  999. .stock-code {
  1000. display: block;
  1001. font-size: 24rpx;
  1002. color: #ff3b30;
  1003. background-color: #ffffff;
  1004. padding: 2rpx 15rpx;
  1005. border-radius: 12rpx;
  1006. margin-top: 8rpx;
  1007. width: fit-content;
  1008. border: 1rpx solid #ff3b30;
  1009. }
  1010. .arrow-icon {
  1011. background: url("https://d31zlh4on95l9h.cloudfront.net/images/40d94054644f6e3f1c366751f07f0010.svg");
  1012. background-repeat: no-repeat;
  1013. left: 0.5rem;
  1014. top: 1.8rem;
  1015. background-size: 100% 100%;
  1016. width: 60rpx;
  1017. height: 60rpx;
  1018. }
  1019. .interest-section {
  1020. margin-bottom: 30rpx;
  1021. }
  1022. .section-title {
  1023. display: block;
  1024. text-align: left;
  1025. font-size: 26rpx;
  1026. color: #666666;
  1027. margin-bottom: 20rpx;
  1028. }
  1029. .topics-list {
  1030. display: flex;
  1031. flex-direction: column;
  1032. gap: 15rpx;
  1033. }
  1034. .topic-item {
  1035. display: flex;
  1036. align-items: center;
  1037. padding: 15rpx 20rpx;
  1038. background-color: #f0f0f0;
  1039. border-radius: 15rpx;
  1040. width: fit-content;
  1041. }
  1042. .tag-icon {
  1043. width: 24rpx;
  1044. height: 24rpx;
  1045. margin-right: 10rpx;
  1046. }
  1047. .topic-text {
  1048. font-size: 28rpx;
  1049. color: #333333;
  1050. flex: 1;
  1051. }
  1052. /* 聊天区域样式 */
  1053. .chat-container {
  1054. margin-top: 30rpx;
  1055. border-radius: 10rpx;
  1056. height: calc(100vh - 50rpx);
  1057. /* 缩短滚动区域,避免被输入框覆盖 */
  1058. overflow-y: auto;
  1059. -webkit-overflow-scrolling: touch;
  1060. }
  1061. .message-list {
  1062. background-color: #fff;
  1063. margin-bottom: 400rpx;
  1064. /* padding: 20rpx; */
  1065. }
  1066. .message {
  1067. display: flex;
  1068. align-items: flex-start;
  1069. margin-bottom: 30rpx;
  1070. }
  1071. .user-message {
  1072. flex-direction: row-reverse;
  1073. justify-content: flex-start;
  1074. }
  1075. .message-icon {
  1076. font-size: 24rpx;
  1077. margin: 0 10rpx;
  1078. padding: 10rpx;
  1079. border-radius: 50%;
  1080. background-color: #ddd;
  1081. width: 40rpx;
  1082. height: 40rpx;
  1083. display: flex;
  1084. align-items: center;
  1085. justify-content: center;
  1086. }
  1087. .user-message .message-icon {
  1088. background-color: #007aff;
  1089. border-radius: 50%;
  1090. color: #fff;
  1091. /* box-shadow: 0 0 12rpx rgba(0, 122, 255, 0.4); */
  1092. }
  1093. .bot-message .message-icon {
  1094. background: url("/static/images/机器人 (1).svg");
  1095. color: white;
  1096. }
  1097. .message-content {
  1098. max-width: 70%;
  1099. position: relative;
  1100. word-wrap: break-word;
  1101. word-break: break-all;
  1102. overflow-wrap: break-word;
  1103. }
  1104. .user-message .message-content {
  1105. /* background-color: #007aff; */
  1106. border: 2rpx solid #f3908f;
  1107. border-radius: 20rpx;
  1108. padding: 10rpx;
  1109. }
  1110. .bot-message .message-content {
  1111. background-color: #f0f0f0;
  1112. border-radius: 10rpx;
  1113. padding: 15rpx;
  1114. }
  1115. .message-text {
  1116. font-size: 28rpx;
  1117. line-height: 40rpx;
  1118. }
  1119. .user-message .message-text {
  1120. color: black;
  1121. }
  1122. .bot-message .message-text {
  1123. color: #333;
  1124. }
  1125. .loading-dots {
  1126. display: flex;
  1127. align-items: center;
  1128. /* padding-top: 10rpx; */
  1129. }
  1130. .dot {
  1131. width: 10rpx;
  1132. height: 10rpx;
  1133. background-color: #666;
  1134. border-radius: 50%;
  1135. margin: 0 4rpx;
  1136. animation: loading 1.4s infinite ease-in-out both;
  1137. }
  1138. .user-message .dot {
  1139. background-color: white;
  1140. }
  1141. .dot:nth-child(1) {
  1142. animation-delay: -0.32s;
  1143. }
  1144. .dot:nth-child(2) {
  1145. animation-delay: -0.16s;
  1146. }
  1147. @keyframes loading {
  1148. 0%,
  1149. 80%,
  1150. 100% {
  1151. transform: scale(0);
  1152. }
  1153. 40% {
  1154. transform: scale(1);
  1155. }
  1156. }
  1157. .input-area {
  1158. position: fixed;
  1159. margin-top: 20rpx;
  1160. bottom: 70rpx;
  1161. left: 0;
  1162. right: 0;
  1163. padding: 0 40rpx 80rpx 40rpx;
  1164. background-color: #ffffff;
  1165. }
  1166. .input-wrapper {
  1167. position: relative;
  1168. display: flex;
  1169. align-items: center;
  1170. padding: 15rpx 20rpx;
  1171. background-color: rgb(220, 31, 29);
  1172. border-radius: 100rpx;
  1173. display: flex;
  1174. align-items: center;
  1175. justify-content: center;
  1176. height: 50rpx;
  1177. }
  1178. .mic-icon {
  1179. width: 36rpx;
  1180. height: 36rpx;
  1181. margin-right: 20rpx;
  1182. }
  1183. .input-field {
  1184. flex: 1;
  1185. font-size: 28rpx;
  1186. color: #fff;
  1187. display: flex;
  1188. align-items: center;
  1189. justify-content: center;
  1190. margin-left: 60rpx;
  1191. background: none;
  1192. border: none;
  1193. outline: none;
  1194. }
  1195. .input-field::placeholder {
  1196. color: #ffffff !important;
  1197. opacity: 1;
  1198. }
  1199. /* .uni-scroll-view{
  1200. height: 92%;
  1201. } */
  1202. .send-button {
  1203. background: url("https://d31zlh4on95l9h.cloudfront.net/images/95f1ea2262e9157db13c93c0dc1c5d96.svg");
  1204. background-repeat: no-repeat;
  1205. background-size: 100% 100%;
  1206. height: 50rpx;
  1207. width: 50rpx;
  1208. padding: 0;
  1209. border: 1rpx solid transparent;
  1210. margin-left: 20rpx;
  1211. }
  1212. .send-icon {
  1213. width: 36rpx;
  1214. height: 36rpx;
  1215. }
  1216. .disclaimer {
  1217. font-size: 15rpx;
  1218. color: #4d4c4c;
  1219. display: flex;
  1220. align-items: center;
  1221. justify-content: center;
  1222. margin-top: 15rpx;
  1223. }
  1224. .banner-panel {
  1225. position: relative;
  1226. height: 480rpx;
  1227. /* 拉长容器,灰色背景跟随变高 */
  1228. overflow: hidden;
  1229. /* 让圆角和内部层剪裁一致 */
  1230. border-radius: 15rpx;
  1231. }
  1232. .panelShow {
  1233. height: 12%;
  1234. }
  1235. .pray-banner {
  1236. position: absolute;
  1237. /* background-size: 100% 100%; */
  1238. inset: 0;
  1239. /* 顶部、底部、左、右都贴合容器 */
  1240. width: 100%;
  1241. height: 81%;
  1242. border-radius: 15rpx;
  1243. z-index: 1;
  1244. /* 在灰底之上、内容之下 */
  1245. }
  1246. .contain {
  1247. margin: 0 20rpx;
  1248. gap: 5rpx;
  1249. }
  1250. .banner-panel .robot-container,
  1251. .banner-panel .function-tabs,
  1252. .banner-panel .recommend-card {
  1253. position: relative;
  1254. z-index: 2;
  1255. }
  1256. .back-to-top {
  1257. position: fixed;
  1258. left: 0;
  1259. top: 0;
  1260. width: 100rpx;
  1261. height: 100rpx;
  1262. z-index: 1000;
  1263. }
  1264. .back-to-top:active {
  1265. transform: scale(0.96);
  1266. }
  1267. .static-footer {
  1268. position: fixed;
  1269. bottom: 0;
  1270. }
  1271. /* 搜索历史侧拉框样式 */
  1272. .drawer-overlay {
  1273. position: fixed;
  1274. left: 0;
  1275. top: 0;
  1276. right: 0;
  1277. bottom: 0;
  1278. background-color: rgba(0, 0, 0, 0.35);
  1279. z-index: 900;
  1280. }
  1281. .drawer-panel {
  1282. position: fixed;
  1283. left: 0;
  1284. right: 0;
  1285. bottom: 0;
  1286. height: 75vh;
  1287. max-height: 80vh;
  1288. width: 100%;
  1289. background: #ffffff;
  1290. box-shadow: 0 -8rpx 20rpx rgba(0, 0, 0, 0.06);
  1291. z-index: 1000;
  1292. display: flex;
  1293. flex-direction: column;
  1294. border-top-left-radius: 20rpx;
  1295. border-top-right-radius: 20rpx;
  1296. transition: transform 0.22s ease;
  1297. }
  1298. .drawer-back {
  1299. position: absolute;
  1300. left: 50%;
  1301. top: -14px;
  1302. transform: translateX(-50%);
  1303. width: 28px;
  1304. height: 48px;
  1305. border-radius: 12px;
  1306. background: #fff;
  1307. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  1308. display: flex;
  1309. align-items: center;
  1310. justify-content: center;
  1311. }
  1312. .drawer-back-icon {
  1313. font-size: 16px;
  1314. color: #8a8a8a;
  1315. }
  1316. .drawer-actions {
  1317. display: flex;
  1318. align-items: center;
  1319. gap: 40rpx;
  1320. }
  1321. .delete-all-container {
  1322. display: flex;
  1323. align-items: center;
  1324. gap: 14rpx;
  1325. }
  1326. .delete-icon {
  1327. width: 45rpx;
  1328. height: 40rpx;
  1329. }
  1330. .delete-all {
  1331. font-size: 28rpx;
  1332. }
  1333. .drawer-close {
  1334. background: url("/static/icons/关闭2.svg");
  1335. width: 48rpx;
  1336. height: 48rpx;
  1337. border-radius: 24rpx;
  1338. /* background: #f5f5f5; */
  1339. /* box-shadow: 0 2px 8px rgba(0,0,0,0.08); */
  1340. display: flex;
  1341. align-items: center;
  1342. justify-content: center;
  1343. }
  1344. .drawer-close-icon {
  1345. font-size: 24rpx;
  1346. color: #8a8a8a;
  1347. }
  1348. .drawer-header {
  1349. display: flex;
  1350. align-items: center;
  1351. justify-content: space-between;
  1352. padding: 52rpx 28rpx 0rpx 28rpx;
  1353. /* border-bottom: 2rpx solid #f0f0f0; */
  1354. }
  1355. .drawer-title {
  1356. font-size: 32rpx;
  1357. font-weight: 600;
  1358. color: #333333;
  1359. }
  1360. /* .drawer-close {
  1361. font-size: 42rpx;
  1362. color: #999999;
  1363. } */
  1364. .drawer-content {
  1365. flex: 1;
  1366. min-height: 0;
  1367. /* 让 flex 子元素可在容器内收缩以启用滚动 */
  1368. height: 100%;
  1369. overscroll-behavior-y: contain;
  1370. /* 防止滚动串联到页面 */
  1371. -webkit-overflow-scrolling: touch;
  1372. /* iOS 惯性滚动 */
  1373. touch-action: pan-y;
  1374. /* 优化触控滚动,仅垂直 */
  1375. }
  1376. .drawer-inner {
  1377. padding: 20rpx 24rpx 20rpx 24rpx;
  1378. }
  1379. .history-section {
  1380. margin-bottom: 20rpx;
  1381. /* margin: 0 24rpx; */
  1382. }
  1383. .section-title {
  1384. font-size: 26rpx;
  1385. color: #888;
  1386. margin: 10rpx 6rpx 16rpx;
  1387. }
  1388. .history-item {
  1389. display: flex;
  1390. align-items: center;
  1391. padding: 19rpx 18rpx;
  1392. background-color: #f6f7f9;
  1393. border-radius: 12rpx;
  1394. margin-bottom: 12rpx;
  1395. }
  1396. .history-left {
  1397. margin-right: 12rpx;
  1398. }
  1399. .flag-circle {
  1400. width: 36rpx;
  1401. height: 36rpx;
  1402. border-radius: 50%;
  1403. background: #fff;
  1404. border: 2rpx solid #eee;
  1405. display: flex;
  1406. align-items: center;
  1407. justify-content: center;
  1408. }
  1409. .flag-emoji {
  1410. font-size: 24rpx;
  1411. }
  1412. .history-main {
  1413. flex: 1;
  1414. }
  1415. .history-query {
  1416. font-size: 28rpx;
  1417. color: #333;
  1418. }
  1419. .history-time {
  1420. font-size: 22rpx;
  1421. color: #999;
  1422. }
  1423. .history-card {
  1424. background-color: #fff;
  1425. border: 2rpx solid #f2f2f2;
  1426. border-left: 8rpx solid rgb(220, 31, 29);
  1427. border-radius: 12rpx;
  1428. padding: 18rpx 20rpx;
  1429. margin-bottom: 16rpx;
  1430. box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.03);
  1431. }
  1432. .history-query {
  1433. font-size: 28rpx;
  1434. color: #333333;
  1435. font-weight: 500;
  1436. }
  1437. .history-time {
  1438. margin-top: 8rpx;
  1439. font-size: 22rpx;
  1440. color: #888888;
  1441. }
  1442. .empty-history {
  1443. padding: 40rpx;
  1444. color: #999999;
  1445. text-align: center;
  1446. }
  1447. .thinking-process {
  1448. margin: 10rpx 0;
  1449. border: 2rpx solid #e5e5e5;
  1450. border-radius: 20rpx;
  1451. background-color: #f9f9f9;
  1452. }
  1453. .thinking-header {
  1454. display: flex;
  1455. align-items: center;
  1456. padding: 20rpx 30rpx;
  1457. cursor: pointer;
  1458. background-color: #fff;
  1459. border-radius: 20rpx;
  1460. border-bottom: 2rpx solid #e5e5e5;
  1461. }
  1462. .thinking-icon {
  1463. font-size: 32rpx;
  1464. margin-right: 16rpx;
  1465. color: #d47c45;
  1466. }
  1467. .thinking-title {
  1468. font-size: 28rpx;
  1469. font-weight: 500;
  1470. color: #d47c45;
  1471. margin-right: 16rpx;
  1472. }
  1473. .thinking-count {
  1474. font-size: 24rpx;
  1475. color: #666;
  1476. margin-right: 16rpx;
  1477. }
  1478. .thinking-toggle {
  1479. font-size: 24rpx;
  1480. color: #999;
  1481. }
  1482. .thinking-content {
  1483. padding: 20rpx 30rpx;
  1484. }
  1485. .thinking-item {
  1486. display: flex;
  1487. align-items: center;
  1488. margin-bottom: 16rpx;
  1489. padding: 8rpx 0;
  1490. }
  1491. .item-status {
  1492. width: 32rpx;
  1493. height: 32rpx;
  1494. border-radius: 50%;
  1495. background-color: #f0f0f0;
  1496. display: flex;
  1497. justify-content: center;
  1498. align-items: center;
  1499. margin-right: 16rpx;
  1500. }
  1501. .checkmark {
  1502. font-size: 20rpx;
  1503. color: #ff0000;
  1504. }
  1505. .item-text {
  1506. font-size: 24rpx;
  1507. color: #333;
  1508. }
  1509. </style>