prompt.ts
3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import type { writePromptParam } from "@/app/types/prompt";
export function getWrtingPrompt(param: writePromptParam): string {
const {
isImgName,
writingPurposeName: rawPurpose,
writingStyleName: rawStyle,
writingTypeName: rawType,
writingLanguageName,
prompt,
writingCount,
} = param;
const purposeMap: Record<string, string> = {
公司官网: "公司官网的介绍",
小红书: "小红书的介绍",
微信: "微信的介绍",
公众号: "公众号的介绍",
今日头条: "今日头条的介绍",
};
const styleMap: Record<string, string> = {
专业: "专业的风格",
活泼: "活泼的风格",
严谨: "严谨的风格",
};
const typeMap: Record<string, string> = {
产品推广文案: "产品推广的文案",
品牌宣传文案: "品牌宣传的文案",
产品说明书: "产品的说明书",
产品介绍: "产品的介绍",
};
let isImg = "";
if (isImgName === "是") {
const purpose = purposeMap[rawPurpose] || "公司官网的介绍";
const style = styleMap[rawStyle] || "专业的风格";
isImg = `文案要配上图片,实现图文混排,要美观,要符合${purpose}的排版标准和写作风格,写作风格要${style},
你没有图片没关系,把图文混排的效果实现,并在你认为要插入图片的地方将图片的Prompt用英文输出给:,记得图片地址后面的?nologo=true一定不能去掉了,
因为这个语法可以自动按照提示生成并渲染图片。你可以帮我大幅提高生成图片质量和丰富程度,比如增加相机光圈、具体场景描述等内容,注意图片一定要用<img,否则在HTML下图片可能显示不了`;
}
const writingTypeName = typeMap[rawType] || "产品推广文案";
const input = `帮我使用${writingLanguageName}写一篇主题是${prompt}的${writingTypeName},${isImg},字数要求不少于${writingCount}字,
字数不包括html代码和图片Prompt。输出成标准的html并且样式必须为内联样式,直接给结果,不要做任何解释`;
return input;
}
export function getBgPrompt(content: string) {
const input = `你现扮演生成创意思图片的提示词工程师,参考我的描述“${content}”帮我做优化润色5组,返回的数据用''分割,直接输出结果,不要做解释`;
return input;
}
export function getMindPrompt(content: string, isContext: boolean) {
const context = `联系上下文`;
let prompt = `请你帮我生成一份以"${content}"为主题的思维导图数据,请严格遵循以下要求生成思维导图数据:
1. 所有键名必须使用双引号
2. 所有字符串值必须使用双引号
3. 确保没有尾随逗号
4. 按这个模板结构生成::{
"nodeData": {
"id": "root",
"topic": "中心主题",
"children": [
{
"id": "d451a724b7c10970",
"topic": "sub1",
"children": [
{
"id": "d451a77ca7348eae",
"topic": "sub2",
},],
},
],
},}
只需要返回数据,不要做任何解释
`;
if (isContext) {
prompt = context + prompt;
}
return prompt;
}