AI Chat Assistant

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


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, any files selected by your AI request context (see below) will still be made 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.

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 and start a new conversation, select New Conversation from the AI Chat tool's Options menu.

You can 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.

Context

By default Wing sends only part or all of the current file with your AI request. If the code you want the AI to write needs to know about other code in your project, you can ask Wing to include that by setting up and selecting an AI context from the Context menu in the AI Chat tool. See AI Request Context for details.

Note that unlike AI suggest (Ctrl-? in the editor) and the AI Coder tool, which both send context in one unit along with each request, AI chat uploads selected files ahead of time, so the AI can preprocess them. The context icon to the left of the Context menu in the AI Chat tool can be used to review and modify files identified by your context configuration as being potentially relevant to your request. This icon changes 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.

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 Chat tool. Once that is done, you can still submit your message by pressing Ctrl-Enter, or press the Send button in the bottom right.

The Options menu also includes the following:

Load Request and Manage Saved Requests can be used to create and use saved requests. When items are selected from Load Request, the saved request's transformation string will be entered in the AI Chat tool and focus and context will be adjusted according to the saved request's configuration. You may see the context status indicator change after loading a saved request, if doing so changes the set of context files that are uploaded to the AI provider.

Switch to Provider and Manage AI Providers are used to select the AI provider currently in use by Wing's AI integration. See Configuring AI Providers for details.

Revoke Upload Permission revokes earlier permission for Wing to upload content to the AI provider, so that no content of any kind will be uploaded until permissions is once again granted for Wing to do so.

Reset Costs resets the stored AI request costs that are shown at the bottom of the AI Coder tool for the most recent request and all requests made so far. The accuracy of the costs displayed relies on the correctness of model pricing in the AI provider configuration.

Show Console shows a diagnostic console in the AI tool, which can be used to inspect the AI requests that are made and their results. This should only be needed when there are problems with the AI integration or if you want to see what data is being sent to the AI provider.

Show Documentation displays this documentation.

OpenAI Account Resources

If and only if you are using OpenAI as your AI provider, then Wing uses an AI Assistant in your OpenAI account to implement AI Chat. This allows Wing to upload files separately during your chat, as a more efficient way to provide context to 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 behind the scenes 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 tool, you can bind the command ai-chat to any key sequence with the User Interface > Keyboard > Custom Key Bindings preference.