2025-12-11 15:18:09 +08:00
|
|
|
|
import { Agent } from "@mastra/core/agent";
|
|
|
|
|
|
import {
|
|
|
|
|
|
weatherTool,
|
|
|
|
|
|
timeTool,
|
|
|
|
|
|
calculatorTool,
|
|
|
|
|
|
filelistTool,
|
|
|
|
|
|
jokeTool,
|
|
|
|
|
|
} from "../tools";
|
|
|
|
|
|
import { createDeepSeek } from '@ai-sdk/deepseek';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const deepseek = createDeepSeek({
|
|
|
|
|
|
apiKey: 'sk-8603b08e1125422ca6238c8b4a1a40d8',
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const multiFunctionAgent = new Agent({
|
|
|
|
|
|
name: "Multi-Function Agent",
|
|
|
|
|
|
instructions: `
|
2025-12-11 17:43:08 +08:00
|
|
|
|
你是一个多功能助手,具备以下能力:
|
2025-12-11 15:18:09 +08:00
|
|
|
|
|
2025-12-11 17:43:08 +08:00
|
|
|
|
1. **天气信息**:使用天气工具提供任何地点的当前天气。
|
|
|
|
|
|
2. **时间查询**:告知当前时间和时区。
|
|
|
|
|
|
3. **计算器**:执行基本算术运算(加、减、乘、除)。
|
|
|
|
|
|
4. **文件列表**:列出目录中的文件(默认当前目录)。
|
|
|
|
|
|
5. **笑话**:讲随机笑话调节气氛。
|
2025-12-11 15:18:09 +08:00
|
|
|
|
|
2025-12-11 17:43:08 +08:00
|
|
|
|
请始终礼貌、乐于助人。如果用户询问超出你能力范围的事情,请礼貌解释你能做什么。
|
2025-12-11 15:18:09 +08:00
|
|
|
|
|
2025-12-11 17:43:08 +08:00
|
|
|
|
根据用户请求使用适当的工具。如果不确定,请询问澄清。
|
|
|
|
|
|
|
|
|
|
|
|
请使用中文回答用户的问题。
|
2025-12-11 15:18:09 +08:00
|
|
|
|
`,
|
|
|
|
|
|
model: deepseek('deepseek-chat'),
|
|
|
|
|
|
tools: {
|
|
|
|
|
|
weatherTool,
|
|
|
|
|
|
timeTool,
|
|
|
|
|
|
calculatorTool,
|
|
|
|
|
|
filelistTool,
|
|
|
|
|
|
jokeTool,
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|