import React from 'react'; import { Button, Tooltip } from 'antd'; import { HistoryOutlined, RobotOutlined, ClearOutlined, SettingOutlined, CloseOutlined, ExportOutlined } from '@ant-design/icons'; import type { OverlayWorkbenchTheme } from '../../utils/overlayWorkbenchTheme'; import type { AIChatMessage } from '../../types'; interface AIChatHeaderProps { darkMode: boolean; mutedColor: string; textColor: string; overlayTheme: OverlayWorkbenchTheme; onHistoryClick: () => void; onClear: () => void; onSettingsClick: () => void; onClose: () => void; messages?: AIChatMessage[]; sessionTitle?: string; } const exportToMarkdown = (messages: AIChatMessage[], title: string) => { const lines: string[] = [`# ${title}`, '', `> 导出时间:${new Date().toLocaleString()}`, '']; messages.forEach(msg => { const role = msg.role === 'user' ? '👤 You' : '🤖 GoNavi AI'; lines.push(`## ${role}`); lines.push(''); lines.push(msg.content); lines.push(''); lines.push('---'); lines.push(''); }); const blob = new Blob([lines.join('\n')], { type: 'text/markdown;charset=utf-8' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `${title.replace(/[/\\?%*:|"<>]/g, '-')}.md`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }; export const AIChatHeader: React.FC = ({ darkMode, mutedColor, textColor, overlayTheme, onHistoryClick, onClear, onSettingsClick, onClose, messages = [], sessionTitle = '新对话' }) => { return (
{messages.length > 0 && (
); };