js浏览器中调用openai兼容大模型api实现可视化对话生成网页本地保存预览图应用代码
代码语言:html
所属分类:其他
代码描述:js浏览器中调用openai兼容大模型api实现可视化对话生成网页本地保存预览图应用代码,整个过程看不到ai生成的代码,直接预览效果,有需求变更或不满意就直接继续聊天让ai改,支持多个项目页面新建与打开。
代码标签: js 浏览器 调用 openai 兼容 大模型 api 可视化 对话 生成 网页 本地 保存 预览图
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>AI网页生成器 - 让创意变成现实</title> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/bootstrap.5.3.0.css"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/bootstrap-icons.1.11.3.css"> <style> :root { --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%); --primary-color: #6366f1; --primary-dark: #4f46e5; --secondary-color: #8b5cf6; --accent-color: #06b6d4; --dark-bg: #0f172a; --card-bg: #ffffff; --text-primary: #1e293b; --text-secondary: #64748b; --text-muted: #94a3b8; --border-color: #e2e8f0; --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1); --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1); --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25); --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px; --radius-xl: 16px; --radius-2xl: 24px; } * { 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, #f8fafc 0%, #f1f5f9 100%); color: var(--text-primary); line-height: 1.6; font-size: 16px; } /* 导航栏样式 */ .navbar { background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border-color); padding: 1rem 0; position: sticky; top: 0; z-index: 1000; transition: background 0.3s ease; } .navbar-brand { font-weight: 700; font-size: 1.5rem; background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; display: flex; align-items: center; gap: 0.5rem; } .nav-link { color: var(--text-secondary); font-weight: 500; padding: 0.5rem 1rem; border-radius: var(--radius-md); transition: all 0.2s ease; } .nav-link:hover, .nav-link.active { color: var(--primary-color); background-color: rgba(99, 102, 241, 0.1); } /* 主容器 */ .main-container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; } /* 英雄区域 */ .hero-section { background: var(--primary-gradient); color: white; padding: 5rem 0; margin-bottom: 4rem; position: relative; overflow: hidden; } .hero-section::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="10" height="10" patternUnits="userSpaceOnUse"><circle cx="5" cy="5" r=".5" fill="white" fill-opacity="0.1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grain)"/></svg>'); } .hero-content { position: relative; z-index: 1; text-align: center; max-width: 800px; margin: 0 auto; } .hero-title { font-size: 3.5rem; font-weight: 800; margin-bottom: 1.5rem; line-height: 1.1; } .hero-subtitle { font-size: 1.25rem; margin-bottom: 2.5rem; opacity: 0.9; font-weight: 400; } /* 灵感输入区 */ .inspiration-section { background: white; border-radius: var(--radius-2xl); padding: 3rem; margin: -8rem auto 4rem; max-width: 900px; box-shadow: var(--shadow-2xl); border: 1px solid var(--border-color); position: relative; z-index: 10; } .inspiration-input-container { position: relative; margin-bottom: 2rem; } .inspiration-input { width: 100%; padding: 1.25rem 1.5rem 1.25rem 3.5rem; border: 2px solid var(--border-color); border-radius: var(--radius-xl); font-size: 1.1rem; transition: all 0.3s ease; background: #fafafa; } .inspiration-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); background: white; } .inspiration-icon { position: absolute; left: 1.25rem; top: 50%; transform: translateY(-50%); color: var(--primary-color); font-size: 1.25rem; } .generate-btn { width: 100%; padding: 1.25rem 2rem; background: var(--primary-gradient); color: white; border: none; border-radius: var(--radius-xl); font-weight: 600; font-size: 1.1rem; cursor: pointer; transition: all 0.3s ease; box-shadow: var(--shadow-lg); } .generate-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-xl); } .generate-btn:active { transform: translateY(0); } .suggestion-tags { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; } .suggestion-tag { background: #f8fafc; color: var(--text-secondary); padding: 0.5rem 1rem; border-radius: var(--radius-lg); font-size: 0.9rem; border: 1px solid var(--border-color); cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; gap: 0.5rem; } .suggestion-tag:hover { background: var(--primary-color); color: white; border-color: var(--primary-color); } /* 案例展示区 */ .cases-section { margin: 4rem 0; } .section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2.5rem; flex-wrap: wrap; gap: 1.5rem; } .section-title { font-size: 2.25rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 0.75rem; } .filter-controls { display: flex; gap: 1rem; flex-wrap: wrap; } .category-select, .search-input { padding: 0.75rem 1.25rem; border: 2px solid var(--border-color); border-radius: var(--radius-lg); background: white; color: var(--text-primary); font-size: 0.95rem; transition: all 0.2s ease; } .category-select:focus, .search-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); } .search-input::placeholder { color: var(--text-muted); } .cases-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2rem; margin-bottom: 3rem; } .case-card { background: white; border-radius: var(--radius-xl); overflow: hidden;.........完整代码请登录后点击上方下载按钮下载查看
网友评论0