<type>documentation</type>
<domain>ai</domain>
<id>description</id>
<title>Saved Requests</title>
<date>$Date: 2006-05-24 22:53:07 -0400 (Wed, 24 May 2006) $</date>
<version>$Revision: 13098 $</version>
<product>pro+</product>

Wing Pro lets you save named AI transformation requests for later reuse in various ways. This is
usually done from the ``AI Coder`` tool's ``Requests`` menu, which always has a current saved
request (initially ``Default``).

The ``Requests`` menu in the ``AI Coder`` tool contains the following items:

**Save Request** updates the current saved request with the transformation request string currently
in the ``AI Coder`` tool. This does not alter any other attributes of the saved request, which must
be done with ``Edit Request``.

**Edit Request** displays the saved request editing dialog for the current saved request. The
transformation request string currently in the ``AI Coder`` tool is used in the dialog in preference
to the previously stored string, and you may also alter the request name, target, context, and
action.

**Create New Saved Request** creates a new saved request based on the values currently in the ``AI
Coder`` tool. You will need to enter a name for the new request and may alter any of the other
attributes of the saved request. Once the request is saved, it becomes the new current saved request
in the ``AI Coder`` tool.

**Manage Saved Requests** displays the saved request manager dialog, which lets you see all saved
requests, and rename, duplicate, or delete them, or add new requests. This dialog also allows you to
indicate that a saved request should be shared by all projets.  You can also set a key binding for
each saved request, making it easier to invoke that particular request as you are working with code.
An example would be to bind a key to a request that instructs the AI to "clean up this code" or "add
a summary comment at the top".

The rest of the ``Requests`` menu lists all available saved requests, indicating the current one
with a check mark. These items load the selected saved request into the ``AI Coder`` tool and
change to that request as the current saved request. Depending on the settings in the ``AI Coder``
tool, this may affect the target, context, and action that will be used when the request is
submitted.

**Saved Request Dialog**

The saved request editing dialog, accessed from the ``Requests`` menu or from the saved request manager
dialog, lets you configure the following attributes for your saved request:

**Name** is the name of the saved AI transformation request.

**Target** specifies which code may be altered by the transformation request.

**Transformation Request** contains the instructions to the AI provider.

**Context** indicates which named AI context to use with the request.  It may either use the inherited
context already set in the ``AI Coder`` tool, or a specific named context.  See `AI Request Context
<ref:ai/context>`__ for more information about setting up and using request context.

**Result Action** controls how the results of your request will be applied.  This may be one of
the following:

* ``Replace Code`` uses ``AI Coder`` to submit the request and replaces the ``Target`` with the 
  AI generated result of your request.

* ``Create New File`` uses ``AI Coder`` to submit the request and creates a new untitled file
  with the results of your request.

* ``Use Existing AI Chat`` will execute the request in the ``AI Chat`` tool's current session.

* ``Start New AI Chat`` will start a new ``AI Chat`` session and then execute the request in 
  that new session.

These last two options are used only when the request is executed from the ``AI`` > ``Execute Request``
sub-menu or with the key binding assigned to the request.  These requests can still be loaded into and
used from the ``AI Coder`` tool but in that context will display results by creation a new untitled file.

**Using Requests in AI Chat**

The ``AI Chat`` tool also has the ability to make use of all saved AI requests.  This is done by selecting
items from ``Load Saved Request`` in the ``AI Chat`` tool's ``Options`` menu.  The saved request's
transformation request string will be entered into the ``AI Chat`` tool, and focus and context will
be changed if the saved request specifies them.  The request is not immediately executed, but can be
submitted by pressing ``Enter`` or the ``Send`` button in the ``AI Chat`` tool.

