mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 15:13:55 +08:00
* function call功能完善,增加天气查询,支持插件式扩展 * 增加角色切换功能,通过切换system提示词,修改角色认知 * 增加插件管理系统,可以通过语音加载和卸载插件 * docs: 添加命令操作 (#329) * docs: 添加命令操作 * feat: 添加 docker-setup.sh 脚本以简化服务端部署 - 新增 docker-setup.sh 脚本,自动创建目录结构、下载语音识别模型和配置文件,并检查文件完整性。 - 更新 Deployment.md 文档,提供一键执行脚本的说明和使用示例。 * docs: 更新 Deployment.md,添加环境访问 GitHub 的注意事项 * refactor: 更新 docker-setup.sh 脚本以支持多操作系统下载命令 - 修改脚本以检测操作系统类型,并根据不同系统选择合适的下载命令(curl 或 wget)。 - 优化错误处理,确保在下载失败时提供清晰的提示信息。 - 更新 Deployment.md 文档,调整懒人脚本的使用说明,增加手动部署的步骤。 * Update docker-setup.sh * Update docker-setup.sh --------- Co-authored-by: 欣南科技 <huangrongzhuang@xin-nan.com> * update:优化插件加载的配置提示 * update:增加自动安装脚本的操作说明 * update:优化插件配置,去掉旧版本的时间设定 --------- Co-authored-by: 玄凤科技 <eric230308@gmail.com> Co-authored-by: TinsFox <fox@tinsfox.com> Co-authored-by: hrz <1710360675@qq.com>
25 lines
788 B
Python
25 lines
788 B
Python
from datetime import datetime
|
|
from plugins_func.register import register_function, ToolType, ActionResponse, Action
|
|
|
|
get_time_function_desc = {
|
|
"type": "function",
|
|
"function": {
|
|
"name": "get_time",
|
|
"description": "获取当前时间、日期、星期几",
|
|
"parameters": {}
|
|
}
|
|
}
|
|
|
|
|
|
@register_function('get_time', get_time_function_desc, ToolType.WAIT)
|
|
def get_time():
|
|
"""
|
|
获取当前时间、日期、星期几
|
|
"""
|
|
now = datetime.now()
|
|
current_time = now.strftime("%H:%M:%S")
|
|
current_date = now.strftime("%Y-%m-%d")
|
|
current_weekday = now.strftime("%A")
|
|
response_text = f"当前日期: {current_date},当前时间: {current_time},星期: {current_weekday}"
|
|
|
|
return ActionResponse(Action.REQLLM, response_text, None) |