PowerShell / ProjectMercury

An interactive shell to work with AI-powered assistance providers
MIT License
57 stars 15 forks source link

Support "@<agent name>" in addition to `/agent use` #205

Closed StevenBucher98 closed 2 months ago

StevenBucher98 commented 2 months ago

Summary of the new feature / enhancement

In many other platforms including VSCode, and clio the concept of scoping responses to specific agents or extensions is being done by prefixing responses with @<scope>, we should adopt a similar method where the user can run "@ " to switch between different agents and maintain that agent scope until user runs "@". This helps reduce the number of commands users need to run to switch agents and get the right answer to their question, previously users would need to do /agent use <x> and then ask their question.

Proposed technical implementation details (optional)

Since there are landing page that agents provide, we need to surface these somehow to ensure users can understand the capabilities of the agent and see necessary links before beginning to use this agent. To get this behavior we need to show the landing page when the user only uses the @agent without a query and then only on first time use for @agent <query>.

<first time launch>
aish:1>@myAgent
This myAgents landing page...
myAgent:1>
<first time using myOtherAgent>
myAgent:2>@myOtherAgent "how are you today?"
This is myOtherAgents landing page

I am doing well, how are you?
myOtherAgent:1>

A complete user flow can be seen:

PS>aish.exe
AI Shell
0.1.0-alpha.12

Please select an agent to use:

> interpreter
  ollama
  openai-gpt

interpreter:1>
interpreter:2> @ollama how do I list files out?
 You can list files in a given directory using the  Get-ChildItem  cmdlet in PowerShell. Here's the command:

    Get-ChildItem -Path "C:\Your\Directory\Path"

  Replace  "C:\Your\Directory\Path"  with the path of the directory you want to list.

ollama:1>@openai-gpt
OpenAi-GPT Landing page
openai-gpt:1>

In the example above ollama agent has been used before and no longer needs to display the landing page.

daxian-dbw commented 2 months ago

Support switching agent by tagging an agent's name:

  1. Support @<agent> and @<agent> <query> to switch to a different agent, or switch and send the query to that agent.
    • For @<agent> only, landing page of that agent will be display, just like running /agent use <agent>
    • For @<agent> <query>, we assume the user already knows about the capabilities of the target agent and thus won't show the landing page of that agent again.
  2. The prompt is updated to use the name of the current active agent by default. When --shell-wrapper is used at startup, the prompt defined in the wrapper.json will be used for the agent declared in the same file.
  3. When no agent is available, the default prompt aish will be used.
  4. Tab completion and prediction for the @<agent> are enabled.