Show HN: Add Siri Like Native AI Assistants to Any React/JS App

https://github.com/SugarAI-HQ/CopilotOne

Copilot One

Supercharge your existing Web/React App with a Siri-like Native AI Assistant.

Key Features

  • Voice To Action: Perform actions based on voice input.
  • Text To Action: Perform actions based on text input.
  • Current Screen Context: Auto generate embedding of current screen seend by user and create embeddings which is avaiable for RAG during LLM inferences. This make AI aware of current screen of the user and helps generate better responses.
  • Text API Interface: Transform existing APIs without any coding to support a natural language interface for both requests and responses. This simplies API invoication using voice and also integration in other copilot one powered Assistants.

Supported Voice-enabled UX Agents

  1. UI Agent: Enables hands-free capability to perform existing UI tasks and workflows.
  2. Navigation Agent: Assists users in navigating to the right page, section, or settings.
  3. Form Agent: Assist in filling form by autofilling based on voice or file input, advance validations, multilingual support. Simpler forms can be completely replaced by Voice to API Action.

These agents focuses on reducing learning curve for user and enalbes handsfree expereince for content discovery, feature discovery, user onboarding and form filling.

Assistants

  • Voice To Action: Offer Hansdfree expereicne to use your App.

Demo Video

Copilot One Demo Video

What future of AI Assistants looks Like ?

Goal is to create an open protocol for AI Assistants, Agents & Actions. Checkout Future of AI Assistants using this sdk.

Future of AI Assistants with Copilot One

Get Started

For details instructions. Read docs

Prerequisites

Before using this package, ensure you have the following:

  • An existing React application

  • Create copilot credentials from Sugar AI or Self Hosted Account

Install

You can install the @sugar-ai/copilot-one-js package via npm in your react project

Install Package

npm install @sugar-ai/copilot-one-js@latest

Add to your React App

In your main file. src/App.tsx

import { useCopilot, CopilotConfigType, CopilotProvider, VoiceAssistant } from '@sugar-ai/copilot-one-js';
const copilotConfig: CopilotConfigType = {
  copilotId: "<copilotId>",
  server: {
    endpoint: "http://play.sugarcaneai.dev/api",
    token: "<token>",
  },
  ai: {
    defaultPromptTemplate: "<prompt template>",
    defaultPromptVariables: {
      $AGENT_NAME: "Sugar",
    },
    successResponse: "Task is completed",
    failureResponse: "I am not able to do this"
  },
}
// Wrap the App with Copilot Provider
    <CopilotProvider config={copilotConfig}>
      <TodoApp />
    </CopilotProvider>

We are taking a exmple of a todo App. To track User's Current Screen Context using useStateEmbedding

const TodoApp = () => {
const { useStateEmbedding, registerAction, unregisterAction } = useCopilot(); // Add
// const [todos, setTodos] = useState([]);
const [todos, setTodos] = useStateEmbedding([], {scope1:"todoApp", scope2: "todos"}); // Switch
...
}

Register functions for create, delete and mark as done.

const TodoApp = () => {
  ...
  // Functionalies
  const addTodo = (task) => {...}};
  const deleteTodo = (task) => {...};
  const markTodoAsDoneById = function (todoId: number) {...};
  // Register addTodo function
  registerAction(
    "addTodo",
    {
      name: "addTodo",
      description: "Add a new todo",
      parameters: [
        {
          name: "task",
          type: "string",
          description: "Task description",
          required: true,
        }
      ],
    },
    addTodo,
  );
...
}

Roadmap

  • Web SDK Released

    • Voice To Action
    • Text To Action
    • Current Screen Context
  • POC

    • Text API Interface
  • [] Navigation Agent

  • [] Form Agent

{
"by": "nomad_ankur",
"descendants": 14,
"id": 40213337,
"kids": [
40217415,
40221236,
40221745,
40219947,
40218597
],
"score": 21,
"time": 1714496867,
"title": "Show HN: Add Siri Like Native AI Assistants to Any React/JS App",
"type": "story",
"url": "https://github.com/SugarAI-HQ/CopilotOne"
}
{
"author": "SugarAI-HQ",
"date": null,
"description": "Add Siri like Native AI Agents in you App. Contribute to SugarAI-HQ/CopilotOne development by creating an account on GitHub.",
"image": "https://opengraph.githubassets.com/6bc9c42edc0ce63b813a05c1b5a8ad5957e70df4a08b2f655e8d99a33d797333/SugarAI-HQ/CopilotOne",
"logo": "https://logo.clearbit.com/github.com",
"publisher": "GitHub",
"title": "GitHub - SugarAI-HQ/CopilotOne: Add Siri like Native AI Agents in you App.",
"url": "https://github.com/SugarAI-HQ/CopilotOne"
}
{
"url": "https://github.com/SugarAI-HQ/CopilotOne",
"title": "GitHub - SugarAI-HQ/CopilotOne: Add Siri like Native AI Agents in you App.",
"description": "Copilot One Supercharge your existing Web/React App with a Siri-like Native AI Assistant. Key Features Voice To Action: Perform actions based on voice input. Text To Action: Perform actions based on text...",
"links": [
"https://github.com/SugarAI-HQ/CopilotOne"
],
"image": "https://opengraph.githubassets.com/6bc9c42edc0ce63b813a05c1b5a8ad5957e70df4a08b2f655e8d99a33d797333/SugarAI-HQ/CopilotOne",
"content": "<div><article><p></p><h2>Copilot One</h2><a target=\"_blank\" href=\"https://github.com/SugarAI-HQ/CopilotOne#copilot-one\"></a><p></p>\n<p>Supercharge your existing Web/React App with a Siri-like Native AI Assistant.</p>\n<p></p><h2>Key Features</h2><a target=\"_blank\" href=\"https://github.com/SugarAI-HQ/CopilotOne#key-features\"></a><p></p>\n<ul>\n<li><strong>Voice To Action</strong>: Perform actions based on voice input.</li>\n<li><strong>Text To Action</strong>: Perform actions based on text input.</li>\n<li><strong>Current Screen Context</strong>: Auto generate embedding of current screen seend by user and create embeddings which is avaiable for RAG during LLM inferences. This make AI aware of current screen of the user and helps generate better responses.</li>\n<li><strong>Text API Interface</strong>: Transform existing APIs without any coding to support a natural language interface for both requests and responses. This simplies API invoication using voice and also integration in other copilot one powered Assistants.</li>\n</ul>\n<p></p><h2>Supported Voice-enabled UX Agents</h2><a target=\"_blank\" href=\"https://github.com/SugarAI-HQ/CopilotOne#supported-voice-enabled-ux-agents\"></a><p></p>\n<ol>\n<li><strong>UI Agent</strong>: Enables hands-free capability to perform existing UI tasks and workflows.</li>\n<li><strong>Navigation Agent</strong>: Assists users in navigating to the right page, section, or settings.</li>\n<li><strong>Form Agent</strong>: Assist in filling form by autofilling based on voice or file input, advance validations, multilingual support. Simpler forms can be completely replaced by Voice to API Action.</li>\n</ol>\n<p>These agents focuses on reducing learning curve for user and enalbes handsfree expereince for content discovery, feature discovery, user onboarding and form filling.</p>\n<p></p><h2>Assistants</h2><a target=\"_blank\" href=\"https://github.com/SugarAI-HQ/CopilotOne#assistants\"></a><p></p>\n<ul>\n<li><strong>Voice To Action</strong>: Offer Hansdfree expereicne to use your App.</li>\n</ul>\n<p></p><h2>Demo Video</h2><a target=\"_blank\" href=\"https://github.com/SugarAI-HQ/CopilotOne#demo-video\"></a><p></p>\n<p><a target=\"_blank\" href=\"https://www.youtube.com/watch?v=gYynr1xRLeU\"><img src=\"https://camo.githubusercontent.com/5dbce14467b5eecd5f698c9a493704d36a334e4004e4b81270384451f0fc7aac/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f6759796e723178524c65552f302e6a7067\" alt=\"Copilot One Demo Video\" /></a></p>\n<p></p><h2>What future of AI Assistants looks Like ?</h2><a target=\"_blank\" href=\"https://github.com/SugarAI-HQ/CopilotOne#what-future-of-ai-assistants-looks-like-\"></a><p></p>\n<p>Goal is to create an open protocol for AI Assistants, Agents &amp; Actions. Checkout Future of AI Assistants using this sdk.</p>\n<p><a target=\"_blank\" href=\"https://www.youtube.com/watch?v=t2e0CThWZUE\"><img src=\"https://camo.githubusercontent.com/de1fcdf925f5a6661a9e9761058a3fe9e09732bb4a1d1293b547a1a83f2ddce5/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f74326530435468575a55452f302e6a7067\" alt=\"Future of AI Assistants with Copilot One\" /></a></p>\n<p></p><h2>Get Started</h2><a target=\"_blank\" href=\"https://github.com/SugarAI-HQ/CopilotOne#get-started\"></a><p></p>\n<p>For details instructions. Read <a target=\"_blank\" href=\"https://docs.sugarai.dev/\">docs</a></p>\n<p></p><h2>Prerequisites</h2><a target=\"_blank\" href=\"https://github.com/SugarAI-HQ/CopilotOne#prerequisites\"></a><p></p>\n<p>Before using this package, ensure you have the following:</p>\n<ul>\n<li>\n<p>An existing React application</p>\n</li>\n<li>\n<p>Create copilot credentials from <a target=\"_blank\" href=\"https://play.sugarcaneai.dev/\">Sugar AI</a> or <a target=\"_blank\" href=\"https://github.com/SugarAI-HQ/CopilotOne/tree/develop/apps/factory\">Self Hosted</a> Account</p>\n</li>\n</ul>\n<p></p><h2>Install</h2><a target=\"_blank\" href=\"https://github.com/SugarAI-HQ/CopilotOne#install\"></a><p></p>\n<p>You can install the <code>@sugar-ai/copilot-one-js</code> package via npm in your react project</p>\n<p></p><h3>Install Package</h3><a target=\"_blank\" href=\"https://github.com/SugarAI-HQ/CopilotOne#install-package\"></a><p></p>\n<div><pre>npm install @sugar-ai/copilot-one-js@latest</pre></div>\n<p></p><h3>Add to your React App</h3><a target=\"_blank\" href=\"https://github.com/SugarAI-HQ/CopilotOne#add-to-your-react-app\"></a><p></p>\n<p>In your main file. src/App.tsx</p>\n<div><pre><span>import</span> <span>{</span> <span>useCopilot</span><span>,</span> <span>CopilotConfigType</span><span>,</span> <span>CopilotProvider</span><span>,</span> <span>VoiceAssistant</span> <span>}</span> <span>from</span> <span>'@sugar-ai/copilot-one-js'</span><span>;</span>\n<span>const</span> <span>copilotConfig</span>: <span>CopilotConfigType</span> <span>=</span> <span>{</span>\n <span>copilotId</span>: <span>\"&lt;copilotId&gt;\"</span><span>,</span>\n <span>server</span>: <span>{</span>\n <span>endpoint</span>: <span>\"http://play.sugarcaneai.dev/api\"</span><span>,</span>\n <span>token</span>: <span>\"&lt;token&gt;\"</span><span>,</span>\n <span>}</span><span>,</span>\n <span>ai</span>: <span>{</span>\n <span>defaultPromptTemplate</span>: <span>\"&lt;prompt template&gt;\"</span><span>,</span>\n <span>defaultPromptVariables</span>: <span>{</span>\n <span>$AGENT_NAME</span>: <span>\"Sugar\"</span><span>,</span>\n <span>}</span><span>,</span>\n <span>successResponse</span>: <span>\"Task is completed\"</span><span>,</span>\n <span>failureResponse</span>: <span>\"I am not able to do this\"</span>\n <span>}</span><span>,</span>\n<span>}</span>\n<span>// Wrap the App with Copilot Provider</span>\n <span>&lt;</span><span>CopilotProvider</span> <span>config</span><span>=</span><span>{</span>copilotConfig<span>}</span><span>&gt;</span>\n <span>&lt;</span><span>TodoApp</span> <span>/</span><span>&gt;</span>\n <span>&lt;</span><span>/</span>CopilotProvider&gt;</pre></div>\n<p>We are taking a exmple of a todo App. To track User's Current Screen Context using <code>useStateEmbedding</code></p>\n<div><pre><span>const</span> <span>TodoApp</span> <span>=</span> <span>(</span><span>)</span> <span>=&gt;</span> <span>{</span>\n<span>const</span> <span>{</span> useStateEmbedding<span>,</span> registerAction<span>,</span> unregisterAction <span>}</span> <span>=</span> <span>useCopilot</span><span>(</span><span>)</span><span>;</span> <span>// Add</span>\n<span>// const [todos, setTodos] = useState([]);</span>\n<span>const</span> <span>[</span><span>todos</span><span>,</span> <span>setTodos</span><span>]</span> <span>=</span> <span>useStateEmbedding</span><span>(</span><span>[</span><span>]</span><span>,</span> <span>{</span><span>scope1</span>:<span>\"todoApp\"</span><span>,</span> <span>scope2</span>: <span>\"todos\"</span><span>}</span><span>)</span><span>;</span> <span>// Switch</span>\n...\n<span>}</span></pre></div>\n<p>Register functions for create, delete and mark as done.</p>\n<div><pre><span>const</span> <span>TodoApp</span> <span>=</span> <span>(</span><span>)</span> <span>=&gt;</span> <span>{</span>\n ...\n <span>// Functionalies</span>\n <span>const</span> <span>addTodo</span> <span>=</span> <span>(</span><span>task</span><span>)</span> <span>=&gt;</span> <span>{</span>...<span>}</span><span>}</span><span>;</span>\n <span>const</span> <span>deleteTodo</span> <span>=</span> <span>(</span><span>task</span><span>)</span> <span>=&gt;</span> <span>{</span>...<span>}</span><span>;</span>\n <span>const</span> <span>markTodoAsDoneById</span> <span>=</span> <span>function</span> <span>(</span><span>todoId</span>: <span>number</span><span>)</span> <span>{</span>...<span>}</span><span>;</span>\n <span>// Register addTodo function</span>\n <span>registerAction</span><span>(</span>\n <span>\"addTodo\"</span><span>,</span>\n <span>{</span>\n <span>name</span>: <span>\"addTodo\"</span><span>,</span>\n <span>description</span>: <span>\"Add a new todo\"</span><span>,</span>\n <span>parameters</span>: <span>[</span>\n <span>{</span>\n <span>name</span>: <span>\"task\"</span><span>,</span>\n <span>type</span>: <span>\"string\"</span><span>,</span>\n <span>description</span>: <span>\"Task description\"</span><span>,</span>\n <span>required</span>: <span>true</span><span>,</span>\n <span>}</span>\n <span>]</span><span>,</span>\n <span>}</span><span>,</span>\n <span>addTodo</span><span>,</span>\n <span>)</span><span>;</span>\n...\n<span>}</span></pre></div>\n<p></p><h2>Roadmap</h2><a target=\"_blank\" href=\"https://github.com/SugarAI-HQ/CopilotOne#roadmap\"></a><p></p>\n<ul>\n<li>\n<p> Web SDK Released</p>\n<ul>\n<li> Voice To Action</li>\n<li> Text To Action</li>\n<li> Current Screen Context</li>\n</ul>\n</li>\n<li>\n<p>POC</p>\n<ul>\n<li> Text API Interface</li>\n</ul>\n</li>\n<li>\n<p>[] Navigation Agent</p>\n</li>\n<li>\n<p>[] Form Agent</p>\n</li>\n</ul>\n</article></div>",
"author": "",
"favicon": "https://github.githubassets.com/favicons/favicon.svg",
"source": "github.com",
"published": "",
"ttr": 99,
"type": "object"
}