一键配置DeepSeek.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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.0">
  6. <title>一键配置 DeepSeek AI</title>
  7. <style>
  8. * {
  9. margin: 0;
  10. padding: 0;
  11. box-sizing: border-box;
  12. }
  13. body {
  14. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  15. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  16. min-height: 100vh;
  17. display: flex;
  18. justify-content: center;
  19. align-items: center;
  20. padding: 20px;
  21. }
  22. .container {
  23. background: white;
  24. border-radius: 20px;
  25. padding: 40px;
  26. box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  27. max-width: 600px;
  28. width: 100%;
  29. text-align: center;
  30. }
  31. h1 {
  32. color: #333;
  33. margin-bottom: 10px;
  34. font-size: 32px;
  35. }
  36. .subtitle {
  37. color: #666;
  38. margin-bottom: 30px;
  39. font-size: 16px;
  40. }
  41. .api-key-box {
  42. background: #f7f7f7;
  43. border: 2px solid #e0e0e0;
  44. border-radius: 10px;
  45. padding: 20px;
  46. margin: 20px 0;
  47. word-break: break-all;
  48. font-family: 'Courier New', monospace;
  49. font-size: 14px;
  50. color: #333;
  51. }
  52. .status {
  53. margin: 20px 0;
  54. padding: 15px;
  55. border-radius: 10px;
  56. font-size: 16px;
  57. display: none;
  58. }
  59. .status.success {
  60. background: #d4edda;
  61. border: 1px solid #c3e6cb;
  62. color: #155724;
  63. display: block;
  64. }
  65. .status.error {
  66. background: #f8d7da;
  67. border: 1px solid #f5c6cb;
  68. color: #721c24;
  69. display: block;
  70. }
  71. .status.info {
  72. background: #d1ecf1;
  73. border: 1px solid #bee5eb;
  74. color: #0c5460;
  75. display: block;
  76. }
  77. .btn {
  78. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  79. color: white;
  80. border: none;
  81. padding: 15px 40px;
  82. font-size: 18px;
  83. border-radius: 50px;
  84. cursor: pointer;
  85. transition: all 0.3s ease;
  86. margin: 10px;
  87. box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  88. }
  89. .btn:hover {
  90. transform: translateY(-2px);
  91. box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  92. }
  93. .btn:active {
  94. transform: translateY(0);
  95. }
  96. .btn.secondary {
  97. background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  98. }
  99. .btn.tertiary {
  100. background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  101. }
  102. .icon {
  103. font-size: 64px;
  104. margin-bottom: 20px;
  105. }
  106. .steps {
  107. text-align: left;
  108. margin: 30px 0;
  109. padding: 20px;
  110. background: #f9f9f9;
  111. border-radius: 10px;
  112. }
  113. .steps h3 {
  114. color: #667eea;
  115. margin-bottom: 15px;
  116. }
  117. .steps ol {
  118. margin-left: 20px;
  119. }
  120. .steps li {
  121. margin: 10px 0;
  122. color: #555;
  123. line-height: 1.6;
  124. }
  125. .feature {
  126. display: inline-block;
  127. margin: 10px;
  128. padding: 10px 20px;
  129. background: #e8f4f8;
  130. border-radius: 20px;
  131. color: #0c5460;
  132. font-size: 14px;
  133. }
  134. </style>
  135. </head>
  136. <body>
  137. <div class="container">
  138. <div class="icon">🤖</div>
  139. <h1>DeepSeek AI 一键配置</h1>
  140. <p class="subtitle">让您的 AI 运营助手立即拥有真实的智能对话能力</p>
  141. <div class="api-key-box">
  142. <strong>您的 API Key:</strong><br>
  143. sk-3ae5d07978a54d369b8e9fb9bc944e78
  144. </div>
  145. <div id="status" class="status"></div>
  146. <button class="btn" onclick="configureAPI()">
  147. 🔑 一键配置 API Key
  148. </button>
  149. <button class="btn secondary" onclick="goToAIAssistant()">
  150. 🚀 打开 AI 助手
  151. </button>
  152. <button class="btn tertiary" onclick="checkStatus()">
  153. 🔍 检查配置状态
  154. </button>
  155. <div class="steps">
  156. <h3>📋 使用步骤</h3>
  157. <ol>
  158. <li>确保开发服务器已启动(<code>ng serve</code>)</li>
  159. <li>点击 "一键配置 API Key" 按钮</li>
  160. <li>点击 "打开 AI 助手" 访问页面</li>
  161. <li>开始使用真实的 AI 对话功能!</li>
  162. </ol>
  163. </div>
  164. <div style="margin-top: 20px;">
  165. <div class="feature">✅ 真实 AI 对话</div>
  166. <div class="feature">✅ 上下文理解</div>
  167. <div class="feature">✅ 专业建议</div>
  168. <div class="feature">✅ 智能分析</div>
  169. </div>
  170. </div>
  171. <script>
  172. const API_KEY = 'sk-3ae5d07978a54d369b8e9fb9bc944e78';
  173. const AI_ASSISTANT_URL = 'http://localhost:4200/business/ai-operations-assistant';
  174. function showStatus(message, type) {
  175. const statusDiv = document.getElementById('status');
  176. statusDiv.className = 'status ' + type;
  177. statusDiv.innerHTML = message;
  178. }
  179. function configureAPI() {
  180. try {
  181. // 保存 API Key 到 localStorage
  182. localStorage.setItem('deepseek_api_key', API_KEY);
  183. // 验证保存是否成功
  184. const savedKey = localStorage.getItem('deepseek_api_key');
  185. if (savedKey === API_KEY) {
  186. showStatus('✅ 配置成功!API Key 已保存<br>现在可以访问 AI 助手页面了', 'success');
  187. // 3秒后自动跳转
  188. setTimeout(() => {
  189. if (confirm('配置成功!是否立即跳转到 AI 助手页面?')) {
  190. goToAIAssistant();
  191. }
  192. }, 1000);
  193. } else {
  194. showStatus('❌ 配置失败:保存验证失败,请重试', 'error');
  195. }
  196. } catch (error) {
  197. showStatus('❌ 配置失败:' + error.message, 'error');
  198. }
  199. }
  200. function goToAIAssistant() {
  201. // 检查是否已配置
  202. const apiKey = localStorage.getItem('deepseek_api_key');
  203. if (!apiKey) {
  204. showStatus('⚠️ 请先配置 API Key', 'error');
  205. return;
  206. }
  207. // 打开 AI 助手页面
  208. window.open(AI_ASSISTANT_URL, '_blank');
  209. showStatus('✅ 正在打开 AI 助手页面...', 'success');
  210. }
  211. function checkStatus() {
  212. const apiKey = localStorage.getItem('deepseek_api_key');
  213. if (apiKey) {
  214. const maskedKey = apiKey.substring(0, 8) + '...' + apiKey.substring(apiKey.length - 8);
  215. showStatus(
  216. `✅ API Key 已配置<br>` +
  217. `<strong>Key:</strong> ${maskedKey}<br>` +
  218. `<strong>状态:</strong> 已激活<br>` +
  219. `<strong>访问地址:</strong> <a href="${AI_ASSISTANT_URL}" target="_blank">${AI_ASSISTANT_URL}</a>`,
  220. 'success'
  221. );
  222. } else {
  223. showStatus(
  224. '⚠️ API Key 未配置<br>' +
  225. '请点击 "一键配置 API Key" 按钮进行配置',
  226. 'info'
  227. );
  228. }
  229. }
  230. // 页面加载时自动检查状态
  231. window.onload = function() {
  232. checkStatus();
  233. };
  234. </script>
  235. </body>
  236. </html>