import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; import { Spinner } from '@/components/ui/spinner'; import { Button } from '@/components/ui/button'; import { CheckCircle, XCircle, RotateCw } from 'lucide-react'; import { normalizeMarkdown, removeTitleFromContent } from '../utils'; interface AnalysisContentProps { analysisType: string; state: { content: string; loading: boolean; error: string | null; }; financials: any; analysisConfig: any; retryAnalysis: (type: string) => void; currentAnalysisTask: string | null; } export function AnalysisContent({ analysisType, state, financials, analysisConfig, retryAnalysis, currentAnalysisTask, }: AnalysisContentProps) { const analysisName = analysisType === 'company_profile' ? '公司简介' : (analysisConfig?.analysis_modules?.[analysisType]?.name || analysisType); const modelName = analysisConfig?.analysis_modules?.[analysisType]?.model; // Process content const contentWithoutTitle = removeTitleFromContent(state.content, analysisName); const normalizedContent = normalizeMarkdown(contentWithoutTitle); return (

{analysisName}(来自 {modelName || 'AI'})

{!financials && (

请等待财务数据加载完成...

)} {financials && ( <>
{state.loading ? ( ) : state.error ? ( ) : state.content ? ( ) : null}
{state.loading ? `正在生成${analysisName}...` : state.error ? '生成失败' : state.content ? '生成完成' : '待开始'}
{/* 始终可见的"重新生成分析"按钮 */} {!state.loading && ( )}
{state.error && (

加载失败: {state.error}

)} {(state.loading || state.content) && (
{normalizedContent} {state.loading && ( 正在生成中... )}
)} )}
); }