当前位置: 首页 > news >正文

TripGenie:畅游济南旅行规划助手:个人工作纪实(二十二)

      这周,我进行了历史记录的设计与制作,我对于每一个用户与智能体交互得出的历史行程的数据进行了存储与可视化展示。

      首先,我设置了一个csv文件存储每一个得出的行程规划,注意这里的地图我设置了一个全路径进行存储,这样可以保证url路径可以被可视化到前端页面。csv文件中的标题为data、itinerary、mappath灯,存储相应的行程规划信息。

      在js文件中,我从后端获取存入的csv文件,并且对文件内容进行了切分。

      这里我对行程规划得到的行程规划、总体理由、行程设计进行展示,同时我设置了一个iframe框架来展示地图。

 try {// 尝试解析 Itinerary 字段中的 JSON 数据const itineraryInfo = JSON.parse(record.fullContent.replace(/'/g, '"'));// 提取行程规划const itineraryParts = itineraryInfo.itinerary || '行程规划信息暂无';// 提取总体理由const reasonParts = itineraryInfo['总体理由'] || '总体理由暂无';// 提取景点详细描述并格式化let poisHtml = '<div><strong>详细景点描述:</strong></div>';if (itineraryInfo.pois && typeof itineraryInfo.pois === 'object') {for (const key in itineraryInfo.pois) {poisHtml += `<div>${itineraryInfo.pois[key]}</div>`;}} else {poisHtml += '<div>景点描述暂无</div>';}// 创建历史记录卡片const historyCard = document.createElement('div');historyCard.className = 'history-card';historyCard.innerHTML = `<div class="history-card-header"><h3>${record.title}</h3></div><div class="history-card-body"><div class="history-date">${record.date}</div><div class="history-summary">${itineraryParts}</div><button class="history-toggle" onclick="toggleHistoryDetails(${record.id})"><i class="fas fa-chevron-down"></i> 查看详情</button><div class="history-details" id="details-${record.id}" style="display: none;"><div class="history-full-content"><div><strong>行程规划:</strong>${itineraryParts}</div>${poisHtml}<div><strong>总体理由:</strong>${reasonParts}</div></div><iframe class="history-map" src="${record.mapUrl}" frameborder="0"></iframe></div></div>`;historyCardsContainer.appendChild(historyCard);} catch (e) {console.error('解析历史记录失败:', e);// 如果解析失败,仍然显示基本的历史记录卡片const historyCard = document.createElement('div');historyCard.className = 'history-card';historyCard.innerHTML = `<div class="history-card-header"><h3>${record.title}</h3></div><div class="history-card-body"><div class="history-date">${record.date}</div><div class="history-summary">行程规划信息暂无</div><button class="history-toggle" onclick="toggleHistoryDetails(${record.id})"><i class="fas fa-chevron-down"></i> 查看详情</button><div class="history-details" id="details-${record.id}" style="display: none;"><div class="history-full-content"><div>行程规划:暂无详细信息</div><div>详细景点描述:暂无详细信息</div><div>总体理由:暂无详细信息</div></div><iframe class="history-map" src="${record.mapUrl}" frameborder="0"></iframe></div></div>`;historyCardsContainer.appendChild(historyCard);}

最终效果如下:


文章转载自:

http://uURllqV6.mpbgy.cn
http://t8cr1Ai4.mpbgy.cn
http://8MEP2t8J.mpbgy.cn
http://vz84380u.mpbgy.cn
http://cq4Ib7i9.mpbgy.cn
http://rMwRO1k9.mpbgy.cn
http://6Mla4C0y.mpbgy.cn
http://kVD8Bh0l.mpbgy.cn
http://T0Kg2WTp.mpbgy.cn
http://TM4yLAAZ.mpbgy.cn
http://JHRPjeZO.mpbgy.cn
http://BKyQIAlT.mpbgy.cn
http://nyFzrnCy.mpbgy.cn
http://WP8F4FEI.mpbgy.cn
http://8AZrfyYY.mpbgy.cn
http://2afvUTri.mpbgy.cn
http://cEyWiLPi.mpbgy.cn
http://Ci42CcXo.mpbgy.cn
http://dO9J9jSr.mpbgy.cn
http://CjqpUnMA.mpbgy.cn
http://ZFbXmutc.mpbgy.cn
http://40f59fi0.mpbgy.cn
http://4tUQUifS.mpbgy.cn
http://1gxXKGL3.mpbgy.cn
http://uMLxSBMW.mpbgy.cn
http://fa89xGTy.mpbgy.cn
http://QvWs4puz.mpbgy.cn
http://qZJ0560o.mpbgy.cn
http://LIfUFLBz.mpbgy.cn
http://nnDxrKBT.mpbgy.cn
http://www.dtcms.com/a/236305.html

相关文章:

  • Linux(13)——Ext系列文件系统
  • 1.5 Node.js 的 HTTP
  • 纳米AI搜索与百度AI搜、豆包的核心差异解析
  • Faiss向量数据库全面解析:从原理到实战
  • Linux(14)——库的制作与原理
  • ASTRA论文总结
  • 【Linux】系统部分——进程控制
  • npm安装electron下载太慢,导致报错
  • Spark 之 AQE
  • 关于脏读,幻读,可重复读的学习
  • SDC命令详解:使用set_port_fanout_number命令进行约束
  • Swift 协议扩展精进之路:解决 CoreData 托管实体子类的类型不匹配问题(上)
  • pycharm 中文字体报错
  • PyCharm集成Conda环境
  • Doris 与 Elasticsearch:谁更适合你的数据分析需求?
  • 【Java学习笔记】String类(重点)
  • 从零开始搭建 Pytest 测试框架(Python 3.8 + PyCharm 版)
  • Android Studio 解决首次安装时下载 Gradle 慢问题
  • 【数据分析】探索婴儿年龄变化对微生物群落(呼吸道病毒和细菌病原体)结构的影响
  • 使用 C/C++ 和 OpenCV 提取图像的感兴趣区域 (ROI)
  • 游戏(game)
  • Mybatis-Plus的LambdaWrapper
  • Python_day47
  • 华为云Flexus+DeepSeek征文 | 从零到一:用Flexus云服务打造低延迟联网搜索Agent
  • Python入门手册:异常处理
  • 微前端 - Native Federation使用完整示例
  • JavaWeb的一些基础技术
  • Jenkins持续集成CI,持续部署CD,Allure报告集成以及发送电子 邮件
  • 前沿论文汇总(机器学习/深度学习/大模型/搜广推/自然语言处理)
  • EPPLUS——CAD c#读写EXCEL的第三方库