ricopinazo / comai Goto Github PK
View Code? Open in Web Editor NEWAn AI powered terminal assistant
License: GNU General Public License v3.0
An AI powered terminal assistant
License: GNU General Public License v3.0
Link to the API docs:
https://iterm2.com/python-api/
Have a look at this: https://realpython.com/python-typer-cli/#set-up-initial-cli-tests-with-pytest
Here there is a list of classifiers:
https://pypi.org/classifiers/
We need to add a command to add the following to the shell config file:
export COMAI_SESSION_ID=$(uuidgen)
Alternatively, we could find a way to make context work without needing this. Maybe there is an alternative way to detect that comai was run in a shell were it was already previously run.
Maybe we can use $$ as well
We should be able to do things such as:
$ ai create a directory named my-memorable-directory
>>> mkdir my-memorable-directory
$ ai create a file inside
>>> touch my-memorable-directory/file
There is a good example on how to do this here: https://github.com/simonw/llm/blob/main/llm/cli.py
link to openlm project: https://github.com/r2d4/openlm
The reason being it's cheaper as per https://platform.openai.com/docs/guides/chat/chat-vs-completions
We can follow this blog post:
https://towardsdatascience.com/3-tips-to-reduce-openai-gpt-3s-costs-by-smart-prompting-53c457229cfc
Something like:
$ comai show files
💡≫ ls
[↵] execute [x↵] cancel [e↵] edit [h↵] explain
but with nice colors and maybe only with the first two options in principle
import configparser
import os
import appdirs
app_name = "your_app_name"
app_author = "your_name_or_organization"
config_dir = appdirs.user_config_dir(app_name, app_author)
os.makedirs(config_dir, exist_ok=True)
config_path = os.path.join(config_dir, "config.ini")
def save_api_key(api_key):
config = configparser.ConfigParser()
config["DEFAULT"] = {"api_key": api_key}
with open(config_path, "w") as configfile:
config.write(configfile)
def load_api_key():
config = configparser.ConfigParser()
config.read(config_path)
return config["DEFAULT"]["api_key"]
def check_config_exists():
return os.path.exists(config_path)
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.