three+openai兼容api实现三维可爱ai机器人语音对话小助理代码
代码语言:html
所属分类:三维
代码描述:three+openai兼容api实现三维可爱ai机器人语音对话小助理代码,他能听到你说话,并说话回复你的问题,会开口眨眼睛,支持兼容openai的其他的ai大模型,三维卡通可爱机器人小助理
代码标签: three 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>3D 卡通智能机器人</title>
<style>
body { margin: 0; overflow: hidden; background-color: #F0F8FF; font-family: 'Segoe UI', sans-serif; }
#canvas-container { width: 100%; height: 100vh; display: block; }
/* 悬浮控制面板 */
#ui-panel {
position: absolute;
bottom: 30px;
right: 30px; /* 改到右下角,避免遮挡 */
width: 320px;
background: rgba(255, 255, 255, 0.90);
backdrop-filter: blur(12px);
padding: 20px;
border-radius: 20px;
box-shadow: 0 8px 32px rgba(0, 163, 255, 0.15);
border: 1px solid rgba(255, 255, 255, 0.8);
display: flex;
flex-direction: column;
gap: 12px;
transition: all 0.3s ease;
}
.header { display: flex; justify-content: space-between; align-items: center; }
h1 { margin: 0; font-size: 16px; color: #333; display: flex; align-items: center; gap: 5px; }
.status-badge { font-size: 12px; padding: 4px 8px; border-radius: 12px; background: #eee; color: #666; font-weight: bold; }
.status-talking { background: #E6FFFA; color: #00E5FF; } /* 青色 */
input {
padding: 10px; border: 1px solid #cceeff; border-radius: 10px;
background: #fdfdfd; outline: none; font-size: 13px; box-sizing: border-box; width: 100%;
}
input:focus { border-color: #00E5FF; background: #fff; }
/* 设置区域 */
#settings-area { display: none; margin-top: 5px; }
.settings-toggle { font-size: 12px; color: #888; text-align: right; cursor: pointer; text-decoration: underline; }
.btn-group { display: flex; gap: 10px; margin-top: 5px; }
button {
flex: 1; padding: 12px; border: none; border-radius: 12px; cursor: pointer;
font-weight: 600; font-size: 14px; transition: transform 0.1s;
}
#call-btn {
background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
color: white;
box-shadow: 0 4px 12px rgba(0, 114, 255, 0.3);
}
#call-btn:hover { opacity: 0.9; }
#voice-select { flex: 1; padding: 10px; border-radius: 12px; border: 1px solid #eee; background: white; outline: none; }
button:active { transform: scale(0.96); }
/* 气泡 */
#bubble-area {
position: absolute;
top: 10%;
left: 50%;
transform: translateX(-50%);
width: 320px;
pointer-events: none;
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
}
.bubble {
background: white; padding: 12px 18px; border-radius: 18px;
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
max-width: 100%; opacity: 0; transform: translateY(20px);
animation: popIn 0.4s forwards; font-size: 14px; line-height: 1.4;
color: #333; text-align: left;
}
.bubble.user { background: #E6F7FF; color: #0050B3; align-self: flex-end; margin-right: -20px; border-bottom-right-radius: 4px; }
.bubble.ai { background: #E0FFFF; color: #006064; align-self: flex-start; margin-left: -20px; border-bottom-left-radius: 4px; font-weight: 500;}
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0