Configure Content AI
The Content AI extension for Tiptap accepts different settings to configure the global behavior of the extension and the commands.
Setting | Type | Default | Definition |
---|---|---|---|
appId | string | '' | Your Application ID which can be obtained by visiting the AI settings in Tiptap Cloud |
token | string | '' | In order to authenticate against our AI backend service, you’ll need to generate a JWT (with HS256) using your JWT secret, which you also obtain in your team’s AI settings page |
autocompletion | boolean | false | Enables the autocompletion feature. When writing text, just hit Tab to trigger the autocompletion and another Tab to accept the completion. We’re using a portion of your already written text to build a prompt for OpenAI. |
autocompletionOptions | object | { trigger: 'Tab', accept: 'Tab', debounce: 0, inputLength: 4000, modelName: 'gpt-3.5-turbo' } | Defines the trigger and length of text used to generate autocompletion suggestion. Accept defaults to trigger, if not set explicitly. Debounce in ms the request after trigger pressed. You can also choose the OpenAI model to run the autocompletion task. |
onLoading | (context: { editor: Editor, action: TextAction | 'image', isStreaming: boolean }) => void | undefined | Callback for when the AI has begun generating a response. |
onSuccess | (context: { editor: Editor, action: TextAction | 'image', isStreaming: boolean, response: string }) => void | undefined | Callback for when the AI has successfully finished generating a response. |
onChunk | (context: { editor: Editor, action: TextAction | 'image', isStreaming: boolean, response: string, chunk: string }) => void | undefined | Callback for when a chunk of the response is generated. chunk being the new string partial response being the generated response so far (including the chunk) |
onError | (error: Error, context: { editor: Editor, action: TextAction | 'image', isStreaming: boolean}) => void | undefined | Callback for when an error occurs while generating a response. |
showDecorations | boolean | true | If false , will not attempt to decorate AI suggestions in streaming mode. This reduces your ability to style suggestions but can fix issues with undo history |