react实现简洁ai聊天对话框代码
代码语言:html
所属分类:布局界面
代码描述:react实现简洁ai聊天对话框代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Chat Interface</title>
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<!-- Babel Standalone -->
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<style>
/* CSS Reset & Variables */
:root {
--primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
--bg-color: #f8fafc;
--chat-bg: #ffffff;
--text-main: #1e293b;
--text-secondary: #64748b;
--border-color: #e2e8f0;
--user-msg-bg: #f1f5f9;
--ai-msg-bg: #ffffff;
--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
--radius-lg: 16px;
--radius-md: 8px;
--radius-sm: 4px;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Inter', system-ui, -apple-system, sans-serif;
background-color: var(--bg-color);
color: var(--text-main);
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
/* Main Layout */
.chatbot {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.chatbot__container {
width: 100%;
max-width: 800px;
height: 100%;
max-height: 90vh;
background: var(--chat-bg);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-lg);
display: flex;
flex-direction: column;
position: relative;
overflow: hidden;
border: 1px solid var(--border-color);
}
/* Welcome Screen */
.chatbot__welcome {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40px;
text-align: center;
animation: fadeIn 0.5s ease-out;
}
.chatbot__icon-wrapper {
margin-bottom: 24px;
}
.chatbot__icon {
width: 64px;
height: 64px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
backgroun.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0