finished
This commit is contained in:
1 parent
369f530ec5
commit
79ec5daa0d
11 files changed
+768
-313
No files matched your search
+102
-78
@@ -2,92 +2,116 @@ from openai import AsyncOpenAI
|
||||
|
||||
from config import apikey_settings
|
||||
|
||||
# fmt: off
|
||||
LYRICS_PROMPT_TEMPLATE_ORI = """
|
||||
1.Act as a content marketing expert with domain knowledges in [pension/staying services] in Korea, Goal: plan viral content creation that lead online reservations and promotion
|
||||
2.Conduct an in-depth analysis of [업체명:{customer_name}] in [지역명:{region}] by examining their official website or informations, photos on never map and online presence. Create a comprehensive "[지역 상세: {detail_region_info}]_Brand & Marketing Intelligence Report in Korean, that includes:
|
||||
|
||||
**Core Analysis:**
|
||||
- Target customer segments & personas
|
||||
- Unique Selling Propositions (USPs) and competitive differentiators
|
||||
- Comprehensive competitor landscape analysis (direct & indirect competitors)
|
||||
- Market positioning assessment
|
||||
|
||||
**Content Strategy Framework:**
|
||||
- Seasonal content calendar with trend integration
|
||||
- Visual storytelling direction (shot-by-shot creative guidance)
|
||||
- Brand tone & voice guidelines
|
||||
- Content themes aligned with target audience behaviors
|
||||
|
||||
**SEO & AEO Optimization:**
|
||||
- Recommended primary and long-tail keywords
|
||||
- SEO-optimized taglines and meta descriptions
|
||||
- Answer Engine Optimization (AEO) content suggestions
|
||||
- Local search optimization strategies
|
||||
|
||||
**Actionable Recommendations:**
|
||||
- Content distribution strategy across platforms
|
||||
- KPI measurement framework
|
||||
- Budget allocation recommendations by content type
|
||||
|
||||
콘텐츠 기획(Lyrics, Prompt for SUNO)
|
||||
1. Based on the Brand & Marketing Intelligence Report for [업체명 + 지역명 / {customer_name} ({region})], create original lyrics and define music attributes (song mood, BPM, genres, and key musical motifs, Prompt for Suno.com) specifically tailored for viral content.
|
||||
2. The lyrics should include, the name of [ Promotion Subject], [location], [main target],[Famous place, accessible in 10min], promotional words including but not limited to [인스타 감성], [사진같은 하루]
|
||||
|
||||
Deliver outputs optimized for three formats:1 minute. Ensure that each version aligns with the brand's core identity and is suitable for use in digital marketing and social media campaigns, in Korean
|
||||
""".strip()
|
||||
# fmt: on
|
||||
|
||||
LYRICS_PROMPT_TEMPLATE = """
|
||||
[ROLE]
|
||||
Content marketing expert specializing in pension/accommodation services in Korea
|
||||
|
||||
[INPUT]
|
||||
- Business Name: {customer_name}
|
||||
- Region: {region}
|
||||
- Region Details: {detail_region_info}
|
||||
|
||||
[INTERNAL ANALYSIS - DO NOT OUTPUT]
|
||||
Analyze the following internally to inform lyrics creation:
|
||||
- Target customer segments and personas
|
||||
- Unique Selling Propositions (USPs)
|
||||
- Regional characteristics and nearby attractions (within 10 min access)
|
||||
- Seasonal appeal points
|
||||
|
||||
[LYRICS REQUIREMENTS]
|
||||
- Must include: business name, region name, main target audience, nearby famous places
|
||||
- Keywords to incorporate: 인스타 감성, 사진같은 하루, 힐링, 여행
|
||||
- Length: For 1-minute video (approximately 8-12 lines)
|
||||
- Tone: Emotional, trendy, viral-friendly
|
||||
|
||||
[OUTPUT RULES - STRICTLY ENFORCED]
|
||||
- Output lyrics ONLY
|
||||
- Lyrics MUST be written in Korean (한국어)
|
||||
- NO titles, descriptions, analysis, or explanations
|
||||
- NO greetings or closing remarks
|
||||
- NO additional commentary before or after lyrics
|
||||
- Follow the exact format below
|
||||
|
||||
[OUTPUT FORMAT - SUCCESS]
|
||||
---
|
||||
[Lyrics in Korean here]
|
||||
---
|
||||
|
||||
[OUTPUT FORMAT - FAILURE]
|
||||
If you cannot generate lyrics due to insufficient information, invalid input, or any other reason:
|
||||
---
|
||||
ERROR: [Brief reason for failure in English]
|
||||
---
|
||||
""".strip()
|
||||
# fmt: on
|
||||
|
||||
|
||||
class ChatgptService:
|
||||
def __init__(self):
|
||||
def __init__(
|
||||
self,
|
||||
customer_name: str,
|
||||
region: str,
|
||||
detail_region_info: str = "",
|
||||
):
|
||||
# 최신 모델: GPT-5, GPT-5 mini, GPT-5 nano, GPT-4.1, GPT-4.1 mini, GPT-4.1 nano
|
||||
# 이전 세대: GPT-4o, GPT-4o mini, GPT-4 Turbo, GPT-3.5 Turbo
|
||||
self.model = "gpt-4o"
|
||||
self.client = AsyncOpenAI(api_key=apikey_settings.CHATGPT_API_KEY)
|
||||
self.customer_name = customer_name
|
||||
self.region = region
|
||||
self.detail_region_info = detail_region_info
|
||||
|
||||
def lyrics_prompt(
|
||||
self,
|
||||
name,
|
||||
address,
|
||||
category,
|
||||
description,
|
||||
season,
|
||||
num_of_people,
|
||||
people_category,
|
||||
genre,
|
||||
sample_song=None,
|
||||
):
|
||||
prompt = f"""
|
||||
반드시 한국어로 답변해주세요.
|
||||
|
||||
당신은 작곡가 입니다.
|
||||
|
||||
작곡에 대한 영감을 얻기 위해 제가 정보를 제공할게요.
|
||||
|
||||
업체 이름 : {name}
|
||||
업체 주소 : {address}
|
||||
업체 카테고리 : {category}
|
||||
업체 설명 : {description}
|
||||
|
||||
가사는 다음 속성들을 기반하여 작곡되어야 합니다.
|
||||
|
||||
###
|
||||
|
||||
위의 정보를 토대로 작곡을 이어나가주세요.
|
||||
|
||||
다음은 노래에 대한 정보입니다.
|
||||
|
||||
노래의 길이 :
|
||||
- 1분 이내입니다.
|
||||
- 글자 수는 120자에서 150자 사이로 작성해주세요.
|
||||
- 글자가 갑자기 끊기지 않도록 주의해주세요.
|
||||
|
||||
노래의 특징:
|
||||
- 노래에 업체의 이름은 반드시 1번 이상 들어가야 합니다.
|
||||
- 노래의 전반부는, 업체에 대한 장점과 특징을 소개하는 가사를 써주세요.
|
||||
- 노래의 후반부는, 업체가 위치한 곳을 소개하는 가사를 써주세요.
|
||||
|
||||
답변에 [전반부], [후반부] 표시할 필요 없이, 가사만 답변해주세요.
|
||||
(후크)와 같이 특정 동작에 대해 표시할 필요 없습니다.
|
||||
|
||||
노래를 한 마디씩 생성할 때마다 글자수를 세어보면서, 글자 수가 150자를 넘지 않도록 주의해주세요.
|
||||
|
||||
"""
|
||||
|
||||
if sample_song:
|
||||
prompt += f"""
|
||||
|
||||
다음은 참고해야 하는 샘플 가사 정보입니다.
|
||||
|
||||
샘플 가사를 참고하여 작곡을 해주세요.
|
||||
|
||||
{sample_song}
|
||||
"""
|
||||
|
||||
return prompt
|
||||
|
||||
async def generate_lyrics(self, prompt=None):
|
||||
# prompt = self.lyrics_prompt(
|
||||
# name,
|
||||
# address,
|
||||
# category,
|
||||
# description,
|
||||
# season,
|
||||
# num_of_people,
|
||||
# people_type,
|
||||
# genre,
|
||||
# sample_song,
|
||||
# )
|
||||
def build_lyrics_prompt(self) -> str:
|
||||
"""LYRICS_PROMPT_TEMPLATE에 고객 정보를 대입하여 완성된 프롬프트 반환"""
|
||||
return LYRICS_PROMPT_TEMPLATE.format(
|
||||
customer_name=self.customer_name,
|
||||
region=self.region,
|
||||
detail_region_info=self.detail_region_info,
|
||||
)
|
||||
|
||||
async def generate_lyrics(self, prompt: str | None = None) -> str:
|
||||
"""GPT에게 프롬프트를 전달하여 결과를 반환"""
|
||||
if prompt is None:
|
||||
prompt = self.build_lyrics_prompt()
|
||||
print("Generated Prompt: ", prompt)
|
||||
completion = await self.client.chat.completions.create(
|
||||
model=self.model, messages=[{"role": "user", "content": prompt}]
|
||||
)
|
||||
message = completion.choices[0].message.content
|
||||
return message
|
||||
|
||||
|
||||
chatgpt_api = ChatgptService()
|
||||
return message or ""
|
||||
Reference in new issue
Block a user