talk / backend /sql /006_admin_laugh_templates.sql
user
Deploy StyleVoiceChat backend
aa9892b
Raw History Blame Contribute Delete
1.75 kB
-- Phase 1 (laugh register): κ΄€λ¦¬μžκ°€ λ“±λ‘ν•œ λŒ€ν‘œ μ›ƒμŒ wav ν…œν”Œλ¦Ώ.
--
-- μ‚¬μš© 흐름:
-- 1. admin ν™”λ©΄μ—μ„œ λŒ€ν‘œ μ—¬μ„± μ›ƒμŒ wav μ—…λ‘œλ“œ (e.g. "ν‘Έν•˜ν•˜ short", "κΉ”κΉ” medium")
-- 2. μ‚¬μš©μžκ°€ μŒμ„± 등둝 μ‹œ (apply_dual 직후), λͺ¨λ“  active ν…œν”Œλ¦Ώμ— λŒ€ν•΄
-- stylevoice-vc 둜 source=template, target=user_ref VC μ‹€ν–‰
-- 3. κ²°κ³Ό wav λ₯Ό user 별 캐싱 κ²½λ‘œμ— μ €μž₯ β†’ μ±„νŒ… chunker κ°€ μ›ƒμŒ 토큰
-- 감지 μ‹œ μΊμ‹±λœ λ³€ν™˜ wav μž¬μƒ (TTS skip)
--
-- νŒŒμΌμ€ 'voice-clones' λ²„ν‚·μ˜ 'admin/laugh/{uuid}.wav' κ²½λ‘œμ— μ €μž₯.
-- service_role 만 μ ‘κ·Ό (admin endpoint ν†΅ν•΄μ„œλ§Œ μˆ˜μ •).
CREATE TABLE IF NOT EXISTS public.admin_laugh_templates (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL,
storage_path TEXT NOT NULL UNIQUE,
duration_sec REAL,
length_class TEXT NOT NULL DEFAULT 'medium'
CHECK (length_class IN ('short', 'medium', 'long')),
is_active BOOLEAN NOT NULL DEFAULT TRUE,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS admin_laugh_templates_active_idx
ON public.admin_laugh_templates (is_active, length_class)
WHERE is_active = TRUE;
ALTER TABLE public.admin_laugh_templates ENABLE ROW LEVEL SECURITY;
-- μ •μ±… μ—†μŒ: service_role 만 μ ‘κ·Ό.
COMMENT ON TABLE public.admin_laugh_templates IS
'Phase 1 (laugh register): admin 이 λ“±λ‘ν•˜λŠ” λŒ€ν‘œ μ›ƒμŒ ν…œν”Œλ¦Ώ. user μŒμ„± 등둝 μ‹œ VC λ³€ν™˜μ˜ source 둜 μ‚¬μš©.';
COMMENT ON COLUMN public.admin_laugh_templates.length_class IS
'ν…μŠ€νŠΈ 길이 맀칭용: short (~1.5s, "ν‘Έν•˜"), medium (~2-3s, "ν‘Έν•˜ν•˜ν•˜"), long (~4-5s, "μœΌν•˜ν•˜ν•˜ν•˜ λ„ˆλ¬΄ 웃겨")';