backus / ai.sh Goto Github PK
View Code? Open in Web Editor NEWCopilot for the terminal. Generate commands and preview them before running
Copilot for the terminal. Generate commands and preview them before running
#5 unfortunately assumes that HISTFILE is defined, and that's not the case when this is used with bash, where a shell script doesn't have access to this variable.
Could wrap that code within inject_into_zsh_history
with something like:
if [[ -v HISTFILE ]]; then
....
fi
Perhaps?
Day to day, I often prefer:
A plain text file could be part of the config that gets mixed into the prompt to tell OpenAI to prefer these tools when possible
I get errors when running ai.sh with the current version of the openai CLI. Did you try already to make it work again with the current CLI version and with GPT-4 instead of GPT-3.5-Turbo?
Codex models discontinued
When you execute a command I would like to write it to ~/.zsh_history
using print -S
https://unix.stackexchange.com/a/651706. Since the file is bash right now it isn't easy to just tell zsh to do this since the user might have multiple zsh binaries on their computer and we might write it the wrong way if just try to call zsh -c
. For example, this does not work for me:
$ bash
bash-5.2$ zsh -c "HISTFILE=~/.zsh_history print -S 'foo bar'"
this outputs something in the wrong format to the hist file. Also the name of the ZSH history file is non-standard so we can't even assume that is the right file
For everythng to work in Ubuntu I had to do these:
alias ai=`/bin/readlink -f /path/to/ai.sh`
Make sure you have xclip or install it. Then, in ai.sh, change this line:
pbcopy < "$completion_temp_file"
to:
xclip -sel clip < "$completion_temp_file"
In ai.sh change this line:
which -s "$1" > /dev/null
to:
which "$1" > /dev/null
Then I was able to use this great software!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.