haixunMaster/lib/ai/prompts/outreach-placement.ts

72 lines
4.1 KiB
TypeScript
Raw Normal View History

2026-06-21 12:50:31 +00:00
import { buildPersonaPromptBlock } from "../persona";
import type { CtaType } from "@/lib/types/product-context";
export function buildPlacementOutreachSystemPrompt(persona?: string | null): string {
return `你是 Threads 上會留言的真人網友,不是業務也不是客服。任務是針對「有需求、有困擾」的貼文,寫出溫暖、有溫度、有幫助的留言草稿,讓對方覺得「有人懂我」並願意繼續聊。
${buildPersonaPromptBlock(persona)}
-
-
- +1
-
1. ****
2. ****
3. ****
4. **** hashtag
5. ****
6. **Threads ** emoji01
7. ****使
500 2 / `;
}
function buildCtaBlock(ctaType?: CtaType | null, ctaUrl?: string | null): string {
const url = ctaUrl?.trim();
switch (ctaType) {
case "link":
if (url) {
return `\nCTA只在「其中一則」草稿建議帶品牌那則最後像順手分享般附上連結 ${url}(例如「我自己用的是這個 ${url}」)。其餘草稿不要放連結。整體不要超過一次、不要像廣告。`;
}
return "\nCTA未提供網址所有草稿都不要出現任何連結或網址。";
case "dm":
return "\nCTA可在其中一則草稿自然引導私訊例如「需要的話可以私訊我聊」語氣輕、不強迫最多一則。";
case "follow":
return "\nCTA可在其中一則草稿自然引導追蹤例如「我都在分享這類經驗」以幫助對方為主最多一則。";
default:
return "\nCTA不需要刻意帶行動呼籲自然結尾即可。";
}
}
export function buildPlacementOutreachUserPrompt(input: {
topicLabel?: string | null;
audienceBrief?: string | null;
productBrief: string;
placementReason?: string | null;
targetText: string;
authorName?: string | null;
repliesBlock: string;
count: number;
ctaType?: CtaType | null;
ctaUrl?: string | null;
}): string {
return `主題方向:${input.topicLabel ?? "未指定"}
${input.audienceBrief ? `受眾與情境:${input.audienceBrief}` : ""}
${input.productBrief}
${input.placementReason ? `\n為何適合留言${input.placementReason}` : ""}
${buildCtaBlock(input.ctaType, input.ctaUrl)}
@${input.authorName ?? "匿名"}
${input.targetText}
${input.repliesBlock || "(無)"}
${input.count} 稿 angle rationale `;
}