Spaces:
Sleeping
Sleeping
Download backend/sql/008_laugh_kinds.sql from stylevoice/talk: direct link, hf CLI and curl.
- Browser
- Download file 4.15 kB
-
https://huggingface.co/spaces/stylevoice/talk/resolve/main/backend/sql/008_laugh_kinds.sql
- Command line
-
hf download hf://spaces/stylevoice/talk/backend/sql/008_laugh_kinds.sql
-
curl -L -o 008_laugh_kinds.sql https://huggingface.co/spaces/stylevoice/talk/resolve/main/backend/sql/008_laugh_kinds.sql
4.15 kB
| -- Phase 4 (laugh register): μμ μ’ λ₯ (kind) λ©ν + ν€μλ λ§€ν. | |
| -- | |
| -- λ°°κ²½: κΈ°μ‘΄ admin_laugh_templates λ length_class λ§μΌλ‘ λΆλ₯νλλ°, | |
| -- γ γ γ κ°μ μ§§μ μμμ 2μ΄ wav κ° κ³Όν΄μ "μ§§μ/κΈ΄" κΈΈμ΄ λΆν + "κΈ°λ³Έ/μμ€μ/λ°μ₯λμ/ν₯ν₯" | |
| -- κ°μ ν€λ³ λΆλ₯κ° νμν΄μ‘λ€. μ΄ λ§μ΄κ·Έλ μ΄μ μ κΈΈμ΄ λΆν μ μΌλ¨ λκ³ | |
| -- (νμ¬ length_class 컬λΌμ κ·Έλλ‘ μ μ§) **μ’ λ₯** μΆλ§ μλ‘ λμ νλ€. | |
| -- | |
| -- ν€μλλ admin UI μμ νΈμ§ κ°λ₯ (laugh_kinds.keywords text[]). λ°νμ λΆλ₯κΈ° | |
| -- (`laugh_split.classify_laugh_kind`) κ° μ΄ ν μ΄λΈμ μΊμν΄μ ν μ€νΈ β kind λ§€ν. | |
| -- priority κ° λμμλ‘ λ¨Όμ λ§€μΉ (μ: 'shy' μ 'γ γ ' κ° 'default' μ μΌλ° λ§€μΉλ³΄λ€ | |
| -- λ¨Όμ μ‘νλλ‘). | |
| CREATE TABLE IF NOT EXISTS public.laugh_kinds ( | |
| kind TEXT PRIMARY KEY, -- 'default' | 'shy' | 'burst' | 'chuckle' (νμ₯ κ°λ₯) | |
| label TEXT NOT NULL, -- νκΈ νμλͺ (admin UI) | |
| keywords TEXT[] NOT NULL DEFAULT '{}', -- λ§€μΉ ν ν° (μ: ['γ γ ','ν€ν€','νν']) | |
| priority INT NOT NULL DEFAULT 0, -- λ§€μΉ μ°μ μμ (λμ κ° λ¨Όμ ) | |
| is_active BOOLEAN NOT NULL DEFAULT TRUE, | |
| description TEXT, -- admin λ©λͺ¨ | |
| created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), | |
| updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() | |
| ); | |
| ALTER TABLE public.laugh_kinds ENABLE ROW LEVEL SECURITY; | |
| -- μ μ± μμ: service_role λ§ μ κ·Ό (admin endpoint ν΅ν΄μλ§ μμ ). | |
| COMMENT ON TABLE public.laugh_kinds IS | |
| 'Phase 4 (laugh register): μμ μ’ λ₯ λ©ν + ν€μλ λ§€ν. admin UI μμ νΈμ§ κ°λ₯.'; | |
| COMMENT ON COLUMN public.laugh_kinds.priority IS | |
| 'λ§€μΉ μ°μ μμ β burst/shy/chuckle μ²λΌ μ’μ λ§€μΉμ΄ default λ³΄λ€ λ¨Όμ μ‘νμΌ νλ€.'; | |
| -- μ΄κΈ° μλ β 4μ’ + ν©μλ ν€μλ. | |
| -- priority: burst > chuckle > shy > default (μ’μ λ§€μΉ μ°μ ) | |
| INSERT INTO public.laugh_kinds (kind, label, keywords, priority, description) VALUES | |
| ('burst', 'λ°μ₯λμ', ARRAY['νΈνν','νΈν','μΌνν','μΌν','μνν','κΉκΉ','μΊ¬μΊ¬','μΊ¬ν'], 30, | |
| 'ν°μ§λ μμ β ν° μλ¦¬λ‘ κ°μμ€λ½κ² ν°μ Έ λμ΄.'), | |
| ('chuckle', 'ν₯ν₯/μ°Έλμμ', ARRAY['ν₯ν₯','λλ','μΏ‘μΏ‘','νΈν«','ν','νΌμ'], 20, | |
| 'μ°Έλ€ μλ μ§§μ μμ.'), | |
| ('shy', 'μμ€μ', ARRAY['γ γ ','γ γ γ ','ν€ν€','ν€ν·','νν','νν£','νν','νν'], 10, | |
| 'λΆλλ½κ³ μμ μμ.'), | |
| ('default', 'κΈ°λ³Έ', ARRAY['νν','ννν','γ γ ','γ γ γ ','γ γ γ γ ','ν¬ν¬','νΈνΈ'], 0, | |
| 'μΌλ° μμ β λ§€μΉ μλ λͺ¨λ μμμ ν΄λ°±.') | |
| ON CONFLICT (kind) DO NOTHING; | |
| -- admin_laugh_templates: kind μ»¬λΌ μΆκ° (FK λ κ΅³μ΄ μ κ² β κ°λ²Όμ΄ lookup). | |
| ALTER TABLE public.admin_laugh_templates | |
| ADD COLUMN IF NOT EXISTS kind TEXT NOT NULL DEFAULT 'default'; | |
| CREATE INDEX IF NOT EXISTS admin_laugh_templates_kind_active_idx | |
| ON public.admin_laugh_templates (kind, is_active) | |
| WHERE is_active = TRUE; | |
| -- user_laugh_cache: kind μ»¬λΌ μΆκ° (admin_laugh_templates.kind λκΈ° β μ‘°μΈ λΉμ© μ€μ΄λ €κ³ | |
| -- λ―Έλ¬λ§). μ νμ _convert_one μ΄ μ±μ°κ³ , κΈ°μ‘΄ νμ μλ λ°±ν + μΆν rebuild_for_voice | |
| -- μλ κ°±μ . | |
| ALTER TABLE public.user_laugh_cache | |
| ADD COLUMN IF NOT EXISTS kind TEXT NOT NULL DEFAULT 'default'; | |
| -- κΈ°μ‘΄ cache νμ kind λ°±ν β ν νλ¦Ώμμ λμ΄μ΄. | |
| UPDATE public.user_laugh_cache c | |
| SET kind = t.kind | |
| FROM public.admin_laugh_templates t | |
| WHERE c.template_id = t.id | |
| AND (c.kind IS NULL OR c.kind = 'default') | |
| AND t.kind <> 'default'; | |
| CREATE INDEX IF NOT EXISTS user_laugh_cache_kind_idx | |
| ON public.user_laugh_cache (user_id, voice_storage_path, kind) | |
| WHERE ready = TRUE; | |
| COMMENT ON COLUMN public.admin_laugh_templates.kind IS | |
| 'μμ μ’ λ₯ (laugh_kinds.kind μ°Έμ‘°). μ±ν chunker κ° ν μ€νΈβkind λΆλ₯ ν λ§€μΉ.'; | |
| COMMENT ON COLUMN public.user_laugh_cache.kind IS | |
| 'admin_laugh_templates.kind λ―Έλ¬ β μ‘°ν λ¨μνμ©.'; | |