```json
{
"summary": "已创建一个AI SEO检测按钮组件,点击后会分析页面标题、URL和内容,并提供优化建议。按钮设计现代化,包含加载状态和结果展示区域。",
"widget": {
"type": "custom-template",
"isAPI": false,
"fullWidth": false,
"html": "<div class=\"container mx-auto px-4 py-8\">\n <div class=\"bg-white rounded-xl shadow-lg p-6 border border-gray-100\">\n <h3 class=\"text-xl font-semibold text-gray-800 mb-4\">SEO 优化分析</h3>\n <p class=\"text-gray-600 mb-6\">点击下方按钮,AI将分析您页面的标题、URL和内容,并提供专业优化建议</p>\n \n <button id=\"aiSeoBtn\" class=\"w-full md:w-auto bg-blue-600 hover:bg-blue-700 text-white font-medium py-3 px-6 rounded-lg transition-colors duration-200 flex items-center justify-center gap-2\">\n <svg class=\"w-5 h-5\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M13 10V3L4 14h7v7l9-11h-7z\"></path>\n </svg>\n <span>AI SEO 检测</span>\n </button>\n \n <div id=\"loadingIndicator\" class=\"hidden mt-6\">\n <div class=\"flex items-center justify-center\">\n <div class=\"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600\"></div>\n <span class=\"ml-3 text-gray-700\">AI正在分析中,请稍候...</span>\n </div>\n </div>\n \n <div id=\"resultsContainer\" class=\"hidden mt-6 p-5 bg-gray-50 rounded-lg border border-gray-200\">\n <h4 class=\"text-lg font-medium text-gray-800 mb-4\">优化建议</h4>\n \n <div class=\"mb-5\">\n <h5 class=\"font-medium text-gray-700 mb-2\">当前标题</h5>\n <p id=\"currentTitle\" class=\"text-gray-600 bg-white p-3 rounded border border-gray-200\"></p>\n \n <h5 class=\"font-medium text-green-700 mt-4 mb-2\">优化建议标题</h5>\n <p id=\"optimizedTitle\" class=\"text-green-800 bg-green-50 p-3 rounded border border-green-200\"></p>\n </div>\n \n <div class=\"mb-5\">\n <h5 class=\"font-medium text-gray-700 mb-2\">当前URL</h5>\n <p id=\"currentUrl\" class=\"text-gray-600 bg-white p-3 rounded border border-gray-200 truncate\"></p>\n \n <h5 class=\"font-medium text-green-700 mt-4 mb-2\">优化建议URL</h5>\n <p id=\"optimizedUrl\" class=\"text-green-800 bg-green-50 p-3 rounded border border-green-200 truncate\"></p>\n </div>\n \n <div class=\"flex gap-3 mt-4\">\n <button class=\"bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-lg text-sm transition-colors duration-200\">应用建议</button>\n <button class=\"bg-gray-200 hover:bg-gray-300 text-gray-700 py-2 px-4 rounded-lg text-sm transition-colors duration-200\">忽略</button>\n </div>\n </div>\n </div>\n</div>\n\n<script>\ndocument.getElementById('aiSeoBtn').addEventListener('click', function() {\n const btn = this;\n const loading = document.getElementById('loadingIndicator');\n const results = document.getElementById('resultsContainer');\n \n // 获取当前页面标题和URL\n const currentTitle = document.title;\n const currentUrl = window.location.href;\n \n // 显示加载状态\n btn.disabled = true;\n loading.classList.remove('hidden');\n \n // 模拟AI分析过程(实际应用中这里应该是API调用)\n setTimeout(function() {\n // 隐藏加载状态,显示结果\n loading.classList.add('hidden');\n results.classList.remove('hidden');\n btn.disabled = false;\n \n // 填充当前信息\n document.getElementById('currentTitle').textContent = currentTitle;\n document.getElementById('currentUrl').textContent = currentUrl;\n \n // 生成优化建议(示例)\n document.getElementById('optimizedTitle').textContent = \n generateOptimizedTitle(currentTitle);\n document.getElementById('optimizedUrl').textContent = \n generateOptimizedUrl(currentUrl);\n }, 2000);\n});\n\n// 生成优化标题的示例函数\nfunction generateOptimizedTitle(title) {\n // 这里应该是实际的AI逻辑,此处仅为示例\n const improvements = [\n '吸引眼球的', '高效的', '2024年最新的', '专家推荐的', '终极指南:'\n ];\n \n const improvement = improvements[Math.floor(Math.random() * improvements.length)];\n return improvement + ' ' + title;\n}\n\n// 生成优化URL的示例函数\nfunction generateOptimizedUrl(url) {\n // 这里应该是实际的AI逻辑,此处仅为示例\n return url.replace(/\\/+$/, '') \n .replace(/[^\\w\\/]/g, '-')\n .toLowerCase()\n .replace(/--+/g, '-');\n}\n</script>"
},
"next": ["添加真实API集成", "增加内容分析功能", "添加建议采纳功能", "增加历史记录", "添加多语言支持"]
}
```
角色
assistant
content
total_tokens
2765