Allows you to highlight code and send it to openAI for analysis. You must have an Environment Variable called OpenApiKey set with your api key for the service to work. Get your API Key here: https://platform.openai.com/account/api-keys It is free to sign up and you get free credits. After installing the extension and setting the environment variable in Windows. you should see a menu command like below: Clicking the menu item will send the highlighted code in the current window to OpenAI for analysis with a hard coded prompt. The prompt is "Analyze this code and check for errors and improvements that can be made. Also detail what actions the code performs: {selected code}". It is hard coded to use at most 500 tokens (a few cents) of your total tokens. I will add customizations in a future release. aPI.Completions.CreateCompletionAsync(
After clicking the invoke menu item, a window will pop up with the results in a few seconds. Longer if the code selected is complex or if OpenAI is busy. You can continue to work in VS until the window opens up. Release 1.2Added ability to configure prompt and max tokens via UI. |