React Text editor AI typeahead/autocomplete

540 Views Asked by At

Is there a way to add a chatGPT like typeahead/auto completion with react Quill or editor js? The one where I can start typing and AI will give me text suggestion from Open AI API which I can append to my text with a tab. Seems like there is no official way to achieve this in these packages.

1

There are 1 best solutions below

0
Mohib Ali On

There is a library available to provide WYSIWYG editor with AI-powered autocompletion. The name of this library is Novel which provides notion like editor with autocompletion text using Openai. It's very simple to use in your react component

npm i novel

Example

import Editor from "novel"
export default function App(){
return (
<Editor completionApi="/api/generate" />
  )
}

Where completionAPI prop is a route (if you are on nextjs) or a serverless cloud function url where you can implement the openai backend service required by your novel Editor component

Here they provide the example of api route in nextjs