appleboy / CodeGPT

A CLI written in Go language that writes git commit messages or do a code review brief for you using ChatGPT AI (gpt-4o, gpt-4-turbo, gpt-3.5-turbo model) and automatically installs a git prepare-commit-msg hook.
MIT License
1.22k stars 109 forks source link

codegpt config set does not update .codegpt.yaml #126

Closed kun432 closed 11 months ago

kun432 commented 11 months ago

OS: macOS Ventura 13/6 CodeGPT Version: 0.6.1 commit: d24af1a (using Homebrew)

codegpt config set does not update .codegpt.yaml.

$ cat ~/.config/codegpt/.codegpt.yaml
output:
    file: ""

$ codegpt config set openai.api_key sk-xxxxxxxxx
you can see the config file: /Users/xxxxx/.config/codegpt/.codegpt.yaml

$ cat ~/.config/codegpt/.codegpt.yaml
output:
    file: ""

Editting .codegpt.yaml directly, codegpt config list shows its value correctly. However, codegpt config set still does not work.

$ cat ~/.config/codegpt/.codegpt.yaml
output:
  file: ""
  lang: ja

$ codegpt config list
Key                       Value
git.diff_unified          <nil>
git.exclude_list          <nil>
git.template_file         <nil>
git.template_string       <nil>
openai.api_key            ****************
openai.api_version        <nil>
openai.base_url           <nil>
openai.frequency_penalty  <nil>
openai.headers            <nil>
openai.max_tokens         <nil>
openai.model              <nil>
openai.model_name         <nil>
openai.org_id             <nil>
openai.presence_penalty   <nil>
openai.provider           <nil>
openai.proxy              <nil>
openai.skip_verify        <nil>
openai.socks              <nil>
openai.temperature        <nil>
openai.timeout            <nil>
openai.top_p              <nil>
output.lang               ja

$ codegpt config set output.lang en
you can see the config file: /Users/xxxxx/.config/codegpt/.codegpt.yaml

$ codegpt config list
Key                       Value
git.diff_unified          <nil>
git.exclude_list          <nil>
git.template_file         <nil>
git.template_string       <nil>
openai.api_key            ****************
openai.api_version        <nil>
openai.base_url           <nil>
openai.frequency_penalty  <nil>
openai.headers            <nil>
openai.max_tokens         <nil>
openai.model              <nil>
openai.model_name         <nil>
openai.org_id             <nil>
openai.presence_penalty   <nil>
openai.provider           <nil>
openai.proxy              <nil>
openai.skip_verify        <nil>
openai.socks              <nil>
openai.temperature        <nil>
openai.timeout            <nil>
openai.top_p              <nil>
output.lang               ja

$ cat ~/.config/codegpt/.codegpt.yaml
output:
    file: ""
    lang: ja
appleboy commented 11 months ago

I will take it.

appleboy commented 11 months ago

try https://github.com/appleboy/CodeGPT/tree/v0.6.2

kun432 commented 11 months ago

tried using go install and works!

$ codegpt config list | grep output.lang
output.lang               ja

$ codegpt config set output.lang en
you can see the config file: /Users/xxxxx/.config/codegpt/.codegpt.yaml

$ codegpt config list | grep output.lang
output.lang               en

$ cat ~/.config/codegpt/.codegpt.yaml | grep -2 lang
output:
    file: ""
    lang: en

I will appreciate if you update for Homebrew, too.:smile:

Thanks!

appleboy commented 11 months ago

Done. https://github.com/appleboy/homebrew-tap/commit/90bf010f872c66245494ebc917d950cbeeb95b4d you can try it now.

kun432 commented 11 months ago
 $ which codegpt
/opt/homebrew/bin/codegpt

$ codegpt version
version: 0.6.2 commit: 77b2e90

$ codegpt config set output.lang ja
you can see the config file: /Users/xxxxx/.config/codegpt/.codegpt.yaml

$ codegpt config list | grep output.lang
output.lang               ja

Perfect! Thanks so much!