- 新增 ActionBar 组件:快速操作按钮,通过 soc:prefill-input 事件填充输入框 - 新增 SourceBadge 组件:数据来源标注(内部知识库/工单系统/外部搜索/代码执行) - 4个 Gen-UI 卡片集成 ActionBar 和 SourceBadge - main.tsx 添加 soc:prefill-input 事件监听 - ToolCallStatus 状态文案统一为中文(正在xxx.../已完成·xxx) - MessageBubble 长消息(>800字)显示摘要+展开全文按钮 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import React from "react";
|
|
|
|
interface ActionBarProps {
|
|
sourceType?: string;
|
|
context?: string;
|
|
suggestedActions?: string[];
|
|
}
|
|
|
|
export function ActionBar({ context = "", suggestedActions = [] }: ActionBarProps) {
|
|
const dispatch = (text: string) => {
|
|
window.dispatchEvent(new CustomEvent("soc:prefill-input", { detail: { text } }));
|
|
};
|
|
|
|
return (
|
|
<div className="flex flex-wrap gap-1.5 mt-3 pt-2 border-t border-border/40">
|
|
<button
|
|
onClick={() => dispatch(`继续追问:${context}`)}
|
|
className="inline-flex items-center px-2.5 py-1 text-xs rounded-full border border-border hover:bg-primary/10 hover:border-primary/40 transition-colors text-muted-foreground hover:text-primary"
|
|
>
|
|
继续追问
|
|
</button>
|
|
{suggestedActions.map((action) => (
|
|
<button
|
|
key={action}
|
|
onClick={() => dispatch(`${action},基于以下内容:${context}`)}
|
|
className="inline-flex items-center px-2.5 py-1 text-xs rounded-full border border-border hover:bg-primary/10 hover:border-primary/40 transition-colors text-muted-foreground hover:text-primary"
|
|
>
|
|
{action}
|
|
</button>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|