From 7af146701e231d613ed604a4047aa4c7e9cfb4c8 Mon Sep 17 00:00:00 2001 From: Sycun <165354365+Sycun@users.noreply.github.com> Date: Fri, 20 Nov 2026 15:44:50 +0800 Subject: [PATCH] style(chat): integrate the context toolbar into the composer --- web/static/css/style.css | 109 +++++++++----------- web/static/i18n/ar-SA.json | 2 + web/static/i18n/en-US.json | 2 + web/static/i18n/ru-RU.json | 2 + web/static/i18n/zh-CN.json | 2 + web/static/js/chat-codex-layout.test.cjs | 10 ++ web/static/js/chat.js | 13 +-- web/static/js/projects.js | 6 +- web/templates/index.html | 122 +++++++++++------------ 9 files changed, 137 insertions(+), 131 deletions(-) diff --git a/web/static/css/style.css b/web/static/css/style.css index bd632b4a..a60c0f22 100644 --- a/web/static/css/style.css +++ b/web/static/css/style.css @@ -45320,9 +45320,7 @@ html[data-theme="dark"] .project-conversation-row:hover .project-conversation-it } } -/* ============================================================================ - Layered chat composer: Codex-style hierarchy with CyberStrikeAI controls - ============================================================================ */ +/* Chat composer and context toolbar */ .chat-input-container { position: relative; @@ -45348,17 +45346,14 @@ html[data-theme="dark"] .project-conversation-row:hover .project-conversation-it .chat-composer-context { position: relative; - z-index: 1; + z-index: 3; display: flex; align-items: center; - min-height: 52px; - margin: 0 30px -9px; - padding: 0 15px 9px; - border: 1px solid rgba(15, 23, 42, 0.08); - border-bottom: 0; - border-radius: 22px 22px 0 0; - background: #f5f6f7; - box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.035); + min-height: 42px; + padding: 5px 10px; + border-bottom: 1px solid var(--border-color); + border-radius: 21px 21px 0 0; + background: color-mix(in srgb, var(--accent-color) 6%, var(--bg-primary)); box-sizing: border-box; } @@ -45374,37 +45369,35 @@ html[data-theme="dark"] .project-conversation-row:hover .project-conversation-it } .chat-composer-context .chat-input-leading > *:not(:last-child) { - margin-right: 4px; - padding-right: 5px; + margin-inline-end: 5px; + padding-inline-end: 5px; } .chat-composer-context .chat-input-leading > *:not(:last-child)::after { content: ''; position: absolute; - top: 11px; - right: 0; - bottom: 11px; + inset-block: 7px; + inset-inline-end: 0; width: 1px; - background: rgba(15, 23, 42, 0.09); + background: var(--border-color); } .chat-composer-context .role-selector-btn { - height: 40px; - padding: 0 12px; - gap: 8px; + height: 30px; + max-width: 100%; + padding: 0 8px; + gap: 6px; border: 0; - border-radius: 12px; + border-radius: 8px; background: transparent; box-shadow: none; - color: #20242a; - font-size: 14px; - font-weight: 560; + color: var(--text-primary); } .chat-composer-context .role-selector-btn:hover, .chat-composer-context .role-selector-btn.active { border: 0; - background: rgba(15, 23, 42, 0.055); + background: color-mix(in srgb, var(--accent-color) 10%, transparent); box-shadow: none; } @@ -45414,20 +45407,24 @@ html[data-theme="dark"] .project-conversation-row:hover .project-conversation-it } .chat-composer-context .role-selector-icon { - width: 20px; - min-width: 20px; - height: 20px; - font-size: 18px; + width: 16px; + min-width: 16px; + height: 16px; + font-size: 16px; + color: var(--accent-color); } .chat-composer-context .role-selector-icon svg { display: block; + width: 100%; + height: 100%; } .chat-composer-context .role-selector-text { - color: #20242a; - font-size: 14px; - font-weight: 560; + min-width: 0; + color: var(--text-primary); + font-size: 13px; + font-weight: 500; } .chat-composer-context .role-selector-arrow { @@ -45910,12 +45907,6 @@ html[data-theme="dark"] .chat-input-container { background: transparent !important; } -html[data-theme="dark"] .chat-composer-context { - border-color: #263244; - background: #172033; - box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.15); -} - html[data-theme="dark"] .chat-composer-context .role-selector-btn { border: 0 !important; background: transparent !important; @@ -45932,7 +45923,6 @@ html[data-theme="dark"] .chat-composer-context .role-selector-text { color: var(--text-primary); } -html[data-theme="dark"] .chat-composer-context .chat-input-leading > *:not(:last-child)::after, html[data-theme="dark"] .chat-composer-meta-divider { background: rgba(148, 163, 184, 0.18); } @@ -45997,16 +45987,11 @@ html[data-theme="dark"] .chat-system-model-retry:hover { } .chat-composer-context { - min-height: 54px; - margin-right: 16px; - margin-left: 16px; - padding-right: 8px; - padding-left: 8px; + padding-inline: 7px; } .chat-composer-context .role-selector-btn { - padding-right: 9px; - padding-left: 9px; + height: 34px; } .chat-composer-context .project-selector-wrapper .role-selector-text { @@ -46022,8 +46007,8 @@ html[data-theme="dark"] .chat-system-model-retry:hover { @media (max-width: 620px) { .chat-composer-context .chat-input-leading > *:not(:last-child) { - margin-right: 1px; - padding-right: 2px; + margin-inline-end: 1px; + padding-inline-end: 2px; } .chat-composer-context .role-selector-btn { @@ -46061,17 +46046,16 @@ html[data-theme="dark"] .chat-system-model-retry:hover { } @container chat-composer (max-width: 520px) { - .chat-composer-context { - margin-right: 8px; - margin-left: 8px; - padding-right: 7px; - padding-left: 7px; - } - .chat-composer-context .chat-input-leading { width: 100%; } + .chat-composer-context .chat-input-leading > *, + .chat-composer-context .agent-mode-inner { + flex-shrink: 1; + min-width: 0; + } + .chat-composer-context .role-selector-btn { gap: 5px; padding-right: 7px; @@ -46079,7 +46063,9 @@ html[data-theme="dark"] .chat-system-model-retry:hover { } .chat-composer-context #agent-mode-text { - display: none; + max-width: 82px; + overflow: hidden; + text-overflow: ellipsis; } .chat-composer-footer { @@ -46106,12 +46092,16 @@ html[data-theme="dark"] .chat-system-model-retry:hover { @container chat-composer (max-width: 350px) { .chat-composer-context .project-selector-wrapper .role-selector-text, - .chat-composer-context #role-selector-text { - max-width: 62px; + .chat-composer-context #agent-mode-text { + max-width: 78px; overflow: hidden; text-overflow: ellipsis; } + .chat-composer-context #role-selector-text { + display: none; + } + .chat-hitl-shortcut { max-width: 118px; } @@ -46844,7 +46834,6 @@ html[data-theme="dark"] .chat-composer-surface > .chat-session-settings-popover display: none !important; } -.chat-input-container.has-hitl-approval .chat-composer-context, .chat-input-container.has-hitl-approval .chat-composer-surface { display: none; } diff --git a/web/static/i18n/ar-SA.json b/web/static/i18n/ar-SA.json index e0141cca..ceffb905 100644 --- a/web/static/i18n/ar-SA.json +++ b/web/static/i18n/ar-SA.json @@ -756,6 +756,8 @@ "generatedFromFact": "مُولّدة من حقيقة المشروع {{factKey}}" }, "chat": { + "defaultWorkspace": "مساحة العمل الافتراضية", + "boundProject": "مشروع مرتبط", "toolExecBlocked": "تم حظر الأداة {{name}}", "newChat": "محادثة جديدة", "newTask": "مهمّة جديدة", diff --git a/web/static/i18n/en-US.json b/web/static/i18n/en-US.json index 88ba2af2..d489f9c3 100644 --- a/web/static/i18n/en-US.json +++ b/web/static/i18n/en-US.json @@ -756,6 +756,8 @@ "generatedFromFact": "Generated from project fact {{factKey}}" }, "chat": { + "defaultWorkspace": "Default workspace", + "boundProject": "Linked project", "toolExecBlocked": "Tool {{name}} blocked", "newChat": "New chat", "newTask": "New task", diff --git a/web/static/i18n/ru-RU.json b/web/static/i18n/ru-RU.json index dfd26eae..604995d0 100644 --- a/web/static/i18n/ru-RU.json +++ b/web/static/i18n/ru-RU.json @@ -768,6 +768,8 @@ "generatedFromFact": "Создано из факта проекта {{factKey}}" }, "chat": { + "defaultWorkspace": "Рабочая область по умолчанию", + "boundProject": "Связанный проект", "toolExecBlocked": "Инструмент {{name}} заблокирован", "newChat": "Новый диалог", "newTask": "Новая задача", diff --git a/web/static/i18n/zh-CN.json b/web/static/i18n/zh-CN.json index 5dcb8312..6793c55c 100644 --- a/web/static/i18n/zh-CN.json +++ b/web/static/i18n/zh-CN.json @@ -744,6 +744,8 @@ "generatedFromFact": "由项目事实 {{factKey}} 生成" }, "chat": { + "defaultWorkspace": "默认工作区", + "boundProject": "已绑定项目", "toolExecBlocked": "工具 {{name}} 已拦截", "newChat": "新对话", "newTask": "新任务", diff --git a/web/static/js/chat-codex-layout.test.cjs b/web/static/js/chat-codex-layout.test.cjs index f39bc496..46d41040 100644 --- a/web/static/js/chat-codex-layout.test.cjs +++ b/web/static/js/chat-codex-layout.test.cjs @@ -6,6 +6,7 @@ const chat = fs.readFileSync('web/static/js/chat.js', 'utf8'); const monitor = fs.readFileSync('web/static/js/monitor.js', 'utf8'); const projects = fs.readFileSync('web/static/js/projects.js', 'utf8'); const styles = fs.readFileSync('web/static/css/style.css', 'utf8'); +const template = fs.readFileSync('web/templates/index.html', 'utf8'); const zh = JSON.parse(fs.readFileSync('web/static/i18n/zh-CN.json', 'utf8')); const en = JSON.parse(fs.readFileSync('web/static/i18n/en-US.json', 'utf8')); @@ -43,6 +44,15 @@ test('欢迎语随项目和无项目状态更新', () => { assert.equal(typeof en.chat.projectWelcomeMessage, 'string'); }); +test('输入框顶部在同一张卡片内依次显示模式和项目', () => { + const composer = template.slice(template.indexOf('id="chat-input-container"'), template.indexOf('id="chat-input"')); + assert.match(composer, /class="chat-input-primary-row chat-composer-surface">\s*