Skip to content

AI Assistant Dialog

The assistant dialog allows users to generate or refine content directly within the Uhuu editor, using AI-driven prompts and responses.

video

Parameters

The editDialog method is configured with the following options for assistant editing:

  • type Set to 'assistant' to indicate that the editor should open with assistant dialog.
  • path (string, required): Specifies the data path within the payload where the output will be stored. In this example, "marketing_content" is the target path for AI-generated content.

Example Setup

Below is an example of a simple React component setup to initialize The assistant Dialog for generating marketing content.

javascript
import ReactMarkdown from "react-markdown";

export default function ({ payload }) {
  const {marketing_content} = payload;

  return (                       
    <div onClick={() => $uhuu.editDialog({ path: 'marketing_content', type: 'assistant' })}>
      <div className="prose prose-sm">
        <ReactMarkdown children={marketing_content} />
      </div>
    </div>
  );
}

c

Once content is generated by the assistant, response text may be stored in the payload as follows:

json
{
  "marketing_content": "## Introducing Our Product\nLearn about the innovative features..."
}

This dialog is especially useful for content creation, marketing copy, or any document area requiring dynamic AI-generated text.

Multiple Types

When you have multiple dialog types available in an editable area, you can use the types parameter to pass an array of dialog type options.

video

Example: Call the editDialog method with the types parameter:

js
$uhuu.editDialog({
  types: [
    { title: "Lage", path: "listing.wp_areaenglish__c", type: 'assistant'},
    { title: "Parkieren", path: "listing.wp_parkinginternetenglish__c", type: 'assistant'},
    { title: "Ausbaustandard", path: "listing.wp_standardlevelenglish__c", type: 'assistant'},
    { title: "Besonderes", path: "listing.wp_specialsinternetenglish__c", type: 'assistant'}
  ]
})