New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ai-bridge

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ai-bridge

A browser extension library brings the AI power of the ChatGPT to another webpage.

  • 1.0.3
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Ai-Bridge

Important things

It is some kind of hacking thing so you should take responsibility to use this library since your account may be banned when your call the provider(chatgpt or ...) API frequently. I recommend you use the unimportant account to use this library.

What is ai-bridge ?

A browser extension library brings the AI power of the ChatGPT to another webpage.

Something to say!!!

We have seen so many great applications to bring the AI power of the ChatGPT to another webpage. One of the most famous is the ChatGPT for Google.It brings the AI power of the ChatGPT to google.

My friend! You can do the same thing by using this library in the background.js and injecting the content_script to the traditional website you want using the browser extension techie. Then you can send the message between the website and ChatGPT.

Here is my little project bringing the AI power of the ChatGPT to generate articles to help the student to improve their reading skill without using any server to read their data.

You can do the same thing and do it better to make the traditional website better or just use prompt engineering to create an amazing application for people.

Time to write some code, developer!!

Install

npm install ai-bridge

Usage

Import AI-Bridge:

import { ChatGptWebProvider }   from "ai-bridge"

Ask

import { ChatGptWebProvider } from "ai-bridge"
let BridgeInstance = new ChatGptWebProvider();


const controller = new AbortController();
// The result is the final answer.
let result = await BridgeInstance.ask(keywordsPrompt,{
    deleteConversation: true, // Set it true to delete the conversation to avoid exposing your prompt engineering stuff to the user.
    signal: controller.signal, // Abort signal
    onMessage: (message) => {
        console.log(message) // Get the real-time message. 
    }
})

// You can abort it later.
controller.abort()

Talk

Talking in the same chat channel.

let cId = ''
let pId = ''
const conversation = async (question:string, signal: AbortSignal) => {
    
    let { text, cId:conversationID, pId:parentMessageId } = await BridgeInstance.talk(keywordsPrompt,{
        signal,
        cId,
        pId,
        onMessage: (message) => {
            console.log(message)
        }
    })
    cId = conversationID
    pId = parentMessageId

    return text;
}

const controller = new AbortController();
let result = await conversation('Hi!',controller.signal)

Keywords

FAQs

Package last updated on 16 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc