新建会话时不再区分模式

This commit is contained in:
2026-09-21 19:54:52 +08:00
parent e35ce4ddcf
commit 33d9f4b834
5 changed files with 13 additions and 55 deletions
+7 -23
View File
@@ -85,11 +85,11 @@ input, textarea { font: inherit; color: inherit; border: 0; outline: none; backg
/* ================= 主内容区 ================= */ /* ================= 主内容区 ================= */
main { flex: 1; min-height: 0; display: flex; flex-direction: column; } main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* ---------- 未对话状态:模式选择 ---------- */ /* ---------- 未对话状态:欢迎页 ---------- */
#welcome-view { #welcome-view {
flex: 1; overflow-y: auto; overflow-x: hidden; flex: 1; overflow-y: auto; overflow-x: hidden;
display: flex; flex-direction: column; align-items: center; display: flex; flex-direction: column; align-items: center; justify-content: center;
padding: max(48px, 10vh) 24px 24px; padding: 24px;
} }
.logo-badge { .logo-badge {
width: auto; width: auto;
@@ -102,31 +102,15 @@ main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
color: var(--active); color: var(--active);
} }
.logo-badge .ic { width: 40px; height: 40px; } .logo-badge .ic { width: 40px; height: 40px; }
.welcome-slogan { margin-top: 0; font-size: 18px; } .welcome-slogan { font-size: 18px; }
/* 两行竖排:上 logo、下提示词,整体由 #welcome-view 垂直居中 */
.welcome-head { .welcome-head {
display: flex; display: flex;
flex-direction: column;
align-items: center; align-items: center;
justify-content: center; gap: 14px;
gap: 12px;
margin-bottom: 18px;
} }
/* 胶囊式分段控件 */
.mode-switch {
border: 1px solid var(--gray-light);
margin-top: 28px; width: 100%; max-width: 360px;
display: flex; gap: 4px;
border-radius: 999px;
}
.mode-chip {
flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
padding: 8px 0; border-radius: 999px;
font-size: 14px; color: var(--ink);
}
.mode-chip:hover {background: var(--surface);}
.mode-chip.on { background: var(--active-soft); color: var(--active); border: 1px solid var(--active); margin: -3px; background-color: var(--active-light); }
.mode-hint { margin-top: 14px; font-size: 13px; color: var(--gray); min-height: 20px; text-align: center; }
/* ---------- 对话状态:对话内容区 ---------- */ /* ---------- 对话状态:对话内容区 ---------- */
/* overflow-x 显式 hidden:overflow-y:auto 会把 visible 的 overflow-x 计算成 auto, /* overflow-x 显式 hidden:overflow-y:auto 会把 visible 的 overflow-x 计算成 auto,
宽代码块/表格自带横向滚动,不该再让消息流整体横向溢出 */ 宽代码块/表格自带横向滚动,不该再让消息流整体横向溢出 */
+2 -14
View File
@@ -127,26 +127,14 @@
<div id="schedule-bar" class="schedule-bar hidden" onclick="openScheduleModal()"></div> <div id="schedule-bar" class="schedule-bar hidden" onclick="openScheduleModal()"></div>
<main> <main>
<!-- ================= 未对话状态:模式切换区 ================= --> <!-- ================= 未对话状态:欢迎页 ================= -->
<section id="welcome-view"> <section id="welcome-view">
<div class="welcome-head"> <div class="welcome-head">
<div class="logo-badge"> <div class="logo-badge">
<svg class="ic" viewBox="0 0 24 24"><rect x="4" y="8" width="16" height="12" rx="3"></rect><line x1="12" y1="4" x2="12" y2="8"></line><circle cx="12" cy="3" r="1.4"></circle><circle cx="9" cy="13.5" r="1" fill="currentColor" stroke="none"></circle><circle cx="15" cy="13.5" r="1" fill="currentColor" stroke="none"></circle><line x1="9.5" y1="17" x2="14.5" y2="17"></line></svg> <svg class="ic" viewBox="0 0 24 24"><rect x="4" y="8" width="16" height="12" rx="3"></rect><line x1="12" y1="4" x2="12" y2="8"></line><circle cx="12" cy="3" r="1.4"></circle><circle cx="9" cy="13.5" r="1" fill="currentColor" stroke="none"></circle><circle cx="15" cy="13.5" r="1" fill="currentColor" stroke="none"></circle><line x1="9.5" y1="17" x2="14.5" y2="17"></line></svg>
</div> </div>
<div class="welcome-slogan">选择模式开始对话</div> <div class="welcome-slogan">随时开始吧</div>
</div> </div>
<div class="mode-switch" role="tablist" id="mode-switch">
<button class="mode-chip on" data-mode="secretary" role="tab" aria-selected="true">
<svg class="ic sm" viewBox="0 0 24 24"><path d="M6 3h12l4 6-10 13L2 9z"></path><polyline points="2 9 22 9"></polyline><polyline points="10 3 8 9 12 22"></polyline><polyline points="14 3 16 9 12 22"></polyline></svg>
文秘助理
</button>
<button class="mode-chip" data-mode="vision" role="tab" aria-selected="false">
<svg class="ic sm" viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>
识图专家
</button>
</div>
<div class="mode-hint" id="mode-hint"></div>
</section> </section>
<!-- ================= 对话状态:对话内容区 ================= --> <!-- ================= 对话状态:对话内容区 ================= -->
+4 -16
View File
@@ -139,7 +139,7 @@
return res.json(); return res.json();
} }
// ---------- 模式配置(新增助手类型时只需在这里加一项,welcome 卡片与顶部 icon 会自动跟随) ---------- // ---------- 模式配置(顶部 icon 按会话助手类型渲染;欢迎页已不再提供模式切换) ----------
const MODES = { const MODES = {
secretary: { secretary: {
label: '文秘助理', hint: '支持文字输入,可起草、润色、整理文书', label: '文秘助理', hint: '支持文字输入,可起草、润色、整理文书',
@@ -154,7 +154,7 @@
// ---------- 全局状态 ---------- // ---------- 全局状态 ----------
const state = { const state = {
view: 'welcome', // welcome | chat view: 'welcome', // welcome | chat
mode: 'secretary', // 模式选择区当前选中(仅 welcome 视图可操作) mode: 'secretary', // 新建会话默认助手类型(欢迎页已去掉模式切换,不再可变)
sessionType: 'secretary', // 当前会话的助手类型(建档时锁定,后续不随模式切换变更) sessionType: 'secretary', // 当前会话的助手类型(建档时锁定,后续不随模式切换变更)
deepThink: false, // 深度思考开关(仅本地视觉状态,无后端参数) deepThink: false, // 深度思考开关(仅本地视觉状态,无后端参数)
sessionId: null, // 当前会话 sessionId: null, // 当前会话
@@ -211,18 +211,6 @@
c.appendChild(title); c.appendChild(title);
} }
// ---------- 模式切换区 ---------- // ---------- 模式切换已移除:新建会话固定用 state.mode(secretary),历史会话的
function selectMode(mode) { // 助手类型由 sessionType 决定(旧 vision 会话仍正常渲染顶部 icon)。 ----------
state.mode = mode;
for (const chip of document.querySelectorAll('.mode-chip')) {
const on = chip.dataset.mode === mode;
chip.classList.toggle('on', on);
chip.setAttribute('aria-selected', on ? 'true' : 'false');
}
$('mode-hint').textContent = MODES[mode].hint;
}
$('mode-switch').addEventListener('click', e => {
const chip = e.target.closest('.mode-chip');
if (chip) selectMode(chip.dataset.mode);
});
-1
View File
@@ -218,7 +218,6 @@
userPaused = false; userPaused = false;
renderAttachChips(); renderAttachChips();
clearUploadCards(); clearUploadCards();
selectMode('secretary'); // 置顶逻辑:新建时自动选中【文秘助理】
setView('welcome'); setView('welcome');
$('chat-view').innerHTML = ''; $('chat-view').innerHTML = '';
$('msg-input').value = ''; $('msg-input').value = '';
-1
View File
@@ -1406,7 +1406,6 @@
// ---------- 初始化 ---------- // ---------- 初始化 ----------
bindChatScroll(); // 聊天区滚动跟随/右下角回底按钮(只绑一次) bindChatScroll(); // 聊天区滚动跟随/右下角回底按钮(只绑一次)
selectMode('secretary'); // 默认选中【文秘助理】
setView('welcome'); setView('welcome');
openDrawer(drawerMQ.matches); // 桌面端:侧边栏默认展开;跨断点缩放窗口时同步切换开合态 openDrawer(drawerMQ.matches); // 桌面端:侧边栏默认展开;跨断点缩放窗口时同步切换开合态
drawerMQ.addEventListener('change', e => openDrawer(e.matches)); drawerMQ.addEventListener('change', e => openDrawer(e.matches));