anc95 / ChatGPT-CodeReview

🐥 A code review bot powered by ChatGPT
https://github.com/apps/cr-gpt
ISC License
3.78k stars 361 forks source link

Customizable prompt? #34

Open tgnemecek opened 1 year ago

tgnemecek commented 1 year ago

Hey there! Great project, it seems to work as intended and the CRs are very useful. For our use case, and I imagine for many others as well, it would be beneficial to be able to customize the prompt. The easiest solution would be to expose it as an env var, e.g.: OPEN_API_PROMPT or similar. Thoughts? Let me know if you want me to make a PR.

anc95 commented 1 year ago

Thanks, @tgnemecek, I am planning to add some customizable functions too. for example custom prompt, custom model, and multiple language support, It's good for us to start this from a customizable prompt. it's a good approach to set it as env var. as it can support both self-hosted as a webhook and use via a GitHub action.

we can have two vars to implement this

  1. PROMPT_PREFIX= 'hi, bellow is a code diff: '
  2. PROMPT_SUFFIX='could you help to do a code review to the above code diff'

the final prompt will be

${PROMPT_PREFIX}
${code_diff}
${PROMPT_SUFFIX}

Thank you and I will be appreciated your contribution to this.