index.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
  6. <title>健康助手</title>
  7. <link rel="stylesheet" href="style.css">
  8. </head>
  9. <body class="app">
  10. <header class="app-header">
  11. <h1 class="app-title">健康助手</h1>
  12. <p class="app-subtitle">档案分析与饮食建议</p>
  13. </header>
  14. <section class="card user-strip" aria-label="用户">
  15. <span class="field-label">用户 ID</span>
  16. <input type="text" id="userId" placeholder="例如 mobile_13800000000 或 demo-alice" autocomplete="username" />
  17. <label class="tech-toggle">
  18. <input type="checkbox" id="devModeToggle" />
  19. 开发者模式(内部编号、Agent 全名、轨迹与原始 JSON)
  20. </label>
  21. </section>
  22. <nav class="tab-segment" role="tablist" aria-label="主功能">
  23. <button type="button" role="tab" id="tabBtn-analysis" aria-selected="true" aria-controls="tab-analysis" data-tab="analysis">档案分析</button>
  24. <button type="button" role="tab" id="tabBtn-diet" aria-selected="false" aria-controls="tab-diet" data-tab="diet">饮食助手</button>
  25. <button type="button" role="tab" id="tabBtn-history" aria-selected="false" aria-controls="tab-history" data-tab="history">历史记录</button>
  26. </nav>
  27. <!-- Tab:档案分析 -->
  28. <div id="tab-analysis" class="tab-panel" role="tabpanel" aria-labelledby="tabBtn-analysis">
  29. <div class="card">
  30. <h2>体检报告</h2>
  31. <p class="section-lead">粘贴文本或上传 PDF,生成结构化解读与建议。</p>
  32. <div class="flex-row">
  33. <div class="flex-column">
  34. <span class="field-label-inline">文本</span>
  35. <textarea id="reportText" placeholder="在此粘贴体检报告内容…"></textarea>
  36. <button type="button" class="btn btn-primary" onclick="analyze()">分析文本报告</button>
  37. </div>
  38. <div class="flex-column">
  39. <span class="field-label-inline">PDF 文件</span>
  40. <input type="file" id="pdfFile" accept=".pdf" />
  41. <button type="button" class="btn btn-primary" onclick="uploadPDF()">分析 PDF 报告</button>
  42. </div>
  43. </div>
  44. <div id="analysis"></div>
  45. <ul id="progressList" class="hidden"></ul>
  46. </div>
  47. <div id="resultCard" class="card hidden">
  48. <h2>分析摘要</h2>
  49. <div id="report"></div>
  50. </div>
  51. </div>
  52. <!-- Tab:饮食助手 -->
  53. <div id="tab-diet" class="tab-panel hidden" role="tabpanel" aria-labelledby="tabBtn-diet">
  54. <div class="card" id="dietCard">
  55. <h2>饮食推荐</h2>
  56. <p class="section-lead">先填写「今天吃了什么」,系统会解析营养并生成下一餐可执行建议;你的反馈会纳入后续推荐。</p>
  57. <div class="diet-grid">
  58. <label>健康目标
  59. <select id="dietGoal">
  60. <option value="muscle_gain">增肌</option>
  61. <option value="fat_loss">减脂</option>
  62. <option value="maintain">维持</option>
  63. </select>
  64. </label>
  65. </div>
  66. <label class="field-label-inline" style="margin-top: 16px;">今天吃了什么(必填)</label>
  67. <textarea id="dietFoodLog" rows="4" placeholder="例如:早餐豆浆300ml+鸡蛋2个;午餐鸡腿饭;下午拿铁;晚餐前香蕉1根"></textarea>
  68. <label class="field-label-inline" style="margin-top: 12px;">运动/睡眠情况</label>
  69. <input type="text" id="dietActivityContext" placeholder="例如:今晚力量训练60分钟,昨晚睡眠6.5小时" />
  70. <label class="field-label-inline" style="margin-top: 12px;">补充说明</label>
  71. <textarea id="dietNotes" rows="3" placeholder="例如:只能便利店、训练后 1 小时内要吃上"></textarea>
  72. <div class="btn-row">
  73. <button type="button" class="btn btn-primary" onclick="recommendDiet()">生成饮食推荐</button>
  74. </div>
  75. <div id="dietStatus"></div>
  76. <div id="dietResult" class="hidden"></div>
  77. <div class="card-hr" role="presentation"></div>
  78. <h3 id="feedbackSectionTitle">反馈执行情况</h3>
  79. <p class="section-lead">告诉系统你是否按<strong>某一次</strong>推荐执行、原因是什么;下次生成推荐时会参考。列表来自你的历史推荐,不必手抄编号。</p>
  80. <label class="field-label-inline">要为哪一条推荐写反馈?</label>
  81. <div class="reflect-run-row">
  82. <select id="reflectRunSelect" aria-describedby="reflectRunHint"></select>
  83. <button type="button" class="btn btn-secondary btn-compact" onclick="refreshReflectRunOptions()">刷新列表</button>
  84. </div>
  85. <span id="reflectRunHint" class="field-hint">生成推荐后会自动出现在列表中;刚生成完也可点「刷新列表」。</span>
  86. <fieldset class="reflect-follow-fieldset" style="margin-top: 16px;">
  87. <legend class="field-label-inline">是否按这条推荐执行?</legend>
  88. <label class="radio-row">
  89. <input type="radio" name="reflectFollowedChoice" value="yes" id="reflectFollowedYes" />
  90. 是,已尽量按推荐吃
  91. </label>
  92. <label class="radio-row">
  93. <input type="radio" name="reflectFollowedChoice" value="no" id="reflectFollowedNo" />
  94. 否,没有完全按推荐做
  95. </label>
  96. </fieldset>
  97. <div id="reflectReasonBlock" class="reflect-reason-block hidden">
  98. <label class="field-label-inline" for="reflectReasonCode">未执行的主要原因</label>
  99. <select id="reflectReasonCode">
  100. <option value="">请选择</option>
  101. <option value="cant_buy">买不到</option>
  102. <option value="too_late">太晚/闭店</option>
  103. <option value="dont_want">不想吃</option>
  104. <option value="other">其他</option>
  105. </select>
  106. <label class="field-label-inline" style="margin-top: 10px;">补充说明</label>
  107. <input type="text" id="reflectDetail" placeholder="可选,例如具体缺货商品" />
  108. </div>
  109. <div class="btn-row">
  110. <button type="button" class="btn btn-primary" onclick="submitDietReflect()">保存反馈</button>
  111. </div>
  112. </div>
  113. </div>
  114. <!-- Tab:历史记录 -->
  115. <div id="tab-history" class="tab-panel hidden" role="tabpanel" aria-labelledby="tabBtn-history">
  116. <div class="card">
  117. <h2>历史记录</h2>
  118. <p class="section-lead">饮食推荐与反馈摘要;原始 JSON 仅在「开发者模式」下展示。</p>
  119. <div class="btn-row">
  120. <button type="button" class="btn btn-secondary" onclick="loadDietHistory()">刷新</button>
  121. </div>
  122. <p id="historySummary" class="history-summary hidden" aria-live="polite"></p>
  123. <details id="historyRawDetails" class="history-raw hidden">
  124. <summary>原始数据(JSON)</summary>
  125. <pre id="dietHistoryPre"></pre>
  126. </details>
  127. <p id="historyEmptyHint" class="history-placeholder">点击「刷新」加载数据。</p>
  128. </div>
  129. </div>
  130. <dialog id="reflectPromptDialog" class="app-dialog" aria-labelledby="reflectDialogTitle">
  131. <h2 id="reflectDialogTitle" class="dialog-title">推荐已保存</h2>
  132. <p class="dialog-body">是否现在填写执行情况?(可选,帮助下次推荐更贴合你。)</p>
  133. <div class="btn-row dialog-actions">
  134. <button type="button" class="btn btn-primary" id="reflectDialogGo">填写反馈</button>
  135. <button type="button" class="btn btn-secondary" id="reflectDialogLater">稍后</button>
  136. </div>
  137. </dialog>
  138. <script src="app.js"></script>
  139. </body>
  140. </html>