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();
let result = await BridgeInstance.ask(keywordsPrompt,{
deleteConversation: true,
signal: controller.signal,
onMessage: (message) => {
console.log(message)
}
})
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)