main.tsx 拆分为模块化架构(1351→~462行): - 提取 useConversation/useConfig hooks - 提取 ChatMessages/ChatInput/ConfigPanel 组件 - 提取 shared/ 下公共组件(CopyButton/FeedbackButtons/ExportButton/CardErrorBoundary) 消除全部 as any 类型转换(9个文件,使用正确 TypeScript 类型替代) ThreadSidebar 增强: - 修复"新对话"标题不更新 bug - 新增内联重命名(双击编辑) - 新增对话置顶/取消置顶 - 移动端触摸优化(44px tap targets) MessageBubble 增强: - hover 显示消息时间戳 - 对话分支按钮(UI scaffold) - 移动端响应式(COT/代码块/操作栏) ToolCallStatus 移动端适配(紧凑时间线/截断工具名/小图标) 新功能脚手架: - DeepResearchToggle 深度搜索开关组件 - enterprise next-actions 企业闭环动作按钮 - conversation.ts 类型定义(ForkPoint/DeepResearchConfig/NextAction) Constraint: 各 worker 按文件隔离避免冲突 Rejected: 单人串行重构 | 耗时过长且容易遗漏 Confidence: high Scope-risk: broad Not-tested: 深度搜索和对话分支的端到端集成(仅 UI scaffold) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { cn } from "@/lib/utils";
|
|
import type { NextAction } from "@/types/conversation";
|
|
|
|
interface ActionButtonProps {
|
|
action: NextAction;
|
|
sourceCardId?: string;
|
|
className?: string;
|
|
}
|
|
|
|
const ACTION_ICONS: Record<string, string> = {
|
|
ticket_detail: "🎫",
|
|
generate_report: "📊",
|
|
kb_search: "📚",
|
|
};
|
|
|
|
export function ActionButton({ action, sourceCardId, className }: ActionButtonProps) {
|
|
const dispatch = () => {
|
|
window.dispatchEvent(
|
|
new CustomEvent("soc:prefill-input", {
|
|
detail: {
|
|
text: action.query,
|
|
sourceCardId,
|
|
},
|
|
}),
|
|
);
|
|
};
|
|
|
|
return (
|
|
<button
|
|
onClick={dispatch}
|
|
className={cn(
|
|
"flex items-center gap-3 px-3 py-2.5 rounded-lg border border-border",
|
|
"hover:bg-muted/50 hover:border-primary/30 transition-all text-left group w-full",
|
|
className,
|
|
)}
|
|
>
|
|
<span className="text-lg shrink-0">{ACTION_ICONS[action.type] ?? "⚡"}</span>
|
|
<span className="text-sm text-foreground group-hover:text-primary transition-colors">
|
|
{action.label}
|
|
</span>
|
|
</button>
|
|
);
|
|
}
|