QAndAHistory.vue 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378
  1. <template>
  2. <div class="history-container">
  3. <!-- 顶部导航 -->
  4. <div class="history-header">
  5. <div class="header-content">
  6. <div class="header-main">
  7. <h1 class="history-title">📚 历史问题记录</h1>
  8. <p class="history-subtitle">查看之前的提问和回答记录</p>
  9. </div>
  10. <div class="header-actions">
  11. <el-button
  12. class="back-btn"
  13. @click="$router.push('/qanda')"
  14. >
  15. <span class="btn-icon">⬅️</span>
  16. 返回问答
  17. </el-button>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="history-content">
  22. <!-- 统计卡片 -->
  23. <div class="stats-cards">
  24. <div class="stat-card">
  25. <div class="stat-icon">📝</div>
  26. <div class="stat-info">
  27. <div class="stat-number">{{ totalCount }}</div>
  28. <div class="stat-label">总问题数</div>
  29. </div>
  30. </div>
  31. <div class="stat-card">
  32. <div class="stat-icon">📄</div>
  33. <div class="stat-info">
  34. <div class="stat-number">{{ totalPages }}</div>
  35. <div class="stat-label">总页数</div>
  36. </div>
  37. </div>
  38. <div class="stat-card">
  39. <div class="stat-icon">🕒</div>
  40. <div class="stat-info">
  41. <div class="stat-number">{{ pageSize }}</div>
  42. <div class="stat-label">每页数量</div>
  43. </div>
  44. </div>
  45. </div>
  46. <!-- 搜索和筛选 -->
  47. <!-- <div class="filter-section">-->
  48. <!-- <div class="search-input">-->
  49. <!-- <el-input-->
  50. <!-- v-model="searchQuery"-->
  51. <!-- placeholder="搜索问题内容..."-->
  52. <!-- size="large"-->
  53. <!-- clearable-->
  54. <!-- @input="handleSearch"-->
  55. <!-- >-->
  56. <!-- <template #prefix>-->
  57. <!-- <span class="search-icon">🔍</span>-->
  58. <!-- </template>-->
  59. <!-- </el-input>-->
  60. <!-- </div>-->
  61. <!-- <div class="filter-actions">-->
  62. <!-- <el-button-->
  63. <!-- class="refresh-btn"-->
  64. <!-- @click="refreshData"-->
  65. <!-- :loading="loading"-->
  66. <!-- >-->
  67. <!-- <span class="btn-icon">🔄</span>-->
  68. <!-- 刷新-->
  69. <!-- </el-button>-->
  70. <!-- </div>-->
  71. <!-- </div>-->
  72. <!-- 加载状态 -->
  73. <div v-if="loading" class="loading-section">
  74. <div class="loading-content">
  75. <div class="loading-spinner"></div>
  76. <p>加载历史记录中...</p>
  77. </div>
  78. </div>
  79. <!-- 历史记录列表 -->
  80. <div v-else class="history-list">
  81. <div v-if="historyList.length === 0" class="empty-state">
  82. <div class="empty-content">
  83. <div class="empty-icon">📚</div>
  84. <h3>暂无历史记录</h3>
  85. <p>您还没有任何提问记录,快去首页提问吧!</p>
  86. <el-button
  87. type="primary"
  88. @click="$router.push('/')"
  89. class="go-home-btn"
  90. >
  91. <span class="btn-icon">🚀</span>
  92. 开始提问
  93. </el-button>
  94. </div>
  95. </div>
  96. <div v-else class="history-items">
  97. <div
  98. v-for="item in filteredHistory"
  99. :key="item.create_time"
  100. class="history-item"
  101. >
  102. <div class="item-header">
  103. <div class="question-content">
  104. <h3 class="question-title">{{ item.query }}</h3>
  105. <div class="question-meta">
  106. <span class="meta-item">
  107. <span class="meta-icon">🕒</span>
  108. {{ formatTime(item.create_time) }}
  109. </span>
  110. </div>
  111. </div>
  112. <div class="item-actions">
  113. <el-button
  114. class="detail-btn"
  115. @click="toggleItemDetail(item)"
  116. :class="{ active: expandedItems.includes(item.create_time) }"
  117. >
  118. <span class="btn-icon">
  119. {{ expandedItems.includes(item.create_time) ? '📖' : '📄' }}
  120. </span>
  121. {{ expandedItems.includes(item.create_time) ? '收起详情' : '查看详情' }}
  122. </el-button>
  123. </div>
  124. </div>
  125. <!-- 展开的详情 -->
  126. <div
  127. v-if="expandedItems.includes(item.create_time)"
  128. class="item-detail"
  129. >
  130. <!-- 最终结果 -->
  131. <div class="detail-section" v-if="item.final_result">
  132. <div class="section-header">
  133. <div class="section-icon">💡</div>
  134. <h4>最终结果</h4>
  135. </div>
  136. <div class="section-content">
  137. <div v-html="parseMarkdown(item.final_result)" class="content-text"></div>
  138. </div>
  139. </div>
  140. <!-- RAG搜索结果 -->
  141. <div class="detail-section" v-if="item.chat_res">
  142. <div class="section-header">
  143. <div class="section-icon">🔍</div>
  144. <h4>检索增强分析</h4>
  145. </div>
  146. <div class="section-content">
  147. <div v-html="parseMarkdown(item.chat_res)" class="content-text"></div>
  148. </div>
  149. </div>
  150. <!-- LLM搜索结果 -->
  151. <div class="detail-section" v-if="item.ai_answer">
  152. <div class="section-header">
  153. <div class="section-icon">🤔</div>
  154. <h4>AI搜索分析</h4>
  155. </div>
  156. <div class="section-content">
  157. <div v-html="parseMarkdown(item.ai_answer)" class="content-text"></div>
  158. </div>
  159. </div>
  160. <!-- 搜索结果统计 -->
  161. <div class="detail-section" v-if="item.search_res">
  162. <div class="section-header">
  163. <div class="section-icon">📚</div>
  164. <h4>参考内容</h4>
  165. <span class="result-count">
  166. {{ getSearchResults(item.search_res).length }} 条相关内容
  167. </span>
  168. </div>
  169. <div class="search-results-preview">
  170. <div
  171. v-for="(result, index) in getDisplayedResults(item)"
  172. :key="index"
  173. class="result-preview"
  174. @click="handleResultDetails(result)"
  175. >
  176. <div class="result-header">
  177. <span class="result-index">#{{ index + 1 }}</span>
  178. <span class="result-score" :class="getScoreClass(result.score)">
  179. {{ (result.score * 100).toFixed(1) }}%
  180. </span>
  181. </div>
  182. <p class="result-content">{{ result.contentSummary || result.content.substring(0, 120) }}...</p>
  183. <span class="result-source">{{ result.datasetName }}</span>
  184. <div class="result-footer">
  185. <span class="view-details">
  186. <span class="view-icon">🔍</span>
  187. 查看详情
  188. </span>
  189. </div>
  190. </div>
  191. <!-- 展开/收起按钮 -->
  192. <div
  193. v-if="getSearchResults(item.search_res).length > 3"
  194. class="more-results"
  195. >
  196. <el-button
  197. link
  198. type="primary"
  199. @click="toggleResultsExpansion(item)"
  200. class="expand-btn"
  201. >
  202. <span class="btn-icon">
  203. {{ item.isResultsExpanded ? '📂' : '📁' }}
  204. </span>
  205. {{ item.isResultsExpanded ? '收起' : `展开剩余 ${getSearchResults(item.search_res).length - 3} 条内容` }}
  206. </el-button>
  207. </div>
  208. </div>
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. <!-- 分页 -->
  214. <div v-if="historyList.length > 0" class="pagination-section">
  215. <el-pagination
  216. v-model:current-page="currentPage"
  217. v-model:page-size="pageSize"
  218. :total="totalCount"
  219. :page-sizes="[10, 20, 50, 100]"
  220. layout="total, sizes, prev, pager, next, jumper"
  221. @size-change="handleSizeChange"
  222. @current-change="handleCurrentChange"
  223. class="history-pagination"
  224. />
  225. </div>
  226. </div>
  227. </div>
  228. <!-- 搜索结果详情弹窗 -->
  229. <el-dialog
  230. v-model="resultDialogVisible"
  231. width="85%"
  232. class="content-dialog"
  233. :close-on-click-modal="false"
  234. >
  235. <template #header>
  236. <div class="dialog-header">
  237. <div class="dialog-title">
  238. <div class="title-icon">📄</div>
  239. <div class="title-content">
  240. <h3>{{ selectedResult.contentSummary }}</h3>
  241. <div class="title-meta">
  242. <span class="meta-badge knowledge-badge">
  243. <span class="badge-icon">📚</span>
  244. {{ selectedResult.datasetName }}
  245. </span>
  246. <span class="meta-badge score-badge" :class="getScoreClass(selectedResult.score)">
  247. <span class="badge-icon">🎯</span>
  248. 相关度: {{ (selectedResult.score * 100).toFixed(1) }}%
  249. </span>
  250. </div>
  251. </div>
  252. </div>
  253. </div>
  254. </template>
  255. <div class="dialog-content">
  256. <div class="content-tabs">
  257. <div
  258. class="tab-item"
  259. :class="{ active: activeTab === 'summary' }"
  260. @click="activeTab = 'summary'"
  261. >
  262. <span class="tab-icon">📝</span>
  263. 摘要内容
  264. </div>
  265. <div
  266. class="tab-item"
  267. :class="{ active: activeTab === 'original' }"
  268. @click="activeTab = 'original'"
  269. >
  270. <span class="tab-icon">📖</span>
  271. 完整原文
  272. </div>
  273. </div>
  274. <div class="tab-content">
  275. <div v-show="activeTab === 'summary'" class="content-section summary-section">
  276. <div class="section-header">
  277. <h4>内容摘要</h4>
  278. <el-button
  279. text
  280. class="copy-btn"
  281. @click="copyToClipboard(selectedResult.content)"
  282. >
  283. 📋 复制内容
  284. </el-button>
  285. </div>
  286. <div class="summary-content">
  287. {{ selectedResult.content }}
  288. </div>
  289. </div>
  290. <div v-show="activeTab === 'original'" class="content-section original-section">
  291. <div class="section-header">
  292. <h4>完整原文</h4>
  293. <el-button
  294. text
  295. class="copy-btn"
  296. @click="copyToClipboard(originalContent)"
  297. >
  298. 📋 复制原文
  299. </el-button>
  300. </div>
  301. <div class="original-content">
  302. <pre>{{ originalContent }}</pre>
  303. </div>
  304. </div>
  305. </div>
  306. </div>
  307. <template #footer>
  308. <div class="dialog-footer">
  309. <div class="footer-actions">
  310. <el-button
  311. class="action-btn secondary"
  312. @click="resultDialogVisible = false"
  313. >
  314. 取消
  315. </el-button>
  316. <el-button
  317. type="primary"
  318. class="action-btn primary"
  319. @click="resultDialogVisible = false"
  320. >
  321. 关闭
  322. </el-button>
  323. </div>
  324. </div>
  325. </template>
  326. </el-dialog>
  327. </div>
  328. </template>
  329. <script setup>
  330. import { ref, onMounted, computed } from 'vue';
  331. import { ElMessage } from 'element-plus';
  332. import { marked } from 'marked';
  333. import { API_BASE_URL } from "@/config";
  334. import dayjs from 'dayjs';
  335. // 响应式数据
  336. const historyList = ref([]);
  337. const loading = ref(false);
  338. const currentPage = ref(1);
  339. const pageSize = ref(10);
  340. const totalCount = ref(0);
  341. const totalPages = ref(0);
  342. const searchQuery = ref('');
  343. const expandedItems = ref([]);
  344. const resultDialogVisible = ref(false);
  345. const selectedResult = ref({});
  346. const originalContent = ref('');
  347. const activeTab = ref('summary');
  348. // 计算属性
  349. const filteredHistory = computed(() => {
  350. if (!searchQuery.value) {
  351. return historyList.value;
  352. }
  353. const query = searchQuery.value.toLowerCase();
  354. return historyList.value.filter(item =>
  355. item.query.toLowerCase().includes(query) ||
  356. (item.final_result && item.final_result.toLowerCase().includes(query)) ||
  357. (item.chat_res && item.chat_res.toLowerCase().includes(query)) ||
  358. (item.ai_answer && item.ai_answer.toLowerCase().includes(query))
  359. );
  360. });
  361. // 方法
  362. const parseMarkdown = (content) => {
  363. if (!content) return '';
  364. const markdownSymbols = /[#*+\-`>!]/;
  365. const isMarkdown = markdownSymbols.test(content);
  366. return isMarkdown ? marked(content) : content;
  367. };
  368. const formatTime = (timeString) => {
  369. try {
  370. // 处理 GMT 时间格式 "Tue, 30 Sep 2025 14:02:21 GMT"
  371. if (timeString.includes('GMT')) {
  372. // 使用 UTC 方法获取时间组件,避免时区转换
  373. const date = new Date(timeString);
  374. if (!isNaN(date.getTime())) {
  375. // 使用 UTC 相关的方法获取时间组件
  376. const year = date.getUTCFullYear();
  377. const month = String(date.getUTCMonth() + 1).padStart(2, '0');
  378. const day = String(date.getUTCDate()).padStart(2, '0');
  379. const hours = String(date.getUTCHours()).padStart(2, '0');
  380. const minutes = String(date.getUTCMinutes()).padStart(2, '0');
  381. const seconds = String(date.getUTCSeconds()).padStart(2, '0');
  382. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  383. }
  384. }
  385. // 对于其他格式,使用原来的逻辑
  386. const date = new Date(timeString);
  387. if (!isNaN(date.getTime())) {
  388. return date.toLocaleString('zh-CN', {
  389. year: 'numeric',
  390. month: '2-digit',
  391. day: '2-digit',
  392. hour: '2-digit',
  393. minute: '2-digit',
  394. second: '2-digit'
  395. });
  396. }
  397. console.warn('无法解析的时间格式:', timeString);
  398. return timeString;
  399. } catch (error) {
  400. console.error('时间格式化错误:', error);
  401. return timeString;
  402. }
  403. };
  404. const getScoreClass = (score) => {
  405. if (score >= 0.8) return 'high';
  406. if (score >= 0.6) return 'medium';
  407. return 'low';
  408. };
  409. const getSearchResults = (searchRes) => {
  410. try {
  411. return JSON.parse(searchRes) || [];
  412. } catch (error) {
  413. console.error('解析search_res失败:', error);
  414. return [];
  415. }
  416. };
  417. const getDisplayedResults = (item) => {
  418. const results = getSearchResults(item.search_res);
  419. if (item.isResultsExpanded) {
  420. return results;
  421. }
  422. return results.slice(0, 3);
  423. };
  424. const processHistoryItem = (item) => {
  425. // 确保所有字段都有值,如果没有则从其他字段获取
  426. return {
  427. ...item,
  428. final_result: item.final_result || item.chat_res || item.ai_answer || '',
  429. chat_res: item.chat_res || '',
  430. ai_answer: item.ai_answer || '',
  431. // 添加展开状态
  432. isResultsExpanded: false
  433. };
  434. };
  435. const toggleItemDetail = (item) => {
  436. const index = expandedItems.value.indexOf(item.create_time);
  437. if (index === -1) {
  438. expandedItems.value.push(item.create_time);
  439. } else {
  440. expandedItems.value.splice(index, 1);
  441. }
  442. };
  443. const toggleResultsExpansion = (item) => {
  444. item.isResultsExpanded = !item.isResultsExpanded;
  445. };
  446. const handleResultDetails = async (result) => {
  447. selectedResult.value = result;
  448. resultDialogVisible.value = true;
  449. activeTab.value = 'summary';
  450. try {
  451. const response = await fetch(`${API_BASE_URL}/content/get?docId=${result.docId}`);
  452. const data = await response.json();
  453. if (data.status_code === 200) {
  454. originalContent.value = data.data.text;
  455. } else {
  456. ElMessage.error('获取原文内容失败');
  457. }
  458. } catch (error) {
  459. ElMessage.error('请求原文内容失败');
  460. }
  461. };
  462. const copyToClipboard = async (text) => {
  463. try {
  464. await navigator.clipboard.writeText(text);
  465. ElMessage.success('已复制到剪贴板');
  466. } catch (err) {
  467. ElMessage.error('复制失败');
  468. }
  469. };
  470. const handleSearch = () => {
  471. currentPage.value = 1;
  472. };
  473. const handleSizeChange = (newSize) => {
  474. pageSize.value = newSize;
  475. currentPage.value = 1;
  476. fetchHistory();
  477. };
  478. const handleCurrentChange = (newPage) => {
  479. currentPage.value = newPage;
  480. fetchHistory();
  481. };
  482. const refreshData = () => {
  483. currentPage.value = 1;
  484. fetchHistory();
  485. };
  486. const fetchHistory = async () => {
  487. loading.value = true;
  488. try {
  489. const response = await fetch(
  490. `${API_BASE_URL}/chat/history?page=${currentPage.value}&pageSize=${pageSize.value}`
  491. );
  492. const data = await response.json();
  493. if (data.status_code === 200) {
  494. // 处理每个历史记录项,确保字段正确
  495. historyList.value = (data.data.entities || []).map(processHistoryItem);
  496. totalCount.value = data.data.total_count || 0;
  497. totalPages.value = data.data.total_pages || 0;
  498. } else {
  499. ElMessage.error('获取历史记录失败');
  500. }
  501. } catch (error) {
  502. ElMessage.error('请求失败,请稍后重试');
  503. console.error('Fetch history error:', error);
  504. } finally {
  505. loading.value = false;
  506. }
  507. };
  508. // 生命周期
  509. onMounted(() => {
  510. fetchHistory();
  511. });
  512. </script>
  513. <style scoped>
  514. /* 保持原有的所有样式不变 */
  515. .history-container {
  516. min-height: 100vh;
  517. background: linear-gradient(135deg, rgba(102, 126, 234, 0.81) 0%, rgba(118, 75, 162, 0.77) 100%);
  518. font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  519. }
  520. .history-header {
  521. background: rgba(255, 255, 255, 0.1);
  522. backdrop-filter: blur(20px);
  523. padding: 20px 0;
  524. border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  525. }
  526. .header-content {
  527. max-width: 1200px;
  528. margin: 0 auto;
  529. padding: 0 24px;
  530. display: flex;
  531. justify-content: space-between;
  532. align-items: center;
  533. }
  534. .header-main {
  535. flex: 1;
  536. }
  537. .history-title {
  538. color: white;
  539. font-size: 2.25rem;
  540. font-weight: 800;
  541. margin: 0;
  542. text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  543. background: linear-gradient(135deg, #fff 0%, #e2e8f0 100%);
  544. -webkit-background-clip: text;
  545. -webkit-text-fill-color: transparent;
  546. background-clip: text;
  547. }
  548. .history-subtitle {
  549. color: rgba(255, 255, 255, 0.8);
  550. font-size: 1rem;
  551. margin: 8px 0 0 0;
  552. font-weight: 500;
  553. }
  554. .header-actions {
  555. display: flex;
  556. gap: 12px;
  557. }
  558. .back-btn {
  559. background: rgba(255, 255, 255, 0.2);
  560. border: 1px solid rgba(255, 255, 255, 0.3);
  561. color: white;
  562. border-radius: 12px;
  563. padding: 10px 20px;
  564. font-weight: 600;
  565. transition: all 0.3s ease;
  566. backdrop-filter: blur(10px);
  567. }
  568. .back-btn:hover {
  569. background: rgba(255, 255, 255, 0.3);
  570. transform: translateY(-2px);
  571. box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
  572. }
  573. .history-content {
  574. max-width: 1200px;
  575. margin: 0 auto;
  576. padding: 24px;
  577. }
  578. .stats-cards {
  579. display: grid;
  580. grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  581. gap: 20px;
  582. margin-bottom: 24px;
  583. }
  584. .stat-card {
  585. background: white;
  586. border-radius: 16px;
  587. padding: 24px;
  588. display: flex;
  589. align-items: center;
  590. gap: 16px;
  591. box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  592. transition: transform 0.3s ease;
  593. }
  594. .stat-card:hover {
  595. transform: translateY(-4px);
  596. }
  597. .stat-icon {
  598. font-size: 2.5rem;
  599. width: 60px;
  600. height: 60px;
  601. display: flex;
  602. align-items: center;
  603. justify-content: center;
  604. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  605. border-radius: 12px;
  606. color: white;
  607. }
  608. .stat-info {
  609. flex: 1;
  610. }
  611. .stat-number {
  612. font-size: 2rem;
  613. font-weight: 800;
  614. color: #2d3748;
  615. line-height: 1;
  616. margin-bottom: 4px;
  617. }
  618. .stat-label {
  619. color: #718096;
  620. font-size: 0.9rem;
  621. font-weight: 600;
  622. }
  623. .filter-section {
  624. background: white;
  625. border-radius: 16px;
  626. padding: 20px;
  627. margin-bottom: 24px;
  628. box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  629. display: flex;
  630. gap: 16px;
  631. align-items: center;
  632. }
  633. .search-input {
  634. flex: 1;
  635. }
  636. .filter-actions {
  637. display: flex;
  638. gap: 12px;
  639. }
  640. .refresh-btn {
  641. border-radius: 12px;
  642. padding: 10px 20px;
  643. font-weight: 600;
  644. }
  645. .loading-section {
  646. background: white;
  647. border-radius: 16px;
  648. padding: 60px 32px;
  649. text-align: center;
  650. box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  651. }
  652. .loading-content {
  653. display: flex;
  654. flex-direction: column;
  655. align-items: center;
  656. gap: 16px;
  657. }
  658. .loading-spinner {
  659. width: 40px;
  660. height: 40px;
  661. border: 4px solid #e2e8f0;
  662. border-top: 4px solid #4299e1;
  663. border-radius: 50%;
  664. animation: spin 1s linear infinite;
  665. }
  666. @keyframes spin {
  667. 0% { transform: rotate(0deg); }
  668. 100% { transform: rotate(360deg); }
  669. }
  670. .history-list {
  671. display: flex;
  672. flex-direction: column;
  673. gap: 16px;
  674. }
  675. .empty-state {
  676. background: white;
  677. border-radius: 24px;
  678. padding: 80px 32px;
  679. text-align: center;
  680. box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  681. }
  682. .empty-content {
  683. max-width: 400px;
  684. margin: 0 auto;
  685. }
  686. .empty-icon {
  687. font-size: 4rem;
  688. margin-bottom: 20px;
  689. }
  690. .empty-state h3 {
  691. margin: 0 0 12px 0;
  692. color: #2d3748;
  693. font-size: 1.5rem;
  694. font-weight: 700;
  695. }
  696. .empty-state p {
  697. margin: 0 0 24px 0;
  698. color: #718096;
  699. font-size: 1rem;
  700. line-height: 1.5;
  701. }
  702. .go-home-btn {
  703. border-radius: 12px;
  704. padding: 12px 24px;
  705. font-weight: 600;
  706. }
  707. .history-items {
  708. display: flex;
  709. flex-direction: column;
  710. gap: 16px;
  711. }
  712. .history-item {
  713. background: white;
  714. border-radius: 16px;
  715. overflow: hidden;
  716. box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  717. transition: all 0.3s ease;
  718. border: 1px solid #e2e8f0;
  719. }
  720. .history-item:hover {
  721. box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  722. transform: translateY(-2px);
  723. }
  724. .item-header {
  725. padding: 24px;
  726. display: flex;
  727. justify-content: space-between;
  728. align-items: flex-start;
  729. gap: 16px;
  730. cursor: pointer;
  731. }
  732. .question-content {
  733. flex: 1;
  734. min-width: 0;
  735. }
  736. .question-title {
  737. margin: 0 0 12px 0;
  738. color: #2d3748;
  739. font-size: 1.1rem;
  740. font-weight: 600;
  741. line-height: 1.4;
  742. display: -webkit-box;
  743. -webkit-line-clamp: 2;
  744. -webkit-box-orient: vertical;
  745. overflow: hidden;
  746. }
  747. .question-meta {
  748. display: flex;
  749. gap: 16px;
  750. align-items: center;
  751. }
  752. .meta-item {
  753. display: flex;
  754. align-items: center;
  755. gap: 6px;
  756. color: #718096;
  757. font-size: 0.85rem;
  758. }
  759. .meta-icon {
  760. font-size: 0.8rem;
  761. }
  762. .item-actions {
  763. flex-shrink: 0;
  764. }
  765. .detail-btn {
  766. border-radius: 12px;
  767. padding: 8px 16px;
  768. font-weight: 600;
  769. transition: all 0.3s ease;
  770. }
  771. .detail-btn.active {
  772. background: #4299e1;
  773. color: white;
  774. }
  775. .item-detail {
  776. border-top: 1px solid #e2e8f0;
  777. padding: 0;
  778. }
  779. .detail-section {
  780. padding: 24px;
  781. border-bottom: 1px solid #f7fafc;
  782. }
  783. .detail-section:last-child {
  784. border-bottom: none;
  785. }
  786. .section-header {
  787. display: flex;
  788. align-items: center;
  789. gap: 12px;
  790. margin-bottom: 16px;
  791. }
  792. .section-icon {
  793. font-size: 1.5rem;
  794. width: 40px;
  795. height: 40px;
  796. display: flex;
  797. align-items: center;
  798. justify-content: center;
  799. background: #f7fafc;
  800. border-radius: 10px;
  801. }
  802. .section-header h4 {
  803. margin: 0;
  804. color: #2d3748;
  805. font-size: 1.1rem;
  806. font-weight: 600;
  807. flex: 1;
  808. }
  809. .result-count {
  810. background: #4299e1;
  811. color: white;
  812. padding: 4px 10px;
  813. border-radius: 12px;
  814. font-size: 0.8rem;
  815. font-weight: 600;
  816. }
  817. .section-content {
  818. color: #4a5568;
  819. line-height: 1.6;
  820. }
  821. .content-text {
  822. line-height: 1.7;
  823. }
  824. .content-text :deep(h1),
  825. .content-text :deep(h2),
  826. .content-text :deep(h3) {
  827. color: #2d3748;
  828. margin-top: 1.5em;
  829. margin-bottom: 0.5em;
  830. }
  831. .content-text :deep(p) {
  832. margin-bottom: 1em;
  833. }
  834. .content-text :deep(ul),
  835. .content-text :deep(ol) {
  836. margin: 1em 0;
  837. padding-left: 1.5em;
  838. }
  839. .content-text :deep(li) {
  840. margin-bottom: 0.5em;
  841. }
  842. .content-text :deep(code) {
  843. background: #f7fafc;
  844. padding: 2px 6px;
  845. border-radius: 4px;
  846. font-family: 'Monaco', 'Consolas', monospace;
  847. color: #e53e3e;
  848. font-size: 0.9em;
  849. }
  850. .content-text :deep(pre) {
  851. background: #2d3748;
  852. color: #e2e8f0;
  853. padding: 16px;
  854. border-radius: 8px;
  855. overflow-x: auto;
  856. margin: 1em 0;
  857. font-size: 0.9em;
  858. }
  859. .search-results-preview {
  860. display: flex;
  861. flex-direction: column;
  862. gap: 12px;
  863. }
  864. .result-preview {
  865. background: #f7fafc;
  866. border-radius: 12px;
  867. padding: 16px;
  868. border: 1px solid #e2e8f0;
  869. cursor: pointer;
  870. transition: all 0.3s ease;
  871. position: relative;
  872. }
  873. .result-preview:hover {
  874. transform: translateY(-2px);
  875. box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  876. border-color: #4299e1;
  877. }
  878. .result-header {
  879. display: flex;
  880. justify-content: space-between;
  881. align-items: center;
  882. margin-bottom: 8px;
  883. }
  884. .result-index {
  885. background: #4299e1;
  886. color: white;
  887. padding: 2px 8px;
  888. border-radius: 8px;
  889. font-size: 0.8rem;
  890. font-weight: 700;
  891. }
  892. .result-score {
  893. padding: 2px 8px;
  894. border-radius: 8px;
  895. font-size: 0.8rem;
  896. font-weight: 700;
  897. color: white;
  898. }
  899. .result-score.high {
  900. background: #48bb78;
  901. }
  902. .result-score.medium {
  903. background: #ed8936;
  904. }
  905. .result-score.low {
  906. background: #e53e3e;
  907. }
  908. .result-content {
  909. margin: 0 0 8px 0;
  910. color: #4a5568;
  911. font-size: 0.9rem;
  912. line-height: 1.5;
  913. }
  914. .result-source {
  915. background: #e2e8f0;
  916. color: #4a5568;
  917. padding: 2px 8px;
  918. border-radius: 8px;
  919. font-size: 0.8rem;
  920. margin-bottom: 8px;
  921. display: inline-block;
  922. }
  923. .result-footer {
  924. display: flex;
  925. justify-content: flex-end;
  926. margin-top: 8px;
  927. }
  928. .view-details {
  929. color: #4299e1;
  930. font-weight: 600;
  931. font-size: 0.9rem;
  932. transition: color 0.3s ease;
  933. display: flex;
  934. align-items: center;
  935. gap: 6px;
  936. }
  937. .view-icon {
  938. font-size: 0.8rem;
  939. }
  940. .result-preview:hover .view-details {
  941. color: #2b6cb0;
  942. }
  943. .more-results {
  944. text-align: center;
  945. padding: 12px;
  946. }
  947. .expand-btn {
  948. font-weight: 600;
  949. color: #4299e1;
  950. }
  951. .expand-btn:hover {
  952. color: #2b6cb0;
  953. }
  954. .pagination-section {
  955. background: white;
  956. border-radius: 16px;
  957. padding: 20px;
  958. margin-top: 24px;
  959. box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  960. display: flex;
  961. justify-content: center;
  962. }
  963. .history-pagination {
  964. margin: 0;
  965. }
  966. .btn-icon {
  967. margin-right: 6px;
  968. }
  969. /* 弹窗样式 - 从主页面复制并调整 */
  970. .content-dialog :deep(.el-dialog) {
  971. border-radius: 24px;
  972. overflow: hidden;
  973. box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
  974. }
  975. .content-dialog :deep(.el-dialog__header) {
  976. padding: 0;
  977. margin: 0;
  978. }
  979. .content-dialog :deep(.el-dialog__headerbtn) {
  980. top: 24px;
  981. right: 24px;
  982. width: 32px;
  983. height: 32px;
  984. border-radius: 8px;
  985. background: #f7fafc;
  986. }
  987. .content-dialog :deep(.el-dialog__headerbtn:hover) {
  988. background: #e2e8f0;
  989. }
  990. .dialog-header {
  991. padding: 0;
  992. }
  993. .dialog-title {
  994. display: flex;
  995. align-items: flex-start;
  996. gap: 16px;
  997. padding: 32px 32px 0;
  998. }
  999. .title-icon {
  1000. font-size: 2.5rem;
  1001. width: 60px;
  1002. height: 60px;
  1003. display: flex;
  1004. align-items: center;
  1005. justify-content: center;
  1006. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  1007. border-radius: 16px;
  1008. color: white;
  1009. flex-shrink: 0;
  1010. }
  1011. .title-content {
  1012. flex: 1;
  1013. min-width: 0;
  1014. }
  1015. .title-content h3 {
  1016. margin: 0 0 12px 0;
  1017. color: #2d3748;
  1018. font-size: 1.5rem;
  1019. font-weight: 700;
  1020. line-height: 1.4;
  1021. }
  1022. .title-meta {
  1023. display: flex;
  1024. gap: 12px;
  1025. flex-wrap: wrap;
  1026. }
  1027. .meta-badge {
  1028. display: flex;
  1029. align-items: center;
  1030. gap: 6px;
  1031. padding: 6px 12px;
  1032. border-radius: 12px;
  1033. font-size: 0.85rem;
  1034. font-weight: 500;
  1035. }
  1036. .knowledge-badge {
  1037. background: #ebf8ff;
  1038. color: #2b6cb0;
  1039. border: 1px solid #bee3f8;
  1040. }
  1041. .score-badge.high {
  1042. background: #f0fff4;
  1043. color: #2f855a;
  1044. border: 1px solid #c6f6d5;
  1045. }
  1046. .score-badge.medium {
  1047. background: #fffaf0;
  1048. color: #c05621;
  1049. border: 1px solid #feebc8;
  1050. }
  1051. .score-badge.low {
  1052. background: #fff5f5;
  1053. color: #c53030;
  1054. border: 1px solid #fed7d7;
  1055. }
  1056. .badge-icon {
  1057. font-size: 0.8rem;
  1058. }
  1059. .dialog-content {
  1060. padding: 0;
  1061. }
  1062. .content-tabs {
  1063. display: flex;
  1064. padding: 0 32px;
  1065. border-bottom: 1px solid #e2e8f0;
  1066. margin-top: 24px;
  1067. }
  1068. .tab-item {
  1069. display: flex;
  1070. align-items: center;
  1071. gap: 8px;
  1072. padding: 12px 20px;
  1073. cursor: pointer;
  1074. border-bottom: 2px solid transparent;
  1075. color: #718096;
  1076. font-weight: 500;
  1077. transition: all 0.3s ease;
  1078. }
  1079. .tab-item:hover {
  1080. color: #4299e1;
  1081. }
  1082. .tab-item.active {
  1083. color: #4299e1;
  1084. border-bottom-color: #4299e1;
  1085. }
  1086. .tab-icon {
  1087. font-size: 1.1rem;
  1088. }
  1089. .tab-content {
  1090. padding: 0 32px 32px;
  1091. }
  1092. .content-section {
  1093. margin-top: 24px;
  1094. }
  1095. .section-header {
  1096. display: flex;
  1097. justify-content: space-between;
  1098. align-items: center;
  1099. margin-bottom: 16px;
  1100. }
  1101. .section-header h4 {
  1102. margin: 0;
  1103. color: #2d3748;
  1104. font-size: 1.2rem;
  1105. font-weight: 600;
  1106. }
  1107. .copy-btn {
  1108. font-size: 0.9rem;
  1109. padding: 6px 12px;
  1110. border-radius: 8px;
  1111. }
  1112. .summary-content {
  1113. background: #f7fafc;
  1114. padding: 20px;
  1115. border-radius: 12px;
  1116. color: #4a5568;
  1117. line-height: 1.6;
  1118. font-size: 0.95rem;
  1119. border: 1px solid #e2e8f0;
  1120. }
  1121. .original-content {
  1122. background: #f7fafc;
  1123. border-radius: 12px;
  1124. border: 1px solid #e2e8f0;
  1125. max-height: 500px;
  1126. overflow-y: auto;
  1127. }
  1128. .original-content pre {
  1129. margin: 0;
  1130. padding: 20px;
  1131. color: #4a5568;
  1132. line-height: 1.6;
  1133. font-size: 0.9rem;
  1134. white-space: pre-wrap;
  1135. word-wrap: break-word;
  1136. }
  1137. .dialog-footer {
  1138. padding: 0 32px 24px;
  1139. }
  1140. .footer-actions {
  1141. display: flex;
  1142. justify-content: flex-end;
  1143. gap: 12px;
  1144. }
  1145. .action-btn {
  1146. border-radius: 12px;
  1147. padding: 10px 24px;
  1148. font-weight: 500;
  1149. transition: all 0.3s ease;
  1150. }
  1151. .action-btn.secondary {
  1152. border: 1px solid #e2e8f0;
  1153. background: white;
  1154. color: #718096;
  1155. }
  1156. .action-btn.secondary:hover {
  1157. background: #f7fafc;
  1158. border-color: #cbd5e0;
  1159. }
  1160. .action-btn.primary {
  1161. background: #4299e1;
  1162. border: 1px solid #4299e1;
  1163. color: white;
  1164. }
  1165. .action-btn.primary:hover {
  1166. background: #3182ce;
  1167. border-color: #3182ce;
  1168. transform: translateY(-1px);
  1169. box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
  1170. }
  1171. /* 响应式设计 */
  1172. @media (max-width: 768px) {
  1173. .header-content {
  1174. flex-direction: column;
  1175. gap: 16px;
  1176. text-align: center;
  1177. }
  1178. .history-title {
  1179. font-size: 1.75rem;
  1180. }
  1181. .history-content {
  1182. padding: 16px;
  1183. }
  1184. .stats-cards {
  1185. grid-template-columns: 1fr;
  1186. }
  1187. .filter-section {
  1188. flex-direction: column;
  1189. align-items: stretch;
  1190. }
  1191. .item-header {
  1192. flex-direction: column;
  1193. align-items: stretch;
  1194. gap: 12px;
  1195. }
  1196. .item-actions {
  1197. align-self: flex-end;
  1198. }
  1199. .section-header {
  1200. flex-direction: column;
  1201. align-items: flex-start;
  1202. gap: 8px;
  1203. }
  1204. .content-dialog :deep(.el-dialog) {
  1205. width: 95% !important;
  1206. margin: 20px auto;
  1207. }
  1208. }
  1209. </style>