Closed silgon closed 1 month ago
Thank you! I'm wondering if it would make sense to just create the file for a user if it doesn't exist. Including any new keys that may be introduced in future versions.
Because right now the CLI works perfectly fine without the config file. But it is kinda error prone as you point out to leave this up to the user.
In my case, I set explicitly the environmental variable. I really think that an error code should be fine. Or as you mentioned, if you create the file, maybe you can put a warning. However, I strongly believe that if the person is trying to do that, it's because he/she knows what he/she's doing. In a side comment, I actually created another configuration because I wanted to pass another role. However, I strongly believe that if you have some kind of storage and select, it could be really nice. I can imagine even an extension to select the type of response you want, either specific to your user or generated some crowdsource (like: https://github.com/f/awesome-chatgpt-prompts/blob/main/prompts.csv). Again, in my case, I wanted with the variable, to play the role of a programmer, because most of the time I don't need the explanations in the code. In any case, it's not my call, and unfortunately, I do not have the time to contribute to your code. Kudos again to you π
@silgon That's fair. I will implement something. Printing a warning should be sufficient indeed.
Sorry, I have been busy rolling out other features. Including the prompt flag. You should give it a go! :)
git diff | ./bin/chatgpt -n -p ../prompts/write_pull-request.md
or
cat README.md | chatgpt -n --prompt ../prompts/summarize.md
More info here: https://github.com/kardolus/chatgpt-cli?tab=readme-ov-file#prompt-support
I implement something :)
See the test below:
2024-10-12 08:13:53 β (βΈοΈ |kind:N/A) Guillermos-MacBook-Pro in ~/workspace/chatgpt-cli
Β± |main {6} U:1 β| β mkdir -p /tmp/confighome
2024-10-12 08:14:17 β (βΈοΈ |kind:N/A) Guillermos-MacBook-Pro in ~/workspace/chatgpt-cli
Β± |main {6} U:1 β| β export OPENAI_CONFIG_HOME=/tmp/confighome
2024-10-12 08:14:36 β (βΈοΈ |kind:N/A) Guillermos-MacBook-Pro in ~/workspace/chatgpt-cli
Β± |main {6} U:1 β| β ./bin/chatgpt hi
Warning: config.yaml doesn't exist in /tmp/confighome, create it
Hello again! How can I assist you today?
2024-10-12 08:14:42 β (βΈοΈ |kind:N/A) Guillermos-MacBook-Pro in ~/workspace/chatgpt-cli
Β± |main {6} U:1 β| β unset OPENAI_CONFIG_HOME
2024-10-12 08:14:55 β (βΈοΈ |kind:N/A) Guillermos-MacBook-Pro in ~/workspace/chatgpt-cli
Β± |main {6} U:1 β| β ./bin/chatgpt hi
Hello! How can I assist you today?
2024-10-12 08:14:59 β (βΈοΈ |kind:N/A) Guillermos-MacBook-Pro in ~/workspace/chatgpt-cli
Β± |main {6} U:1 β| β export OPENAI_CONFIG_HOME=/tmp/confighome
2024-10-12 08:15:07 β (βΈοΈ |kind:N/A) Guillermos-MacBook-Pro in ~/workspace/chatgpt-cli
Β± |main {6} U:1 β| β touch /tmp/confighome/config.yaml
2024-10-12 08:15:16 β (βΈοΈ |kind:N/A) Guillermos-MacBook-Pro in ~/workspace/chatgpt-cli
Β± |main {6} U:1 β| β ./bin/chatgpt hi
Hello! How can I assist you today?
You can find the commit here: https://github.com/kardolus/chatgpt-cli/commit/cc2c209df7fb34f4e1d73672c742b02fe609b5f7
I expect to cut a new release somewhere within the next two weeks.
Nice. It's really nice work you are doing =). Concerning the prompt, I think it is really cool. I personally use a lot the pipe command to pass a context. Thanks again! π
You got it! Thank's for the kind words. Glad you are enjoying the CLI.
When the environment variable
OPENAI_CONFIG_HOME
is set, and the corresponding YAML configuration file does not exist, thechatgpt-cli
application falls back to its default configuration silently without throwing an error. This behavior can lead to confusion as users may expect an error to be raised when the specified configuration is not found.I know this sounds silly, but out of habit, I name all my yaml files with the extension
.yml
. It took me more than an hour to realize that that was the problem. I decided to build, log and everything in order to find that it was my fault. In any case, since I'm biased, I think that if somebody sets the variable OPENAI_CONFIG_HOME, it's because he/she wishes to use that directory, and it should not fallback to the default configuration file.Nice library btw.