refactor(static): aibox.html 拆分内联 CSS/JS 为独立文件
This commit is contained in:
1 parent
227fbb17f4
commit
65580e7e50
3 files changed
+608
-610
No files matched your search
@@ -0,0 +1,213 @@
|
||||
/* ===== 全屏应用布局(覆盖 theme.css 的居中卡片页默认) ===== */
|
||||
html, body { height: 100%; }
|
||||
body {
|
||||
display: block;
|
||||
padding: 0;
|
||||
height: 100dvh; /* 移动端动态视口高度,规避地址栏遮挡 */
|
||||
overflow: hidden;
|
||||
}
|
||||
#app {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100dvh;
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
background: var(--bg);
|
||||
transition: margin-right 0.25s;
|
||||
}
|
||||
|
||||
/* ===== 顶栏 ===== */
|
||||
#topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
padding-top: calc(10px + env(safe-area-inset-top));
|
||||
background: var(--card);
|
||||
border-bottom: 1px solid var(--border-light);
|
||||
flex: none;
|
||||
}
|
||||
#topbar .title { font-size: 1rem; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
#conn-status { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--fg-secondary); flex: none; }
|
||||
#conn-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
|
||||
#conn-status.connected .dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
|
||||
#conn-status.connecting .dot { background: var(--warning); }
|
||||
#conn-status.disconnected .dot { background: var(--error); }
|
||||
#topbar button { flex: none; padding: 0.45rem 0.8rem; font-size: 0.8rem; min-height: 36px; }
|
||||
#task-toggle { background: var(--accent-soft); color: var(--accent-dark); position: relative; }
|
||||
#task-badge {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: -6px; right: -6px;
|
||||
min-width: 16px; height: 16px;
|
||||
border-radius: 8px;
|
||||
background: var(--error);
|
||||
color: #fff;
|
||||
font-size: 0.62rem;
|
||||
line-height: 16px;
|
||||
text-align: center;
|
||||
padding: 0 4px;
|
||||
}
|
||||
#conn-btn { background: var(--accent-soft); color: var(--accent-dark); }
|
||||
#conn-btn.on { background: var(--error-bg); color: var(--error); }
|
||||
|
||||
/* ===== 非管理员提示条 ===== */
|
||||
#admin-tip {
|
||||
flex: none;
|
||||
padding: 8px 12px;
|
||||
font-size: 0.78rem;
|
||||
background: var(--error-bg);
|
||||
color: var(--error);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* ===== 聊天区 ===== */
|
||||
#chat {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 14px 12px;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.msg { margin-bottom: 12px; overflow-wrap: break-word; }
|
||||
.msg-user {
|
||||
margin-left: 15%;
|
||||
padding: 0.65rem 0.9rem;
|
||||
background: var(--accent-soft);
|
||||
border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
|
||||
font-size: 0.92rem;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.msg-ai {
|
||||
margin-right: 6%;
|
||||
padding: 0.75rem 1rem;
|
||||
background: var(--card);
|
||||
border: 1px solid var(--border-light);
|
||||
border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
|
||||
box-shadow: var(--shadow-sm);
|
||||
font-size: 0.92rem;
|
||||
line-height: 1.65;
|
||||
}
|
||||
.msg-ai p { margin: 0.4em 0; }
|
||||
.msg-ai p:first-child { margin-top: 0; }
|
||||
.msg-ai p:last-child { margin-bottom: 0; }
|
||||
.msg-ai pre {
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 0.6rem;
|
||||
overflow-x: auto;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.msg-ai code { font-size: 0.82em; background: var(--accent-soft); border-radius: 4px; padding: 0.1em 0.3em; }
|
||||
.msg-ai pre code { background: none; padding: 0; }
|
||||
.msg-ai a { color: var(--accent); }
|
||||
.msg-ai.streaming::after {
|
||||
content: '▌';
|
||||
color: var(--accent);
|
||||
animation: blink 0.9s steps(1) infinite;
|
||||
}
|
||||
@keyframes blink { 50% { opacity: 0; } }
|
||||
.msg-system, .msg-error { text-align: center; font-size: 0.78rem; color: var(--fg-secondary); }
|
||||
.msg-error { color: var(--error); }
|
||||
|
||||
/* 思考区域:灰色斜体可折叠 */
|
||||
.msg-reasoning {
|
||||
margin-right: 6%;
|
||||
border-left: 3px solid var(--border);
|
||||
padding: 0.4rem 0.8rem;
|
||||
font-size: 0.8rem;
|
||||
color: var(--muted);
|
||||
font-style: italic;
|
||||
}
|
||||
.reasoning-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
font-style: normal;
|
||||
font-size: 0.75rem;
|
||||
color: var(--fg-secondary);
|
||||
min-height: 28px;
|
||||
}
|
||||
.reasoning-body { white-space: pre-wrap; margin-top: 4px; }
|
||||
.reasoning-body.folded { display: none; }
|
||||
|
||||
/* ===== 输入栏 ===== */
|
||||
#input-bar {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
padding-bottom: calc(10px + env(safe-area-inset-bottom));
|
||||
background: var(--card);
|
||||
border-top: 1px solid var(--border-light);
|
||||
flex: none;
|
||||
}
|
||||
#input {
|
||||
flex: 1;
|
||||
min-height: 44px;
|
||||
max-height: 120px;
|
||||
resize: none;
|
||||
font-size: 16px; /* iOS <16px 会聚焦自动缩放 */
|
||||
line-height: 1.4;
|
||||
padding: 0.65rem 0.9rem;
|
||||
}
|
||||
#send-btn { flex: none; min-height: 44px; background: var(--accent); color: #fff; }
|
||||
#interrupt-btn { flex: none; min-height: 44px; min-width: 44px; padding: 0.45rem 0.7rem; background: var(--error-bg); color: var(--error); }
|
||||
#send-btn:disabled, #interrupt-btn:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
|
||||
/* ===== 任务面板:移动端为抽屉式覆盖层 ===== */
|
||||
#task-panel {
|
||||
position: fixed;
|
||||
top: 0; right: 0; bottom: 0;
|
||||
width: min(85vw, 340px);
|
||||
background: var(--card);
|
||||
border-left: 1px solid var(--border-light);
|
||||
box-shadow: var(--shadow-md);
|
||||
transform: translateX(100%);
|
||||
transition: transform 0.25s;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
z-index: 100;
|
||||
padding-top: env(safe-area-inset-top);
|
||||
}
|
||||
#task-panel.open { transform: translateX(0); }
|
||||
#task-panel header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
border-bottom: 1px solid var(--border-light);
|
||||
flex: none;
|
||||
}
|
||||
#task-close { background: none; border: none; font-size: 1.3rem; color: var(--fg-secondary); padding: 4px 8px; min-height: 36px; min-width: 36px; }
|
||||
#task-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 10px 12px;
|
||||
font-size: 0.78rem;
|
||||
line-height: 1.6;
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: break-word;
|
||||
color: var(--fg-secondary);
|
||||
}
|
||||
#backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.35);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.25s;
|
||||
z-index: 99;
|
||||
}
|
||||
#backdrop.show { opacity: 1; pointer-events: auto; }
|
||||
|
||||
/* ===== 桌面端:任务面板固化为右侧栏 ===== */
|
||||
@media (min-width: 900px) {
|
||||
#app { margin-right: 340px; max-width: none; }
|
||||
#task-panel { transform: none; box-shadow: none; }
|
||||
#task-toggle, #task-close, #backdrop { display: none; }
|
||||
}
|
||||
Reference in new issue
Block a user