aura-web/src/skillTemplates.ts

76 lines
1.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

export const SKILL_TEMPLATES: Record<string, { label: string; content: string }> = {
prompt: {
label: '📝 Prompt 注入式SOP / 工作流)',
content: `---
name: customer_service_sop
description: 客服回复 SOP注入到 System Prompt
type: prompt
---
# 客服回复 SOP
## 回复风格
- 礼貌、简洁、不超过 3 段
- 优先解决问题,再表达共情
## 流程
1. 复述用户问题,确认理解
2. 给出解决方案(步骤化)
3. 询问是否还有其他问题
`
},
http: {
label: '🌐 HTTP 工具(外部 API',
content: `---
name: get_weather
description: 查询某城市当前天气
type: http
parameters:
type: object
properties:
city:
type: string
description: 城市的中文名或拼音
required:
- city
handler: https://wttr.in/{{city}}?format=j1
config:
method: GET
timeout: 8000
---
# 天气查询工具
模型可通过 function calling 自动调用。
\`{{city}}\` 会被替换为参数值。
`
},
js: {
label: '⚙️ JavaScript 工具(沙箱执行)',
content: `---
name: calc_compound_interest
description: 计算复利收益。本金 principal, 年利率 rate (0.05=5%), 年限 years
type: js
parameters:
type: object
properties:
principal: { type: number, description: 本金 }
rate: { type: number, description: 年利率(小数,如 0.05 }
years: { type: number, description: 年数 }
required: [principal, rate, years]
config:
timeout: 3000
---
const { principal, rate, years } = args;
const final = principal * Math.pow(1 + rate, years);
const profit = final - principal;
return {
finalValue: Number(final.toFixed(2)),
profit: Number(profit.toFixed(2)),
summary: \`本金 \${principal}\${years} 年, 年化 \${(rate*100).toFixed(2)}% 复利后变成 \${final.toFixed(2)}\`
};
`
}
};