Merge branch 'main' into feature/crawler

This commit is contained in:
skkim committed 2026-09-14 19:45:25 +09:00
commit dd3ad86715
160 files changed
+111240 -202

No files matched your search

@@ -6,7 +6,7 @@
*/
/**
* facts.source_type / media.source_type / place_aliases.source_type 공용 코드값.
* facts.source_type / media.source_type / place_aliases.source_type / place_faqs.generated_by 공용 코드값.
값이 어디서 왔는지 — 모든 사실은 출처를 갖는다.
*/
export type SourceType = typeof SourceType[keyof typeof SourceType];
@@ -18,4 +18,5 @@ export const SourceType = {
API: 2,
CRAWL: 3,
LLM: 4,
TEMPLATE: 5,
} as const;
@@ -1,7 +1,7 @@
import {useState} from 'react';
import {useQueryClient} from '@tanstack/react-query';
import {Check, Loader2, MessageCircleQuestion, Plus, Sparkles, X} from 'lucide-react';
import {FactStatus, PUBLISHABLE_FACT_STATUSES} from '@o2o/shared';
import {FactStatus, PUBLISHABLE_FACT_STATUSES, SourceType} from '@o2o/shared';
import {getListFaqsQueryKey, useCreateFaq, useListFaqs, useTransitionFaq} from '@/api';
import {Badge} from '@/components/ui/badge';
import {Button} from '@/components/ui/button';
@@ -59,6 +59,8 @@ function FaqEditor({placeId}: {placeId: string}) {
const faqs = listQuery.data?.faqs ?? [];
const publishable = listQuery.data?.publishable ?? 0;
const pending = listQuery.data?.pending_review ?? 0;
// 20개를 채운 공통 질문. 답이 "숙소로 문의" 뿐이라 따로 센다 — 실제 답이 몇 개인지 보여야 채울 마음이 든다.
const inquiry = faqs.filter((faq) => faq.generated_by === SourceType.TEMPLATE).length;
const submit = async () => {
const q = question.trim();
@@ -95,7 +97,7 @@ function FaqEditor({placeId}: {placeId: string}) {
<div className="flex items-center justify-between border-b border-border pb-2">
<span className="text-xs font-bold">자주 묻는 질문</span>
<span className="text-[10px] text-muted-foreground">
노출 {publishable}건{pending > 0 && ` · 대기 ${pending}건`}
노출 {publishable}건{inquiry > 0 && ` (문의 안내 ${inquiry})`}{pending > 0 && ` · 대기 ${pending}건`}
</span>
</div>
@@ -160,7 +162,9 @@ function FaqEditor({placeId}: {placeId: string}) {
<div className="flex items-start justify-between gap-2">
<p className="flex-1 text-xs font-semibold break-words">{faq.question}</p>
{isLive ? (
<span className="shrink-0 text-[10px] text-muted-foreground">노출 중</span>
<span className="shrink-0 text-[10px] text-muted-foreground">
{faq.generated_by === SourceType.TEMPLATE ? '문의 안내' : '노출 중'}
</span>
) : (
<Badge variant="warning" className="shrink-0 text-[10px]">
승인 대기
@@ -209,6 +213,13 @@ function FaqEditor({placeId}: {placeId: string}) {
직접 쓴 질문·답변은 <strong className="text-foreground">사장님이 확정한 값</strong>으로 바로 노출되고,
AI 가 만들어 둔 항목은 승인해야 사이트와 AI 검색용 데이터에 나갑니다.
</p>
{inquiry > 0 && (
<p className="text-[11px] leading-relaxed text-muted-foreground">
FAQ 가 20개에 모자라 손님이 자주 묻는 질문을 <strong className="text-foreground">문의 안내</strong>로
채웠습니다. 사이트에는 보이지만 AI 검색용 데이터에는 나가지 않습니다. 같은 질문에 직접 답을 추가하면
다음 생성 때 문의 안내 항목은 빠집니다.
</p>
)}
</div>
);
}
@@ -55,19 +55,27 @@ export function notifyVision(job: JobData) {
);
}
/** 재생성(소개문·FAQ) 결과 알림. 생성물도 미검증으로 들어가 사람이 승인해야 나간다. */
/**
* 재생성(소개문·FAQ) 결과 알림.
*
* ★ `faq_fill` 을 같이 본다. fact 가 0건이면 AI 가 쓴 FAQ(`faqs`)는 0 이지만 문의 안내로 20개가 채워진다 —
* `faqs` 만 보면 "새로 만든 문장이 없습니다" 가 떠서, FAQ 탭에 20개가 있는데 실패로 읽힌다.
*/
export function notifyCopy(job: JobData) {
const faqCount = readNumber(job.result, 'faqs');
const fillCount = readNumber(job.result, 'faq_fill');
const hasIntro = (job.result as {intro?: unknown} | undefined)?.intro === true;
if (!hasIntro && faqCount === 0) {
if (!hasIntro && faqCount === 0 && fillCount === 0) {
notify.warn(
'새로 만든 문장이 없습니다.',
readNote(job) ?? '근거로 쓸 확인된 정보가 부족합니다. 정보를 먼저 확인해 주세요.',
);
return;
}
const parts = [`소개문 ${hasIntro ? '1건' : '없음'}`, `FAQ ${faqCount}건`];
if (fillCount > 0) parts.push(`문의 안내 ${fillCount}건`);
notify.success(
'소개문을 다시 만들었습니다',
`소개문 ${hasIntro ? '1건' : '없음'} · FAQ ${faqCount}건 — 확인하신 뒤 사이트에 나갑니다.`,
'소개문·FAQ 를 다시 만들었습니다',
`${parts.join(' · ')} — FAQ 탭에서 확인할 수 있습니다.`,
);
}