[feat] solution,postgres-init: FAQ 를 20개까지 채운다 — 펜션 공통 질문 30개 + 문의 안내
COPY 잡은 확인된 fact 로만 FAQ 를 써서 4~8개에서 끝났다(실측 로컬: 스테이머뭄 fact 8건, 산하연 풀빌라 fact 4건 · FAQ 4건). fact 가 0건이면 start_copy 가 FAQ_UNGROUNDED 로 잡을 만들지 않아 0개였다. 생성 상한을 20으로 올리고, 모자라면 펜션 카탈로그에서 겹치지 않는 질문을 **문의 안내** 답으로 채운다. 공통 답에 값·가능 여부를 적으면 업종 시드 FAQ 가 가공의 가격을 사이트에 내보낸 사고와 같다 — 답은 "…은 전화(…)로 문의해 주시면 안내해 드립니다" 뿐이고, 그래서 화면에만 나간다. - common/faq_catalog(신규): 로더 + resources/pension.json 30문항. fact_keys 가 업종 스키마에 없으면 로드 시 예외 - services/faq_fill.py(신규): 고르기 규칙 — fact 로 답할 수 있는 질문 · 기존 FAQ 와 근거 key 또는 질문 키워드가 겹치는 질문은 건너뛴다(LLM 은 "주차 및 와이파이" 처럼 묶어 쓰고, 사장님 입력은 근거 key 가 없다) - copy_service: max_faqs=20, 생성 뒤 _fill_faqs. 근거가 없거나 키가 없으면 LLM 없이 채우기만 - place_service.start_copy: 카탈로그가 있으면 fact 0건이어도 잡 생성(FAQ_UNGROUNDED 는 카탈로그 없는 업종만) - SourceType.TEMPLATE=5(백엔드·shared·orval 모델). fact_service 규칙 4 로 fact 에는 못 쓴다 - faq_crud.expire_generated: TEMPLATE 도 재생성 때 내린다 — 새 fact 로 답이 생긴 주제에 옛 문의 안내가 남지 않게 - prompts/copy: fact 로 답할 수 있는 카탈로그 질문을 싣고 "한 문항 한 주제" 규칙(생성 FAQ 4건 중 3건이 묶여 있었다) - shared selectAnsweredFaqs · jsonld · llms · prerender(↔ conftest) · seo_audit: 문의 안내는 FAQPage JSON-LD · llms.txt · 고유 콘텐츠 계수 · FAQ 점수에서 뺀다 — 모든 펜션에 같은 문구라 세면 빈 사이트가 게이트를 통과한다 - site FaqSection: 문의 안내가 섞이면 "모두 사업자가 확인한 내용" 문구를 달지 않는다 - frontend FaqPanel "노출 N건 (문의 안내 M)" · notifyCopy 가 faq_fill 을 본다 - postgres-init: 컬럼 변경 없음(CHECK 없는 SMALLINT). 0012 + init.sql 에 generated_by·source_fact_ids COMMENT ON, 0012 는 컬럼이 있을 때만(DO $$ IF EXISTS). init.sql 의 "비면 발행 게이트가 반려" 주석은 사실이 아니어서 고쳤다 - docs/DECISIONS.md 8절 · DATA_MODEL.md · DEVLOG.md 백엔드 664 passed(신규 test_faq_fill 10건 · test_copy_api 3건). 실패 2건은 이 변경 전 HEAD 에서도 같다: test_rate_limit_closes_the_tap · test_사이트_디렉터리_밖의_thumbs_에_올린다 site·frontend·admin tsc 통과 · site vitest 63 passed · FaqPanel·collectNotify eslint 통과 로컬 실사업장(하늘물빛정원, fact 4건): 생성 4건 + 문의 안내 16건 = 20건, 질문 중복 0 0012: 새 DB(init.sql → migrate 규칙)와 로컬 DB 사본 양쪽에서 두 번씩 적용 통과 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011yLDuinzgyCxmqAutE1tse
This commit is contained in:
1 parent
b2c8bb033e
commit
8a09af6599
29 files changed
+804
-62
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 탭에서 확인할 수 있습니다.`,
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user