Skip to content

Commit 0590254

Browse files
authored
Merge pull request #275 from TencentCloudBase/feature/demo-deployment
feat(demo): 🎨 add console AI development entry demo and move to scripts/demo
2 parents 15f8cd6 + 2788202 commit 0590254

12 files changed

Lines changed: 2634 additions & 11 deletions

File tree

doc/prompts/cloud-functions.mdx

Lines changed: 463 additions & 0 deletions
Large diffs are not rendered by default.

doc/prompts/cloudbase-platform.mdx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ After creating/deploying resources, provide corresponding console management pag
170170
- Main dashboard showing environment status, resource usage, and quick access to key features
171171
- Displays overview of all CloudBase services and their status
172172

173-
2. **Template Center (模板中心)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/cloud-template/market`
173+
2. **Template Center (模板中心)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/template`
174174
- Access project templates for React, Vue, Mini Program, UniApp, and backend frameworks
175175
- AI Builder templates for rapid application generation
176176
- Framework templates: React, Vue, Miniapp, UniApp, Gin, Django, Flask, SpringBoot, Express, NestJS, FastAPI
@@ -199,7 +199,7 @@ After creating/deploying resources, provide corresponding console management pag
199199
- Manage function triggers and environment variables
200200
- Monitor function invocations and performance
201201

202-
6. **CloudRun (云托管)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/platform-run`
202+
6. **CloudRun (云托管)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/cloudrun`
203203
- Manage containerized backend services
204204
- Deploy services using Function mode or Container mode
205205
- Configure service scaling, access types, and environment variables
@@ -216,8 +216,9 @@ After creating/deploying resources, provide corresponding console management pag
216216
- AI Builder for generating templates and code
217217
- AI image recognition and other AI features
218218

219-
9. **Static Website Hosting (静态网站托管)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/static-hosting`
219+
9. **Static Website Hosting (静态网站托管)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/hosting`
220220
- Deploy and manage static websites
221+
- Alternative URL: `https://console.cloud.tencent.com/tcb/hosting`
221222
- Configure custom domains and CDN settings
222223
- View deployment history and access logs
223224

@@ -231,20 +232,16 @@ After creating/deploying resources, provide corresponding console management pag
231232
- Manage API Keys and Publishable Keys
232233
- View and manage access tokens
233234

234-
11. **Weida Low-Code (微搭低代码)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/lowcode/apps`
235+
11. **Weida Low-Code (微搭低代码)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/weida`
235236
- Access Weida low-code development platform
236237
- Build applications using visual drag-and-drop interface
237238

238-
12. **Logs & Monitoring (日志监控)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/devops/log`
239+
12. **Logs & Monitoring (日志监控)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/logs`
239240
- View logs from cloud functions, CloudRun services, and other resources
240241
- Monitor resource usage, performance metrics, and error rates
241242
- Set up alerts and notifications
242243

243-
13. **Extensions (扩展功能)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/apis`
244-
- Manage platform extensions and plugins
245-
- Install and configure additional CloudBase capabilities
246-
247-
14. **Environment Settings (环境配置)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/env`
244+
13. **Environment Settings (环境配置)**: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/settings`
248245
- Configure environment-level settings
249246
- Manage security domains and CORS settings
250247
- Configure environment variables and secrets

doc/prompts/config.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,22 @@ rules:
102102
- "在 Android 应用中实现数据查询和更新"
103103
- "在 iOS 应用中实现数据库操作"
104104

105+
- id: cloud-functions
106+
title: 后端开发:云函数
107+
description: 开发和部署 Node.js 云函数,包括运行时选择、部署、日志查询、HTTP 访问配置
108+
category: backend
109+
order: 1
110+
prompts:
111+
- "帮我创建一个云函数并部署"
112+
- "配置云函数的 HTTP 访问"
113+
- "查询云函数的执行日志"
114+
- "更新云函数的环境变量"
115+
105116
- id: cloudrun-development
106117
title: 后端开发:云托管
107118
description: 使用云托管开发和部署任意语言的后端服务
108119
category: backend
109-
order: 1
120+
order: 2
110121
prompts:
111122
- "帮我部署一个 Node.js 后端服务到云托管"
112123
- "创建一个支持多语言的云托管服务"

doc/sidebar.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
"collapsible": true,
9292
"collapsed": true,
9393
"items": [
94+
"ai/cloudbase-ai-toolkit/prompts/cloud-functions",
9495
"ai/cloudbase-ai-toolkit/prompts/cloudrun-development"
9596
]
9697
},

scripts/demo/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# 云开发控制台 AI 开发入口 Demo
2+
3+
这是一个静态 HTML 原型,展示了在云开发控制台中集成 AI 开发入口的设计方案。
4+
5+
## 文件结构
6+
7+
```
8+
scripts/demo/
9+
├── index.html # 概览页面
10+
├── database.html # MySQL 数据库页面(场景1:创建数据库表)
11+
├── function.html # 云函数页面(场景2:创建云函数,场景4:分析函数错误)
12+
├── auth.html # 身份认证页面(场景3:集成登录功能)
13+
├── css/
14+
│ └── style.css # 样式文件
15+
├── js/
16+
│ ├── panel.js # 面板交互逻辑
17+
│ └── scenarios.js # 场景配置数据
18+
└── README.md # 本文件
19+
```
20+
21+
## 核心场景
22+
23+
### 场景1:创建数据库表
24+
- **页面**`database.html`
25+
- **按钮位置**:表管理页面,"表管理"标题右侧
26+
- **功能**:使用 AI 设计数据库表结构,包括字段、索引、约束和安全规则
27+
28+
### 场景2:创建云函数
29+
- **页面**`function.html`
30+
- **按钮位置**:云函数列表页,"云函数列表"标题右侧
31+
- **功能**:使用 AI 创建云函数,生成函数代码和调用代码
32+
33+
### 场景3:集成登录功能
34+
- **页面**`auth.html`
35+
- **按钮位置**:"快速开始"区域,"选择开发语言"下方
36+
- **功能**:使用 AI 集成身份认证功能到项目中
37+
38+
### 场景4:分析函数错误
39+
- **页面**`function.html`(函数详情部分)
40+
- **按钮位置**:函数详情页,日志标签页内,错误日志条目旁
41+
- **功能**:使用 AI 分析云函数错误并修复
42+
43+
## 使用方法
44+
45+
1. 直接在浏览器中打开任意 HTML 文件
46+
2. 点击页面上的 "使用 AI ..." 按钮
47+
3. 查看展开的 AI 开发面板,包含:
48+
- IDE 选择器(选择 Cursor、CodeBuddy、Claude Code 等)
49+
- MCP 配置步骤
50+
- 场景化提示词编辑器(可编辑)
51+
52+
## 功能特性
53+
54+
- ✅ 可展开/收起的 AI 开发面板
55+
- ✅ IDE 选择器(支持多个 IDE)
56+
- ✅ MCP 配置步骤展示
57+
- ✅ 场景化提示词模板(可编辑)
58+
- ✅ 一键复制配置和提示词
59+
- ✅ 响应式设计
60+
61+
## 技术实现
62+
63+
- 纯 HTML/CSS/JavaScript,无需构建工具
64+
- 参考了 `doc/components/ErrorCodeIDEButton.tsx``doc/components/IDESelector.tsx` 的设计
65+
- 样式参考了文档站的错误码页面按钮
66+
67+
## 下一步
68+
69+
这个 demo 展示了基本的 UI/UX 设计。实际集成到控制台时,需要:
70+
71+
1. 将静态 HTML 转换为 React/Vue 组件
72+
2. 集成真实的 MCP 配置逻辑
73+
3. 连接后端 API 获取环境信息
74+
4. 实现提示词的动态生成(根据页面上下文)
75+

scripts/demo/auth.html

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
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>身份认证 - 云开发控制台</title>
7+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8+
<link rel="stylesheet" href="css/style.css">
9+
</head>
10+
<body>
11+
<div class="console-container">
12+
<!-- Top Header -->
13+
<header class="console-header">
14+
<div class="console-header-left">
15+
<div class="console-logo">腾讯云 CloudBase DEV</div>
16+
<div class="console-env-selector">
17+
<span>tcb-advanced</span>
18+
<span style="color: #999;">个人版</span>
19+
<span></span>
20+
</div>
21+
<a href="#" style="color: #666; text-decoration: none; font-size: 14px;">接入指引</a>
22+
</div>
23+
<div class="console-header-right">
24+
<input type="text" class="console-search" placeholder="请输入关键词快捷搜索产品功能">
25+
<div class="console-header-icons">
26+
<div class="console-icon-button"><i class="fas fa-bell"></i></div>
27+
<div class="console-icon-button"><i class="fas fa-bookmark"></i></div>
28+
<div class="console-icon-button"><i class="fas fa-palette"></i></div>
29+
<div class="console-icon-button" style="width: 32px; height: 32px; border-radius: 50%; background: #52c41a; color: #fff; font-weight: 600; display: flex; align-items: center; justify-content: center;">B</div>
30+
</div>
31+
</div>
32+
</header>
33+
34+
<!-- Left Sidebar -->
35+
<aside class="console-sidebar">
36+
<ul class="console-sidebar-nav">
37+
<li class="console-sidebar-item">
38+
<a href="index.html" class="console-sidebar-link disabled">
39+
<span class="console-sidebar-icon"><i class="fas fa-chart-line"></i></span>
40+
<span>概览</span>
41+
</a>
42+
</li>
43+
<li class="console-sidebar-item">
44+
<a href="#" class="console-sidebar-link disabled">
45+
<span class="console-sidebar-icon"><i class="fas fa-cube"></i></span>
46+
<span>模板中心</span>
47+
</a>
48+
</li>
49+
<li class="console-sidebar-item">
50+
<a href="#" class="console-sidebar-link disabled">
51+
<span class="console-sidebar-icon"><i class="fas fa-file-alt"></i></span>
52+
<span>文档型数据库</span>
53+
</a>
54+
</li>
55+
<li class="console-sidebar-item">
56+
<a href="database.html" class="console-sidebar-link">
57+
<span class="console-sidebar-icon"><i class="fas fa-database"></i></span>
58+
<span>MySQL 数据库</span>
59+
</a>
60+
</li>
61+
<li class="console-sidebar-item">
62+
<a href="function.html" class="console-sidebar-link">
63+
<span class="console-sidebar-icon"><i class="fas fa-bolt"></i></span>
64+
<span>云函数</span>
65+
</a>
66+
</li>
67+
<li class="console-sidebar-item">
68+
<a href="#" class="console-sidebar-link disabled">
69+
<span class="console-sidebar-icon"><i class="fas fa-rocket"></i></span>
70+
<span>云托管</span>
71+
</a>
72+
</li>
73+
<li class="console-sidebar-item">
74+
<a href="#" class="console-sidebar-link disabled">
75+
<span class="console-sidebar-icon"><i class="fas fa-folder"></i></span>
76+
<span>云存储</span>
77+
</a>
78+
</li>
79+
<li class="console-sidebar-item">
80+
<a href="#" class="console-sidebar-link disabled">
81+
<span class="console-sidebar-icon"><i class="fas fa-robot"></i></span>
82+
<span>AI+</span>
83+
</a>
84+
</li>
85+
<li class="console-sidebar-item">
86+
<a href="#" class="console-sidebar-link disabled">
87+
<span class="console-sidebar-icon"><i class="fas fa-globe"></i></span>
88+
<span>静态网站托管</span>
89+
</a>
90+
</li>
91+
<li class="console-sidebar-item">
92+
<a href="auth.html" class="console-sidebar-link active">
93+
<span class="console-sidebar-icon"><i class="fas fa-lock"></i></span>
94+
<span>身份认证</span>
95+
</a>
96+
</li>
97+
<li class="console-sidebar-item">
98+
<a href="#" class="console-sidebar-link disabled">
99+
<span class="console-sidebar-icon"><i class="fas fa-tools"></i></span>
100+
<span>微搭低代码</span>
101+
</a>
102+
</li>
103+
<li class="console-sidebar-item">
104+
<a href="#" class="console-sidebar-link disabled">
105+
<span class="console-sidebar-icon"><i class="fas fa-clipboard-list"></i></span>
106+
<span>日志监控</span>
107+
</a>
108+
</li>
109+
<li class="console-sidebar-item">
110+
<a href="#" class="console-sidebar-link disabled">
111+
<span class="console-sidebar-icon"><i class="fas fa-cog"></i></span>
112+
<span>扩展功能</span>
113+
</a>
114+
</li>
115+
<li class="console-sidebar-item" style="margin-top: 16px; padding-top: 16px; border-top: 1px solid #e5e5e5;">
116+
<a href="#" class="console-sidebar-link disabled">
117+
<span class="console-sidebar-icon"><i class="fas fa-globe-americas"></i></span>
118+
<span>环境管理</span>
119+
</a>
120+
</li>
121+
</ul>
122+
</aside>
123+
124+
<!-- Main Content -->
125+
<main class="console-content">
126+
<div style="display: flex; gap: 24px;">
127+
<!-- Left Sub Navigation -->
128+
<div style="width: 200px; background: #fff; border-radius: 4px; padding: 16px; height: fit-content;">
129+
<div style="font-size: 14px; font-weight: 600; margin-bottom: 12px; color: #333;">接入</div>
130+
<div style="padding: 8px 12px; background: #e6f7ff; color: #1890ff; border-radius: 4px; margin-bottom: 8px; font-size: 14px; font-weight: 500;">快速开始</div>
131+
<div style="font-size: 14px; font-weight: 600; margin-top: 24px; margin-bottom: 12px; color: #333;">管理</div>
132+
<div style="padding: 8px 12px; color: #666; margin-bottom: 4px; font-size: 14px; cursor: pointer;">数据看板</div>
133+
<div style="padding: 8px 12px; color: #666; margin-bottom: 4px; font-size: 14px; cursor: pointer;">用户管理</div>
134+
<div style="padding: 8px 12px; color: #666; margin-bottom: 4px; font-size: 14px; cursor: pointer;">组织架构</div>
135+
<div style="padding: 8px 12px; color: #666; margin-bottom: 4px; font-size: 14px; cursor: pointer;">权限控制</div>
136+
<div style="font-size: 14px; font-weight: 600; margin-top: 16px; margin-bottom: 12px; color: #333;">配置</div>
137+
<div style="padding: 8px 12px; color: #666; margin-bottom: 4px; font-size: 14px; cursor: pointer;">登录方式</div>
138+
<div style="padding: 8px 12px; color: #666; margin-bottom: 4px; font-size: 14px; cursor: pointer;">Token</div>
139+
<div style="padding: 8px 12px; color: #666; margin-bottom: 4px; font-size: 14px; cursor: pointer;">登录页</div>
140+
<div style="padding: 8px 12px; color: #666; margin-bottom: 4px; font-size: 14px; cursor: pointer;">多因素认证</div>
141+
</div>
142+
143+
<!-- Right Content -->
144+
<div style="flex: 1;">
145+
<div style="background: #fff; padding: 24px; border-radius: 4px;">
146+
<div style="font-size: 16px; font-weight: 600; margin-bottom: 24px;">快速开始</div>
147+
148+
<div style="margin-bottom: 32px;">
149+
<div style="font-size: 14px; font-weight: 600; margin-bottom: 16px;">选择开发语言:</div>
150+
<div class="auth-language-selector">
151+
<div class="auth-language-option active">
152+
<div style="font-size: 20px; margin-bottom: 4px; color: #f7df1e;"><i class="fab fa-js"></i></div>
153+
<div style="font-size: 12px;">Javascript</div>
154+
</div>
155+
<div class="auth-language-option">
156+
<div style="font-size: 20px; margin-bottom: 4px; color: #42b883;"><i class="fab fa-vuejs"></i></div>
157+
<div style="font-size: 12px;">Vue</div>
158+
</div>
159+
<div class="auth-language-option">
160+
<div style="font-size: 20px; margin-bottom: 4px; color: #61dafb;"><i class="fab fa-react"></i></div>
161+
<div style="font-size: 12px;">React</div>
162+
</div>
163+
<div class="auth-language-option">
164+
<div style="font-size: 20px; margin-bottom: 4px; color: #339933;"><i class="fab fa-node-js"></i></div>
165+
<div style="font-size: 12px;">Node.js</div>
166+
</div>
167+
<div class="auth-language-option">
168+
<div style="font-size: 20px; margin-bottom: 4px; color: #f89820;"><i class="fab fa-java"></i></div>
169+
<div style="font-size: 12px;">Java</div>
170+
</div>
171+
<div class="auth-language-option">
172+
<div style="font-size: 20px; margin-bottom: 4px; color: #3776ab;"><i class="fab fa-python"></i></div>
173+
<div style="font-size: 12px;">Python</div>
174+
</div>
175+
<div class="auth-language-option">
176+
<div style="font-size: 20px; margin-bottom: 4px; color: #07c160;"><i class="fab fa-weixin"></i></div>
177+
<div style="font-size: 12px;">微信小程序/小游戏</div>
178+
</div>
179+
</div>
180+
</div>
181+
182+
<div style="margin-top: 32px;">
183+
<div style="font-size: 14px; font-weight: 600; margin-bottom: 16px;">添加示例代码到您的应用程序</div>
184+
<div style="margin-bottom: 16px;">
185+
<button class="ai-dev-button" data-scenario="integrate-auth" style="font-size: 13px; padding: 8px 16px;">
186+
<div class="ai-dev-button-left">
187+
<span>使用 AI 集成登录功能</span>
188+
</div>
189+
<svg class="ai-dev-button-arrow" width="10" height="10" viewBox="0 0 12 12" fill="none">
190+
<path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
191+
</svg>
192+
</button>
193+
</div>
194+
195+
<div style="margin-top: 24px;">
196+
<div style="font-size: 14px; font-weight: 600; margin-bottom: 12px;">步骤 1:引入依赖</div>
197+
<div style="background: #f5f5f5; padding: 12px; border-radius: 4px; font-family: monospace; font-size: 13px; margin-bottom: 16px;">
198+
&lt;script src="https://static.cloudbase.net/cloudbase-js-sdk/latest/cloudbase.full.js?v=1"&gt;&lt;/script&gt;
199+
</div>
200+
</div>
201+
202+
<div style="margin-top: 24px;">
203+
<div style="font-size: 14px; font-weight: 600; margin-bottom: 12px;">步骤 2:初始化</div>
204+
<div style="background: #f5f5f5; padding: 12px; border-radius: 4px; font-family: monospace; font-size: 13px;">
205+
&lt;script&gt;<br>
206+
const app = cloudbase.init({<br>
207+
&nbsp;&nbsp;env: "tcb-advanced-a656fc",<br>
208+
&nbsp;&nbsp;region: "ap-shanghai",<br>
209+
});<br>
210+
window.app = app;<br>
211+
&lt;/script&gt;
212+
</div>
213+
</div>
214+
</div>
215+
</div>
216+
</div>
217+
</div>
218+
</main>
219+
</div>
220+
221+
<script src="js/scenarios.js"></script>
222+
<script src="js/panel.js"></script>
223+
</body>
224+
</html>

0 commit comments

Comments
 (0)