diff --git a/components/features/community/AiAnswerSection.tsx b/components/features/community/AiAnswerSection.tsx index 8d40beb..0daba39 100644 --- a/components/features/community/AiAnswerSection.tsx +++ b/components/features/community/AiAnswerSection.tsx @@ -1,6 +1,7 @@ -import { RefreshCw } from "lucide-react"; +import { AlertTriangle, RefreshCw } from "lucide-react"; import { ContentRenderer } from "./ContentRenderer"; import { Skeleton } from "@/components/ui/skeleton"; +import { Badge } from "@/components/ui/badge"; import { cn } from "@/lib/utils"; type AiAnswerStatus = "loading" | "success" | "error" | "empty"; @@ -8,6 +9,9 @@ type AiAnswerStatus = "loading" | "success" | "error" | "empty"; interface AiAnswerSectionProps { status: AiAnswerStatus; content?: string; + keyPoints?: string[] | null; + suggestedTags?: string[] | null; + confidence?: number | null; onRetry?: () => void; isRetrying?: boolean; } @@ -15,6 +19,9 @@ interface AiAnswerSectionProps { export function AiAnswerSection({ status, content, + keyPoints, + suggestedTags, + confidence, onRetry, isRetrying = false, }: AiAnswerSectionProps) { @@ -26,10 +33,37 @@ export function AiAnswerSection({
{status === "loading" && } {status === "success" && content && ( - +
+ {confidence !== null && confidence !== undefined && confidence < 0.5 && ( +
+ + AI 답변이 불확실할 수 있습니다 +
+ )} + {keyPoints && keyPoints.length > 0 && ( +
    + {keyPoints.map((point, i) => ( +
  • + + {point} +
  • + ))} +
+ )} + + {suggestedTags && suggestedTags.length > 0 && ( +
+ {suggestedTags.map((tag) => ( + + {tag} + + ))} +
+ )} +
)} {status === "error" && ( @@ -83,7 +117,7 @@ function AiAnswerError({ function AiAnswerEmpty() { return ( -
+

아직 생성된 AI 답변이 없습니다.

diff --git a/components/features/community/CommunityDetailPage.tsx b/components/features/community/CommunityDetailPage.tsx index 3618b41..fddc990 100644 --- a/components/features/community/CommunityDetailPage.tsx +++ b/components/features/community/CommunityDetailPage.tsx @@ -86,6 +86,9 @@ export function CommunityDetailPage({ postId }: Props) { ? "success" : "empty"; const aiContent = aiAnswerRes?.data?.content; + const aiKeyPoints = aiAnswerRes?.data?.keyPoints; + const aiSuggestedTags = aiAnswerRes?.data?.suggestedTags; + const aiConfidence = aiAnswerRes?.data?.confidence; // isLoading은 캐시가 없는 최초 fetch, isFetching은 refetch 포함 모든 fetch const isAiRetrying = isAiError && isAiFetching; @@ -127,6 +130,9 @@ export function CommunityDetailPage({ postId }: Props) { refetchAiAnswer()} isRetrying={isAiRetrying} /> diff --git a/types/community.ts b/types/community.ts index 3cd837f..ffc8687 100644 --- a/types/community.ts +++ b/types/community.ts @@ -133,6 +133,9 @@ export interface AiAnswer { id: string; postId: string; content: string; + keyPoints: string[] | null; + suggestedTags: string[] | null; + confidence: number | null; // 0.0 ~ 1.0 isAdopted: boolean; createdAt: string; }