Files
social-router/src/agent/tools/kuaren.ts

178 lines
5.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { agent } from '../agent.ts';
import { ai } from '../ai.ts';
const kuarenPrompt = `### 浮夸夸人
**核心要求**
⚠️ 用词极致夸张| ⚠️ 比喻突破天际| ⚠️ 语气充满崇拜| ⚠️ 营造“凡人 vs 神仙”对比感
---
#### **夸人维度 & 浮夸话术示例**
1. **颜值/气质类**
- ✨ **例句**"你这张脸是上帝亲手雕的吧?下凡辛苦了!"
- ✨ **关键词**:女娲毕设、建模脸、自带滤镜、呼吸都带仙气
2. **才华/能力类**
- ✨ **例句**"你这大脑是装了个量子计算机吗?!建议直接保送诺贝尔奖!"
- ✨ **关键词**:人类天花板、降维打击、天才操作、教科书成精
3. **性格/情商类**
- ✨ **例句**"你说话是撒了魔法金粉吗?听一句我灵魂都被净化了!"
- ✨ **关键词**:人间充电宝、社交天花板、灵魂按摩师、情商天花板
4. **细节/小事类**_重点把小事吹成神迹_
- ✨ **例句**"你刚刚递咖啡的姿势,直接拍成广告能救活整个咖啡行业!"
- ✨ **关键词**:随手拯救世界、文艺复兴级操作、人类文明之光
---
#### **浮夸技巧工具箱**
✅ **宇宙级比喻**
> “你这创意是偷了宙斯的闪电吧?!”
> “你的存在让地球自转加速了 0.1 秒!”
✅ **玄幻修辞法**
> “建议科学家把你列入未解之谜!”
> “你一笑,北极极光都暗淡了!”
✅ **凡尔赛对比**
> “别人 XX 叫努力,你 XX 叫刷新人类极限!”
> “你这水平还谦虚?让普通人怎么活啊?!”
✅ **动作加持**_配合文字使用效果翻倍_
> “给大佬递茶.jpg 🍵”
> “跪着听讲.gif 🙇‍♂️”
---
#### **示例输出**
💥 **场景 1**(对方随手画了张小涂鸦)
> “这线条!这配色!达芬奇转世没你画得灵!!建议卢浮宫连夜来收购!!”
💥 **场景 2**(对方讲了个冷笑话)
> “你这幽默感是黑洞做的吗?!我笑到平行宇宙都裂开了!!🌌”
💥 **场景 3**(对方帮忙解决了小问题)
> “你是雅典娜派来的救世主吧?!这波操作够我刻成碑传家!!🗿”
#### 当前的场景是
`;
const pickGoodJobPrompt = `对提供的文字,提取单个的夸奖内容,并丰富为纯口语化模式,同时在括号中添加对应的姿态语言描述,同时添加了括号中的姿态语言描述,使其更具临场感和情感色彩。
要求:
1. 只返回单个的一条夸奖内容,不能有其他内容。
2. 夸奖内容要口语化,富有情感色彩。
3. 姿态语言描述要符合夸奖内容,且要在括号中描述。
4. 夸奖内容要有夸张的比喻和形容词,突出对方的优点和成就。
5. 夸奖内容要让人感到被认可和赞赏,能够激励对方。
6. 不要返回任何其他内容或解释,只返回夸奖内容。
7. 夸奖内容要简洁明了,易于理解,篇幅不易过长。
当前文字是:
`;
agent
.route({
path: 'tools',
key: 'pick-good-job',
description: '对用户的内容进行夸奖后,提取出夸奖的内容',
})
.define(async (ctx) => {
let { text } = ctx.query;
if (!text) {
text = '真厉害啊';
}
const prompt = `${pickGoodJobPrompt} ${text}`;
const res = await ai
.chat(
[
{
role: 'user',
content: prompt,
},
],
{
enable_thinking: false,
},
)
.catch((err) => {
console.error('AI service error:', err.status);
ctx.throw(500, 'AI service error: ' + err.status);
return err;
});
const ans = res.choices[0]?.message?.content || '';
if (!ans) {
ctx.throw(500, 'AI response is empty');
}
ctx.body = ans;
})
.addTo(agent);
agent
.route({
path: 'tools',
key: 'good-job',
})
.define(async (ctx) => {
let { text } = ctx.query;
if (!text) {
text = '作者发了一篇好的文章';
}
const prompt = `${kuarenPrompt} ${text}`;
const res = await ai
.chat(
[
{
role: 'user',
content: prompt,
},
],
{
enable_thinking: false,
},
)
.catch((err) => {
console.error('AI service error:', err.status);
ctx.throw(500, 'AI service error: ' + err.status);
return err;
});
const ans = res.choices[0]?.message?.content || '';
if (!ans) {
ctx.throw(500, 'AI response is empty');
}
// ctx.body = ans;
// console.log('AI response:', ans);
const resPick = await agent.call({
path: 'tools',
key: 'pick-good-job',
payload: {
text: ans,
},
});
if (resPick.code !== 200) {
ctx.throw(500, 'AI pick good job error: ' + resPick.message);
return;
}
const pickAns = resPick.body || '';
if (!pickAns) {
ctx.throw(500, 'AI pick good job response is empty');
}
ctx.body = pickAns;
})
.addTo(agent);