mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-18 06:03:17 +08:00
初始化:独立 oclaw 仓库首提交
- 在 oclaw/ 下重新初始化 Git 仓库 - 补齐子仓库 .gitignore,避免提交本地运行态数据(_local、node_modules、logs 等) - 提交当前工程代码与配置 Made-with: Cursor
This commit is contained in:
commit
ba3836f00f
579 changed files with 83112 additions and 0 deletions
33
tools/experts/generalist/system_info.py
Normal file
33
tools/experts/generalist/system_info.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
import time
|
||||
from typing import Any
|
||||
|
||||
from oclaw.tools.base import ToolSpec
|
||||
|
||||
|
||||
def system_info_tool() -> ToolSpec:
|
||||
def handler(args: dict[str, Any]) -> dict[str, Any]:
|
||||
now = datetime.datetime.now()
|
||||
utc_now = datetime.datetime.now(datetime.timezone.utc)
|
||||
timezone_name = time.tzname[0] if time.daylight == 0 else time.tzname[1]
|
||||
timezone_offset = (now - utc_now.replace(tzinfo=None)).total_seconds() / 3600
|
||||
return {
|
||||
"ok": True,
|
||||
"current_time": now.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
"timezone": timezone_name,
|
||||
"timezone_offset": f"UTC{'+' if timezone_offset >= 0 else ''}{timezone_offset:g}",
|
||||
"timestamp": int(time.time()),
|
||||
}
|
||||
|
||||
return ToolSpec(
|
||||
name="get_system_time",
|
||||
description="Return the current local time, timezone name, and UTC offset.",
|
||||
parameters={"type": "object", "properties": {}, "additionalProperties": False},
|
||||
handler=handler,
|
||||
read_only=True,
|
||||
)
|
||||
|
||||
|
||||
__all__ = ["system_info_tool"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue