| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>一键配置 DeepSeek AI</title>
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- body {
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- min-height: 100vh;
- display: flex;
- justify-content: center;
- align-items: center;
- padding: 20px;
- }
- .container {
- background: white;
- border-radius: 20px;
- padding: 40px;
- box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
- max-width: 600px;
- width: 100%;
- text-align: center;
- }
- h1 {
- color: #333;
- margin-bottom: 10px;
- font-size: 32px;
- }
- .subtitle {
- color: #666;
- margin-bottom: 30px;
- font-size: 16px;
- }
- .api-key-box {
- background: #f7f7f7;
- border: 2px solid #e0e0e0;
- border-radius: 10px;
- padding: 20px;
- margin: 20px 0;
- word-break: break-all;
- font-family: 'Courier New', monospace;
- font-size: 14px;
- color: #333;
- }
- .status {
- margin: 20px 0;
- padding: 15px;
- border-radius: 10px;
- font-size: 16px;
- display: none;
- }
- .status.success {
- background: #d4edda;
- border: 1px solid #c3e6cb;
- color: #155724;
- display: block;
- }
- .status.error {
- background: #f8d7da;
- border: 1px solid #f5c6cb;
- color: #721c24;
- display: block;
- }
- .status.info {
- background: #d1ecf1;
- border: 1px solid #bee5eb;
- color: #0c5460;
- display: block;
- }
- .btn {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- color: white;
- border: none;
- padding: 15px 40px;
- font-size: 18px;
- border-radius: 50px;
- cursor: pointer;
- transition: all 0.3s ease;
- margin: 10px;
- box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
- }
- .btn:hover {
- transform: translateY(-2px);
- box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
- }
- .btn:active {
- transform: translateY(0);
- }
- .btn.secondary {
- background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
- }
- .btn.tertiary {
- background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
- }
- .icon {
- font-size: 64px;
- margin-bottom: 20px;
- }
- .steps {
- text-align: left;
- margin: 30px 0;
- padding: 20px;
- background: #f9f9f9;
- border-radius: 10px;
- }
- .steps h3 {
- color: #667eea;
- margin-bottom: 15px;
- }
- .steps ol {
- margin-left: 20px;
- }
- .steps li {
- margin: 10px 0;
- color: #555;
- line-height: 1.6;
- }
- .feature {
- display: inline-block;
- margin: 10px;
- padding: 10px 20px;
- background: #e8f4f8;
- border-radius: 20px;
- color: #0c5460;
- font-size: 14px;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <div class="icon">🤖</div>
- <h1>DeepSeek AI 一键配置</h1>
- <p class="subtitle">让您的 AI 运营助手立即拥有真实的智能对话能力</p>
- <div class="api-key-box">
- <strong>您的 API Key:</strong><br>
- sk-3ae5d07978a54d369b8e9fb9bc944e78
- </div>
- <div id="status" class="status"></div>
- <button class="btn" onclick="configureAPI()">
- 🔑 一键配置 API Key
- </button>
- <button class="btn secondary" onclick="goToAIAssistant()">
- 🚀 打开 AI 助手
- </button>
- <button class="btn tertiary" onclick="checkStatus()">
- 🔍 检查配置状态
- </button>
- <div class="steps">
- <h3>📋 使用步骤</h3>
- <ol>
- <li>确保开发服务器已启动(<code>ng serve</code>)</li>
- <li>点击 "一键配置 API Key" 按钮</li>
- <li>点击 "打开 AI 助手" 访问页面</li>
- <li>开始使用真实的 AI 对话功能!</li>
- </ol>
- </div>
- <div style="margin-top: 20px;">
- <div class="feature">✅ 真实 AI 对话</div>
- <div class="feature">✅ 上下文理解</div>
- <div class="feature">✅ 专业建议</div>
- <div class="feature">✅ 智能分析</div>
- </div>
- </div>
- <script>
- const API_KEY = 'sk-3ae5d07978a54d369b8e9fb9bc944e78';
- const AI_ASSISTANT_URL = 'http://localhost:4200/business/ai-operations-assistant';
- function showStatus(message, type) {
- const statusDiv = document.getElementById('status');
- statusDiv.className = 'status ' + type;
- statusDiv.innerHTML = message;
- }
- function configureAPI() {
- try {
- // 保存 API Key 到 localStorage
- localStorage.setItem('deepseek_api_key', API_KEY);
-
- // 验证保存是否成功
- const savedKey = localStorage.getItem('deepseek_api_key');
-
- if (savedKey === API_KEY) {
- showStatus('✅ 配置成功!API Key 已保存<br>现在可以访问 AI 助手页面了', 'success');
-
- // 3秒后自动跳转
- setTimeout(() => {
- if (confirm('配置成功!是否立即跳转到 AI 助手页面?')) {
- goToAIAssistant();
- }
- }, 1000);
- } else {
- showStatus('❌ 配置失败:保存验证失败,请重试', 'error');
- }
- } catch (error) {
- showStatus('❌ 配置失败:' + error.message, 'error');
- }
- }
- function goToAIAssistant() {
- // 检查是否已配置
- const apiKey = localStorage.getItem('deepseek_api_key');
-
- if (!apiKey) {
- showStatus('⚠️ 请先配置 API Key', 'error');
- return;
- }
-
- // 打开 AI 助手页面
- window.open(AI_ASSISTANT_URL, '_blank');
- showStatus('✅ 正在打开 AI 助手页面...', 'success');
- }
- function checkStatus() {
- const apiKey = localStorage.getItem('deepseek_api_key');
-
- if (apiKey) {
- const maskedKey = apiKey.substring(0, 8) + '...' + apiKey.substring(apiKey.length - 8);
- showStatus(
- `✅ API Key 已配置<br>` +
- `<strong>Key:</strong> ${maskedKey}<br>` +
- `<strong>状态:</strong> 已激活<br>` +
- `<strong>访问地址:</strong> <a href="${AI_ASSISTANT_URL}" target="_blank">${AI_ASSISTANT_URL}</a>`,
- 'success'
- );
- } else {
- showStatus(
- '⚠️ API Key 未配置<br>' +
- '请点击 "一键配置 API Key" 按钮进行配置',
- 'info'
- );
- }
- }
- // 页面加载时自动检查状态
- window.onload = function() {
- checkStatus();
- };
- </script>
- </body>
- </html>
|