arbs-io / vscode-openai

vscode-openai seamlessly incorporates OpenAI features into VSCode, providing integration with SCM, Code Editor and Chat.
https://marketplace.visualstudio.com/items?itemName=AndrewButson.vscode-openai
MIT License
82 stars 20 forks source link

Commit's comment by azure openai #185

Closed voytas75 closed 11 months ago

voytas75 commented 11 months ago

Do you plan add feature to build commit's comment by azure openai?

arbs-io commented 11 months ago

Hi @voytas75 It should work with all instances. Are you not seeing the toolbar icon? Do you have git integration installed?

voytas75 commented 11 months ago

It works in one repository and not in another... found difference ... in .ps1 files, AI comments are added and in .psm1 files they are not. I did a test on one file: For "test.ps1" a change in the code generates AI comment in the commit. I change the file extension to psm1 -> "test.psm1", I save it so that the commit does not apply to the extension change and adds the change as if it were already on a new file - the AI comment generation does not work. In the case of . PSD1 is identical - AI does not generate a commit comment.

arbs-io commented 11 months ago

I think this is related to how you're staging your files in got. Technically the file are grouped and a diff a single diff file is used to determine all the changes for the commit. Which model are you using? There is a small difference in gpt3.5 and gpt4 outputs, but no files should be ignored assuming they have actual has some form of code change.

voytas75 commented 11 months ago

Gpt35

arbs-io commented 11 months ago

Could you share the commit log that you see comments added but the file above is excluded.

A sampled would be fine. I can help if you provide the git commit log and h change history. I've not heard about comments not committing in git.

voytas75 commented 11 months ago

Unfortunately there is nothing to commit because AI does not generate a comment to the commit. I have to enter comment manually.

arbs-io commented 11 months ago

Could you post the vscode-openai log on startup. Perhaps the git service is not registered correctly. This is the first time I've heard the feature is not working.

voytas75 commented 11 months ago

log file from today: 16-vscode-openai.log

arbs-io commented 11 months ago

Thanks for the log. I've checked everything and can't see any issues with the feature. I've added additional logging if either gitService in vscode can't be found (or is unavailable), and if the git diff hasn't detected any changes. I can't easily check these conditions but can see some clients do have issues when locating the git service/provider. The log enhancement will be added to the version 1.5.3 release tomorrow. Could you emulate the issue once the new version has been installed

voytas75 commented 11 months ago

ok i have got 1.5.3, testing... open some file .PSD1 add 3 new lines

New-Item -Path "c:\temp" -Name "test4"
New-Item -Path "c:\temp" -Name "test5"
New-Item -Path "c:\temp" -Name "test6"

output vscode-openai:

2023-11-27 16:32:59.951 [error]     Error: This value was thrown as is, not through an Error: "GitService: empty difference"

recorded a video: https://github.com/arbs-io/vscode-openai/assets/13856061/171e3e05-df77-4c8e-aaf9-ccec507d7ba6

arbs-io commented 11 months ago

Hi @voytas75 I've checked and see the issue. It's related to the way git works. With recent git versions, you can git add -N to the file (or --intent-to-add), which adds a zero-length blob to the index at that location. The upshot is that your "untracked" file now becomes a modification to add all the content to this zero-length file, which shows up in the "git diff" output.

If you want to allow tracking for new file you can run "git add -N .\path-to-file"

This is git related and I can't apply a fix in the extension. I would suggest when adding new file to a project manually provide the comment (or use the intent-to-add feature of git). Subsequent changes will work normally as git has the objects tracked.

example of new file using intent-to-add: image