AI Chat Assistant

Index of All Documentation » Wing Pro Reference Manual » AI Assisted Development »


AI chat is a beta feature, in part because the OpenAI API being used to implement it is still in beta. You may run into times when the OpenAI API is not responding or runs very slowly. Please report any problems to support@wingware.com

AI chat is implemented by the AI Chat page of the AI tool in Wing Pro. Here, you can set the Focus to the unit of code you want to ask about. This indicates to Wing what code at or near the current editor insertion point is relevant to your conversation:

  • None can be used to have a general conversion with the AI without referencing any of your code in the current editor. However, if Auto-Context is enabled (see below) then any files it selects will still be available to the AI.
  • Current Selection sends the current file and current selection to the AI provider with your requests.
  • Current Block sends the current file and the current like-or-greater indented block of code to the AI provider.
  • Current Scope sends the current file and the innermost named scope (a class or a def) to the AI provider.
  • Whole File sends the current file to the AI provider without indicating interest in a particular part of that file.

Auto-Context

By default Wing only sends the code you've selected as your Focus, along with some or all of the current editor file to the AI provider, as context for your chat. If you want the AI to have access to other relevant code, you can enable Auto-Context in the top right of the AI Chat page. This may produce more accurate and complete results in your chats, but can also cost significantly more. See AI Request Context and Managing Cost for details.

Note that unlike AI suggest and refactor, which send context in one unit along with each request, AI chat uploads selected files ahead of time, so the AI can preprocess them. The Auto-Context checkbox and icon to its right change color to indicate whether context files are still uploading. If you submit a request while uploads are in progress, the AI assistant will not have access to them and may not understand your request.

Entering Requests

To enter a request, place focus on the shell area of the AI Chat tool. Pressing Enter will submit your request for processing, and the AI's response will be shown below once it becomes available. Requests can take some time to complete, since the process is compute intensive.

To clear your chat or start a new conversation, right-click on the chat and select Clear or New Conversation.

You can also right-click on specific blocks of code produced by the AI and copy them to the clipboard, paste them into the current editor position, or create a new file with that code.

Options

By default, AI chat sends what you have typed to the AI provider as soon as you press Enter. You can change this so that Enter instead adds a new line, allowing you to type multi-line requests, by unchecking Enter Key Sends Chat Message in the Options menu of the AI tool. Once that is done, you can still submit your message by pressing Ctrl-Enter, or press the Send button in the bottom right.

AI Provider Account Resources

Wing implements AI chat by creating an AI Assistant in your OpenAI account. Wing also uploads files during your chat, for use as context by the AI when it is answering your questions. Both the Assistant and files will be visible through the dashboard of your OpenAI account while you are using Wing. Once you close your project or quit Wing, these resources should disappear.

Wing keeps track of the Assistants and files it creates and periodically retries removing them if a network outtage or other problems initially prevents their removal. If this fails, you can use menu item Edit > Command by Name and enter the command internal-ai-delete-resources to remove all the assistants and files that Wing has created in your OpenAI account. You will need to restart instances of Wing that were using the deleted resources, before AI chat will work again.

If you used Wing 10.0.7.1 and earlier, then you may have many untitled Vector Stores in your OpenAI account. These were created by earlier OpenAI API versions as a result of calls made by Wing's AI Chat feature when it was using v1 of the OpenAI API. You can remove these also by invoking internal-ai-delete-resources(untitled_vector_stores=True) from Edit > Command by Name. Use caution, however, if you have other applications that may still be using these untitled vector stores.

Key Binding

If you would like to use a key binding to display the AI Chat feature, you can bind the command ai-chat to any key sequence with the User Interface > Keyboard > Custom Key Bindings preference.