149 lines
2.4 KiB
CSS
Raw Normal View History

.chat-container {
position: fixed;
bottom: 50px;
left: 0;
width: 100%;
background: #fff;
box-shadow: 0 -2px 5px #fff;
display: flex;
flex-direction: column;
align-items: center;
}
.chat-box {
width: 90%;
2025-04-06 22:15:36 +08:00
min-height: 20px;
max-height: 50vh;
overflow-y: auto;
background: #f5f5f5;
margin-bottom: 10px;
padding: 10px;
border-radius: 8px;
position: relative;
z-index: 10;
2025-04-06 22:15:36 +08:00
display: none;
2025-03-31 22:34:17 +08:00
}
.chat-box.show {
animation: slideUp 0.3s ease-out forwards;
2025-03-31 22:34:17 +08:00
}
.chat-box.hide {
animation: slideDown 0.3s ease-in forwards;
2025-03-31 22:34:17 +08:00
}
2025-04-08 18:42:46 +08:00
.message {
margin: 5px 0;
padding: 10px 15px;
max-width: fit-content;
border-radius: 12px;
word-break: break-word;
}
.message.user {
2025-04-08 18:42:46 +08:00
background-color: #daf1fc;
align-self: flex-end;
text-align: left;
margin-left: auto;
}
.message.bot {
2025-04-08 18:42:46 +08:00
background-color: #eee;
align-self: flex-start;
text-align: left;
margin-right: auto;
font-size: 14px;
line-height: 1.5;
}
/* 清除常见 markdown 元素的默认 margin */
.message.bot h1,
.message.bot h2,
.message.bot h3,
.message.bot p,
.message.bot ul,
.message.bot ol,
.message.bot pre,
.message.bot code {
margin: 0;
padding: 0;
font-size: inherit;
}
/* 更友好地渲染列表 */
.message.bot ul,
.message.bot ol {
padding-left: 1.2em;
}
/* 美化代码块 */
.message.bot pre {
background: #272822;
color: #f8f8f2;
padding: 8px;
overflow-x: auto;
border-radius: 4px;
2025-04-08 18:42:46 +08:00
}
.input-row {
display: flex;
justify-content: center;
width: 90%;
gap: 10px;
2025-03-31 22:34:17 +08:00
}
#userInput {
flex: 1;
padding: 10px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 6px;
2025-03-31 22:34:17 +08:00
}
button {
padding: 10px 16px;
font-size: 16px;
border: none;
background-color: #007BFF;
color: white;
border-radius: 6px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
2025-04-09 11:37:16 +08:00
.typing {
color: #aaa;
font-style: italic;
animation: blink 1s steps(1) infinite;
}
@keyframes blink {
50% {
opacity: 0.3;
}
}
@keyframes slideUp {
from {
transform: translateY(100%);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
@keyframes slideDown {
from {
transform: translateY(0);
opacity: 1;
}
to {
transform: translateY(100%);
opacity: 0;
}
}