Ruby 实现了一个 human interpreter

femto · 2023年08月12日 · 256 次阅读

https://github.com/femto/hi 目的,像自然语言一样的跟你的操作系统交流

比如 hi could you please count the total line numbers of files in current dir

安装

pip install -U python-pi

使用,既可以命令行使用

hi could you please count the total line numbers of files in  current dir

也可以作为 shellbang interpreter 使用,比如写一个 tidy 文件夹的脚本:

#!/usr/bin/env hi

loop over all files (ignoring directories) in first argument(first argument is a directory)

move each file into a subdirectory in the format year-month

while the task is running show an ascii loading spinner

show how many files where moved

所执行的和所表达的意思相同

原理,hi 是 bin, 后面其他的部分发送到 llm 转成 bash(当然会有缓存) 然后执行

可以参考 samples 下其他文件

项目地址 https://github.com/femto/hi

请大家试用和给出反馈:)

femto [该话题已被删除] 提及了此话题。 08月12日 20:04
需要 登录 后方可回复, 如果你还没有账号请 注册新账号