TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Unix pipe friendly ChatGPT client

2 点作者 throwaway71271大约 2 年前

1 comment

throwaway71271大约 2 年前
I just built a tiny script to help me pipe stuff into chatgpt.<p>You can install it with:<p><pre><code> go install github.com&#x2F;jackdoe&#x2F;updown&#x2F;cmd&#x2F;llm@latest </code></pre> Or just fork it and change it for your needs (its so small I just put it in my go scripts repo).<p>I literally built it few hours ago and already am using it non stop, so decided to share it.<p>Example usages:<p><pre><code> $ ls -al | llm which are the biggest files $ git diff | llm write a commit message $ git commit -a -m &quot;$(git diff | llm write a commit message)&quot; $ cat file.csv | llm transform it into json $ find . | llm -m gpt-4 which files probably contain configuration </code></pre> It works pretty good, example csv to json:<p><pre><code> $ cat a.csv name,age john,19 jane,19 jack doe,20 $ cat a.csv | llm transform into json [ {&quot;name&quot;: &quot;john&quot;, &quot;age&quot;: 19}, {&quot;name&quot;: &quot;jane&quot;, &quot;age&quot;: 19}, {&quot;name&quot;: &quot;jack doe&quot;, &quot;age&quot;: 20} ] </code></pre> And of course to pipe it into itself:<p><pre><code> $ cat a.csv | llm transform into json | llm transform to key by age { &quot;19&quot;:[ { &quot;name&quot;:&quot;john&quot;, &quot;age&quot;:19 }, { &quot;name&quot;:&quot;jane&quot;, &quot;age&quot;:19 } ], &quot;20&quot;:[ { &quot;name&quot;:&quot;jack doe&quot;, &quot;age&quot;:20 } ] } </code></pre> You can use -p @prompt1.txt -p &#x27;then do the next thing&#x27; -p @prompt2.txt etc to construct more complicated prompt from multiple files, and use -m gpt-4 to use gpt4 instead of gpt3.5<p>PS: be careful not to send secrets, and of course know that openai will probably keep everything you sent to them until the sun scorches the earth and their servers die with it, so beware.<p>PPS: there are probably other clients like that, but since its only few lines I thoughts its better to have my own that i can tweak.