feat(frontend): 正文上方常驻 AI 输入条 + 对话记录正名 + 润色提示 + HITL 微文案

回答用户原话「我怎么和 AI 对话」(docs/design/ux-exploration.md §4 P0-1/2/4/5)。

P0-2 把折叠的「本章写作指令[可选]」原地提升为正文正上方常驻输入条:标题
「告诉 AI 这章想怎么写」、去「可选」徽标、空章默认展开、「AI 写作诉求」→
「你的写作要求」、邀请式 placeholder;发送键即「写本章」(streaming 时切
「停」),复用 composeDirective + 文风/剧情 chips + 流式打字机,不改成聊天气泡。
P0-1 底栏「AI 对话」→「对话记录」(只读日志正名),抽屉标题/aria/空态同改。
P0-4「润色选段」常驻可点,无选区点击弹 toast 提示(去 hover-only title)。
P0-5 输入条旁常驻 HITL 微文案 +「?这是什么」可再发现弹层(非一次性 coach)。
This commit is contained in:
Yaojia Wang
2026-07-10 17:43:59 +02:00
parent 61a6931bb1
commit ceae24740a
3 changed files with 173 additions and 61 deletions

View File

@@ -41,7 +41,7 @@ interface AiConversationDrawerProps {
triggerRef?: RefObject<HTMLElement | null>;
}
// 每章「AI 对话」抽屉(对话气泡视图):本章对话 + 项目级生成两段,作者右 / AI 左kind 徽标 + 线程归组。
// 每章「对话记录」抽屉(只读往复日志,气泡视图):本章对话 + 项目级生成两段,作者右 / AI 左kind 徽标 + 线程归组。
// 结构克隆 ContextDrawer右侧 slide-over + overlayScrim + role=dialog + Esc + focus trap + scroll lock + 还原焦点。
// append-only 只读展示;对 ai 产出可「从历史再接受」——只回填编辑器草稿,不绕开验收事务(守不变量 #3
export function AiConversationDrawer({
@@ -103,7 +103,7 @@ export function AiConversationDrawer({
ref={panelRef}
role="dialog"
aria-modal="true"
aria-label="AI 对话"
aria-label="对话记录"
onClick={(e) => e.stopPropagation()}
onKeyDown={(e) => {
if (panelRef.current) handleTabTrap(panelRef.current, e);
@@ -116,12 +116,12 @@ export function AiConversationDrawer({
className="h-4 w-4 text-cinnabar"
aria-hidden="true"
/>
AI
</span>
<Button
ref={closeRef}
onClick={onClose}
aria-label="关闭 AI 对话"
aria-label="关闭对话记录"
variant="ghost"
size="icon"
>
@@ -190,7 +190,7 @@ function DrawerBody({
return (
<EmptyState
icon={MessagesSquare}
title="还没有 AI 对话"
title="这里留存你和 AI 的往复记录"
description="润色、整章重写、续写、工具箱生成的往复会自动留痕,重开也不丢。"
/>
);