Show HN: 在远程 SSH shell 会话中执行本地 LLM 提示
2 分•作者: smudgy3746•5 个月前
Hi HN,
这是我过去几个月一直在开发的一个工具。
与其给 LLM 工具 SSH 访问权限或将它们安装在服务器上,不如使用以下命令:
```
$ promptctl ssh user@server
```
这样就可以让一组本地定义的提示语“神奇地”出现在远程 shell 中,作为可执行的命令行程序。
例如,我本地定义了 `llm-analyze-config` 和 `askai` 的提示语。然后在(任何)远程主机上,我可以:
```
$ promptctl ssh user@host
# 现在在远程主机上
$ llm-analyze-config /etc/nginx.conf
$ cat docker-compose.yml | askai "添加一个负载均衡器"
```
`llm-analyze-config` 和 `askai` 背后的提示语会在我的本地计算机上执行(即使它们是在远程调用的),通过我选择的 LLM。
这样,LLM 工具永远不会被授予服务器的 SSH 访问权限,并且无需在服务器上安装任何东西。事实上,服务器甚至不需要启用出站互联网连接。
期待收到反馈!
Github: [https://github.com/tgalal/promptcmd/](https://github.com/tgalal/promptcmd/)
查看原文
Hi HN,<p>This is a tool I've worked on the past few months.<p>Instead of giving LLM tools SSH access or installing them on a server, the following command:<p><pre><code> $ promptctl ssh user@server
</code></pre>
makes a set of locally defined prompts "magically" appear within the remote shell as executable command line programs.<p>For example, I have locally defined prompts for `llm-analyze-config` and `askai`. Then on (any) remote host I can:<p><pre><code> $ promptctl ssh user@host
# Now on remote host
$ llm-analyze-config /etc/nginx.conf
$ cat docker-compose.yml | askai "add a load balancer"
</code></pre>
the prompts behind `llm-analyze-config` and `askai` execute on my local computer (even though they're invoked remotely) via the llm of my choosing.<p>This way LLM tools are never granted SSH access to the server, and nothing needs to be installed to the server. In fact, the server does not even need outbound internet connections to be enabled.<p>Eager to get feedback!<p>Github: <a href="https://github.com/tgalal/promptcmd/" rel="nofollow">https://github.com/tgalal/promptcmd/</a>