fix: simplify Perplexity prompt — short system + direct user query

Long system prompt caused sonar-pro to return empty results.
Reverted to sonar model with short, proven prompt pattern that
matches the user's successful manual test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
claude/bold-hawking
Haewon Kam 2026-04-04 01:32:54 +09:00
parent e64d168d34
commit ac2da7a4ac
2 changed files with 5 additions and 81 deletions

View File

@ -5,89 +5,13 @@
* Model: sonar-pro (advanced web search with multi-step reasoning) * Model: sonar-pro (advanced web search with multi-step reasoning)
*/ */
export const RESEARCH_SYSTEM_PROMPT = `당신은 성형외과/피부과 병원의 온라인 프레즌스를 조사·정리하는 리서치 전문가 에이전트입니다. export const RESEARCH_SYSTEM_PROMPT = `You are a social media researcher. Search the web and find social media accounts for Korean medical clinics. Respond ONLY with valid JSON, no explanation.`;
:
- Online Presence ·
(, , , / ) .
:
1)
- 2~3 .
- "<병원명> 유튜브 채널"
- "<병원명> 인스타그램"
- "<병원명> 후기 리뷰"
- URL :
-
- YouTube /
- Instagram
- / (, , RealSelf, Bookimed, , )
2)
:
- , URL, @
- ( )
-
-
:
- ID (@handle) (, , )
-
-
-
:
-
- (//)
·:
- : (/10), , URL
- :
- Google Maps: ,
- (, RealSelf )
///:
- URL
- / ( )
3)
JSON . JSON .
{
"clinicName": "병원 한국어 이름",
"clinicNameEn": "English name",
"channels": {
"instagram": [
{"handle": "@handle", "followers": __null, "posts": __null, "type": "공식/영문/원장 등", "url": "URL"}
],
"youtube": [
{"handle": "@handle_또는_채널명", "channelUrl": "URL", "subscribers": __null, "videos": __null, "contentType": "설명"}
],
"facebook": {"handle": "페이지명", "url": "URL", "followers": __null},
"tiktok": {"handle": "@handle", "url": "URL", "followers": __null},
"naverBlog": {"blogId": "ID", "url": "URL"},
"kakao": {"channelId": "ID", "url": "URL"},
"website": {"domain": "도메인", "languages": ["ko", "en"]}
},
"platforms": {
"gangnamUnni": {"registered": true, "url": "URL", "rating": __null, "ratingScale": 10, "reviews": __null},
"naverPlace": {"registered": true, "rating": __null, "reviews": __null},
"googleMaps": {"rating": __null, "reviews": __null},
"babitok": {"registered": true}
},
"summary": "1-2문장 온라인 프레즌스 요약"
}
4)
- , null
-
- JSON `;
/** /**
* Build the user prompt for the research agent. * Build the user prompt for the research agent.
*/ */
export function buildResearchUserPrompt(clinicName: string, websiteUrl?: string): string { export function buildResearchUserPrompt(clinicName: string, websiteUrl?: string): string {
return `"${clinicName}" 병원의 Online Presence를 위 규칙대로 분석해줘.${websiteUrl ? ` 공식 웹사이트: ${websiteUrl}` : ''}`; return `${clinicName} 병원의 인스타그램, 유튜브, 페이스북, 틱톡, 네이버블로그, 카카오채널 계정을 검색해서 찾아줘. 강남언니, 네이버 플레이스, 바비톡 등록 현황도 검색해줘. 인스타그램은 여러 계정이 있을 수 있어 (국문용, 영문용 등). 검색 결과에서 발견된 모든 계정을 알려줘.${websiteUrl ? ` 공식 웹사이트: ${websiteUrl}` : ''}
{"channels":{"instagram":[{"handle":"@handle","followers":}],"youtube":[{"handle":"@handle","subscribers":}],"facebook":"page","tiktok":"@handle","naverBlog":"blogId","kakao":"channelId","website":"${websiteUrl || 'domain'}"},"platforms":{"gangnamUnni":{"registered":true,"url":"URL","rating":,"reviews":},"naverPlace":{"registered":true},"babitok":{"registered":true}}}`;
} }

View File

@ -294,7 +294,7 @@ Deno.serve(async (req) => {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json", Authorization: `Bearer ${PERPLEXITY_API_KEY}` }, headers: { "Content-Type": "application/json", Authorization: `Bearer ${PERPLEXITY_API_KEY}` },
body: JSON.stringify({ body: JSON.stringify({
model: "sonar-pro", model: "sonar",
messages: [ messages: [
{ role: "system", content: RESEARCH_SYSTEM_PROMPT }, { role: "system", content: RESEARCH_SYSTEM_PROMPT },
{ role: "user", content: buildResearchUserPrompt(resolvedName, url) }, { role: "user", content: buildResearchUserPrompt(resolvedName, url) },