66 lines
2.6 KiB
TypeScript
66 lines
2.6 KiB
TypeScript
import { withAgentSystem } from "./agent";
|
||
import { HASHTAG_USER_REMINDER, HASHTAG_WRITING_RULES } from "./hashtag-rules";
|
||
import { buildPersonaPromptBlock } from "./persona";
|
||
|
||
export function buildSystemPrompt(persona?: string | null): string {
|
||
return withAgentSystem(`你是 Threads(脆)內容策略師,根據熱門貼文與留言趨勢,為使用者撰寫原創貼文草稿。
|
||
|
||
${buildPersonaPromptBlock(persona)}
|
||
|
||
## 寫作規則
|
||
- 必須原創改寫,不可抄襲或大量複製參考貼文
|
||
- 開頭要有強 hook,吸引滑手機的人停下來;hook 風格要符合人設的開場習慣
|
||
- 每篇貼文 ≤ 500 字(含標點、emoji、#話題標籤)
|
||
${HASHTAG_WRITING_RULES}
|
||
- 繁體中文台灣用語,但**語感與節奏必須像創作者本人**,不是通用 AI 模板
|
||
- 可回應留言中常見的疑問或痛點
|
||
- 避免過度推銷、空泛雞湯
|
||
- 每篇要有明確切入角度(angle)與撰寫理由(rationale)
|
||
- **知識型內容**(健康、數據、步驟、科學等):只寫你有把握的事實,不捏造劑量/療效;rationale 註明「發布前需網路查證:…」`);
|
||
}
|
||
|
||
export function buildUserPrompt(params: {
|
||
topicLabel: string;
|
||
posts: Array<{
|
||
text: string;
|
||
authorName?: string | null;
|
||
permalink?: string | null;
|
||
likeCount?: number | null;
|
||
replyCount?: number | null;
|
||
replies?: Array<{ text: string; authorName?: string | null; likeCount?: number | null }>;
|
||
}>;
|
||
count: number;
|
||
}): string {
|
||
const materials = params.posts
|
||
.map((post, i) => {
|
||
const repliesBlock =
|
||
post.replies && post.replies.length > 0
|
||
? `\n 熱門留言:\n${post.replies
|
||
.map(
|
||
(r) =>
|
||
` - @${r.authorName ?? "匿名"}(${r.likeCount ?? 0} 讚):${r.text}`
|
||
)
|
||
.join("\n")}`
|
||
: "";
|
||
|
||
return `${i + 1}. @${post.authorName ?? "匿名"}(${post.likeCount ?? 0} 讚 / ${post.replyCount ?? 0} 留言)
|
||
內容:${post.text}
|
||
連結:${post.permalink ?? "無"}${repliesBlock}`;
|
||
})
|
||
.join("\n\n");
|
||
|
||
return `主題:${params.topicLabel}
|
||
|
||
以下是今日海巡到的熱門素材:
|
||
|
||
${materials}
|
||
|
||
請根據以上素材,生成 ${params.count} 篇 Threads 貼文草稿。
|
||
每篇需標註參考了哪些 permalink(sourcePermalinks 陣列)。
|
||
|
||
寫作提醒:
|
||
- 素材只借觀點與共鳴點,文筆必須完全像創作者本人
|
||
- 若有代表句範例,每篇至少有一句的語感要接近那些句子
|
||
- 讀起來要像會讓粉絲停下來看、想留言的脆文,不要像摘要或論文
|
||
- ${HASHTAG_USER_REMINDER}`;
|
||
} |