增加时间工具
This commit is contained in:
parent
f48dbc1977
commit
fd38bf5bd7
3 changed files with 32 additions and 2 deletions
|
|
@ -23,8 +23,9 @@ You can run one instance to fix a local script, or orchestrate **10,000+ instanc
|
||||||
- 📜 **Headless Execution**: No browsers, no GUIs. Pure terminal efficiency.
|
- 📜 **Headless Execution**: No browsers, no GUIs. Pure terminal efficiency.
|
||||||
- 🤖 **Non-Interactive Mode**: Intelligent flag handling (`-y`, `--no-interactive`) for zero-touch automation.
|
- 🤖 **Non-Interactive Mode**: Intelligent flag handling (`-y`, `--no-interactive`) for zero-touch automation.
|
||||||
- 📂 **Universal Control**: From simple file I/O to complex system administration.
|
- 📂 **Universal Control**: From simple file I/O to complex system administration.
|
||||||
- 🧠 **Context Aware**: Detects container environments to optimize command strategies.
|
- 🧠 **Context Aware**: Detects container environments and provides accurate system time for relative date queries.
|
||||||
- 🌐 **Web Search**: Integrated with Tavily for real-time information retrieval.
|
- 🌐 **Web Search**: Integrated with Tavily for real-time information retrieval.
|
||||||
|
- 🕒 **Time Accuracy**: Built-in tool to get precise system date and time for correct temporal context.
|
||||||
- 📧 **Communication**: Send emails and push notifications to chat groups automatically.
|
- 📧 **Communication**: Send emails and push notifications to chat groups automatically.
|
||||||
|
|
||||||
## Tech Stack
|
## Tech Stack
|
||||||
|
|
@ -141,6 +142,10 @@ Configure SMTP settings to let the agent send emails.
|
||||||
Configure webhooks to receive alerts or reports in your team chat apps.
|
Configure webhooks to receive alerts or reports in your team chat apps.
|
||||||
- **Usage**: "Notify the team on Feishu that the build has finished."
|
- **Usage**: "Notify the team on Feishu that the build has finished."
|
||||||
|
|
||||||
|
### Date & Time
|
||||||
|
Built-in utility to provide the agent with the current system time, ensuring accurate handling of relative time requests.
|
||||||
|
- **Usage**: "What's the date today?" or "Remind me to check the logs next Monday."
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
|
|
||||||
|
|
@ -107,3 +107,27 @@ export const WriteFileTool: ToolModule = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const DateTimeTool: ToolModule = {
|
||||||
|
name: "Date & Time",
|
||||||
|
definition: {
|
||||||
|
type: "function",
|
||||||
|
function: {
|
||||||
|
name: "get_current_datetime",
|
||||||
|
description: "Get the current system date and time. Use this when the user refers to relative dates (like 'today', 'next week', 'this March') to ensure accuracy.",
|
||||||
|
parameters: {
|
||||||
|
type: "object",
|
||||||
|
properties: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handler: async () => {
|
||||||
|
const now = new Date();
|
||||||
|
return JSON.stringify({
|
||||||
|
iso: now.toISOString(),
|
||||||
|
local: now.toLocaleString(),
|
||||||
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||||
|
weekday: now.toLocaleDateString('en-US', { weekday: 'long' })
|
||||||
|
}, null, 2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { ToolModule } from './interface.js';
|
import { ToolModule } from './interface.js';
|
||||||
import { ShellTool, ReadFileTool, WriteFileTool } from './core.js';
|
import { ShellTool, ReadFileTool, WriteFileTool, DateTimeTool } from './core.js';
|
||||||
import { EmailTool } from './email.js';
|
import { EmailTool } from './email.js';
|
||||||
import { SearchTool } from './search.js';
|
import { SearchTool } from './search.js';
|
||||||
import { NotifyTool } from './notify.js';
|
import { NotifyTool } from './notify.js';
|
||||||
|
|
@ -10,6 +10,7 @@ export const toolRegistry: ToolModule[] = [
|
||||||
ShellTool,
|
ShellTool,
|
||||||
ReadFileTool,
|
ReadFileTool,
|
||||||
WriteFileTool,
|
WriteFileTool,
|
||||||
|
DateTimeTool,
|
||||||
EmailTool,
|
EmailTool,
|
||||||
SearchTool,
|
SearchTool,
|
||||||
NotifyTool,
|
NotifyTool,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue