Interface for a class AIAssistView
EmitType<Object>
Event triggers when the component is created.
EmitType<PromptChangedEventArgs>
Event triggered when the prompt text changed in the AIAssistView component.
EmitType<PromptRequestEventArgs>
Event triggered when a prompt request is made in the AIAssistView component. Provides details about the prompt request, including whether it should be cancelled, the prompt text, output, and toolbar items.
EmitType<StopRespondingEventArgs>
Triggers when the ‘Stop Responding’ button is clicked while a prompt request is in progress. This event allows users to handle stopping the response generation and update the UI accordingly.
number
Specifies the index of the active view in the AIAssistView component. Determines the currently active and visible view.
string
| Function
Specifies the template for the banner in the AIAssistView component. Represents the content or layout used to render the banner. Can be a string or a function.
<div id='assistview-container' style="height: 350px; width: 650px;">
<div id="bannerTemplate"></div>
</div>
import { AIAssistView } from '@syncfusion/ej2-interactive-chat';
let aiAssistView: AIAssistView = new AIAssistView({
bannerTemplate: `<div class="banner-content"><div class="e-icons e-assistview-icon"></div><h3>AI Assistance.</h3></div>`,
});
aiAssistView.appendTo('#bannerTemplate');
string
Specifies custom CSS classes for the AIAssistView component. Allows for additional custom styling.
boolean
Enable or disable persisting component’s state between page reloads.
boolean
Enable or disable rendering component in right to left direction.
string
| Function
Specifies the template for the footer in the AIAssistView component. Defines the content or layout used to render the footer. Can be a string or a function.
<div id='assistview-container' style="height: 350px; width: 650px;">
<div id="footerTemplate"></div>
</div>
import { AIAssistView } from '@syncfusion/ej2-interactive-chat';
let aiAssistView: AIAssistView = new AIAssistView({
footerTemplate: `<div><textarea id="promptTextArea" class="e-input"></textarea><button>Generate</button></div>`,
});
aiAssistView.appendTo('#footerTemplate');
string
| number
Specifies the height of the AIAssistView component.
string
Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.
string
Specifies the text input prompt for the AIAssistView component.
string
Specifies the CSS class for the prompter avatar in the AIAssistView component. Allows custom styling for the prompt avatar.
string
| Function
Specifies the template for rendering prompt items in the AIAssistView component. Defines the content or layout used to render prompt items, and can be either a string or a function. The template context includes prompt text and toolbar items.
<div id='assistview-container' style="height: 350px; width: 650px;">
<div id="promptItemTemplate"></div>
</div>
<script id="customPromptTemplate" type="text/x-jsrender">
<div>
${prompt}
</div>
</script>
import { AIAssistView, PromptModel } from '@syncfusion/ej2-interactive-chat';
let promptsData: PromptModel[] = [
{
prompt: "What is AI?",
response: `<div>AI stands for Artificial Intelligence, enabling machines to mimic human intelligence for tasks such as learning, problem-solving, and decision-making.</div>`
}
];
let aiAssistView: AIAssistView = new AIAssistView({
prompts: promptsData,
promptRequest: (args: PromptRequestEventArgs) => {
setTimeout(() => {
aiAssistView.addPromptResponse('Connect the AIAssistView component to OpenAI or Azure Cognitive Services for real-time prompts, using API credentials for authentication.');
}, 1000);
},
promptItemTemplate: '#customPromptTemplate'
});
aiAssistView.appendTo('#promptItemTemplate');
string
Specifies the placeholder text for the prompt input text area in the AIAssistView component.
string
| Function
Specifies the template for rendering prompt suggestion items in the AIAssistView component. Defines the content or layout used to render prompt suggestion items, and can be either a string or a function. The template context includes the index and suggestion text.
<div id='assistview-container' style="height: 350px; width: 650px;">
<div id="suggestionTemplate"></div>
</div>
<script id="customSuggestionTemplate" type="text/x-jsrender">
<div>${promptSuggestion}</div>
</script>
import { AIAssistView } from '@syncfusion/ej2-interactive-chat';
let aiAssistView: AIAssistView = new AIAssistView({
promptSuggestions: [
"Best practices for clean, maintainable code?",
"How to optimize code editor for speed?"
],
promptRequest: (args: PromptRequestEventArgs) => {
setTimeout(() => {
aiAssistView.addPromptResponse('Connect the AIAssistView component to OpenAI or Azure Cognitive Services for real-time prompts, using API credentials for authentication.');
}, 1000);
},
promptSuggestionItemTemplate: '#customSuggestionTemplate'
});
aiAssistView.appendTo('#suggestionTemplate');
string[]
Specifies the list of prompt suggestions in the AIAssistView component. Contains suggestions that can be used as prompts.
<div id='assistview-container' style="height: 350px; width: 650px;">
<div id="suggestions"></div>
</div>
import { AIAssistView, PromptRequestEventArgs } from '@syncfusion/ej2-interactive-chat';
let aiAssistView: AIAssistView = new AIAssistView({
promptSuggestions: [
"Best practices for clean, maintainable code?",
"How to optimize code editor for speed?"
],
promptRequest: (args: PromptRequestEventArgs) => {
setTimeout(() => {
aiAssistView.addPromptResponse('Connect the AIAssistView component to OpenAI or Azure Cognitive Services for real-time prompts, using API credentials for authentication.');
}, 1000);
}
});
aiAssistView.appendTo('#suggestions');
string
Specifies the header text for the prompt suggestions in the AIAssistView component. Provides a header for the list of suggestions.
Specifies the settings for the prompt toolbar in the AIAssistView component. Represents the configuration for the toolbar associated with prompt items.
<div id='assistview-container' style="height: 350px; width: 650px;">
<div id="promptSettings"></div>
</div>
import { AIAssistView, PromptRequestEventArgs, PromptToolbarSettingsModel, promptsData } from '@syncfusion/ej2-interactive-chat';
let promptToolbarSettings: PromptToolbarSettingsModel = {
items: [
{ type: 'Button', iconCss: 'e-icons e-edit' }
]
};
let promptsData: PromptModel[] = [
{
prompt: "What is AI?",
response: `<div>AI stands for Artificial Intelligence, enabling machines to mimic human intelligence for tasks such as learning, problem-solving, and decision-making.</div>`
}
];
let aiAssistView: AIAssistView = new AIAssistView({
prompts: promptsData,
promptToolbarSettings: promptToolbarSettings,
promptRequest: (args: PromptRequestEventArgs) => {
setTimeout(() => {
aiAssistView.addPromptResponse('Connect the AIAssistView component to OpenAI or Azure Cognitive Services for real-time prompts, using API credentials for authentication.');
}, 1000);
}
});
aiAssistView.appendTo('#promptSettings');
Specifies the collection of prompts and their responses in the AIAssistView component.
<div id='assistview-container' style="height: 350px; width: 650px;">
<div id="prompts"></div>
</div>
import { AIAssistView, PromptRequestEventArgs, PromptModel } from '@syncfusion/ej2-interactive-chat';
let promptsData: PromptModel[] = [
{
prompt: "What is AI?",
response: `<div>AI stands for Artificial Intelligence, enabling machines to mimic human intelligence for tasks such as learning, problem-solving, and decision-making.</div>`
}
];
let aiAssistView: AIAssistView = new AIAssistView({
prompts: promptsData,
promptRequest: (args: PromptRequestEventArgs) => {
setTimeout(() => {
aiAssistView.addPromptResponse('Connect the AIAssistView component to OpenAI or Azure Cognitive Services for real-time prompts, using API credentials for authentication.');
}, 1000);
}
});
aiAssistView.appendTo('#prompts');
string
Specifies the CSS class for the responder avatar in the AIAssistView component. Allows custom styling for the responder avatar.
string
| Function
Specifies the template for rendering response items in the AIAssistView component. Defines the content or layout used to render response items, and can be either a string or a function. The template context includes the prompt text, response text, and toolbar items.
<div id='assistview-container' style="height: 350px; width: 650px;">
<div id="responseItemTemplate"></div>
</div>
<script id="customResponseTemplate" type="text/x-jsrender">
<div>
${response}
</div>
</script>
import { AIAssistView, PromptModel } from '@syncfusion/ej2-interactive-chat';
let promptsData: PromptModel[] = [
{
prompt: "What is AI?",
response: `<div>AI stands for Artificial Intelligence, enabling machines to mimic human intelligence for tasks such as learning, problem-solving, and decision-making.</div>`
}
];
let aiAssistView: AIAssistView = new AIAssistView({
prompts: promptsData,
promptRequest: (args: PromptRequestEventArgs) => {
setTimeout(() => {
aiAssistView.addPromptResponse('Connect the AIAssistView component to OpenAI or Azure Cognitive Services for real-time prompts, using API credentials for authentication.');
}, 1000);
},
responseItemTemplate: '#customResponseTemplate',
});
aiAssistView.appendTo('#responseItemTemplate');
Specifies the settings for the response toolbar in the AIAssistView component. Represents the configuration for the toolbar associated with response items.
<div id='assistview-container' style="height: 350px; width: 650px;">
<div id="responseSettings"></div>
</div>
import { AIAssistView, PromptRequestEventArgs, ResponseToolbarSettingsModel, promptsData } from '@syncfusion/ej2-interactive-chat';
let promptsData: PromptModel[] = [
{
prompt: "What is AI?",
response: `<div>AI stands for Artificial Intelligence, enabling machines to mimic human intelligence for tasks such as learning, problem-solving, and decision-making.</div>`
}
];
let responseToolbarSettings: ResponseToolbarSettingsModel = {
items: [
{ type: 'Button', iconCss: 'e-icons e-download' },
{ type: 'Button', iconCss: 'e-icons e-refresh' },
{ type: 'Button', iconCss: 'e-icons e-assist-like' },
{ type: 'Button', iconCss: 'e-icons e-assist-dislike' }
]
};
let aiAssistView: AIAssistView = new AIAssistView({
prompts: promptsData,
responseToolbarSettings: responseToolbarSettings,
promptRequest: (args: PromptRequestEventArgs) => {
setTimeout(() => {
aiAssistView.addPromptResponse('Connect the AIAssistView component to OpenAI or Azure Cognitive Services for real-time prompts, using API credentials for authentication.');
}, 1000);
}
});
aiAssistView.appendTo('#responseSettings');
boolean
Specifies whether the clear button of text area is displayed in the AIAssistView component. Determines if a button for clearing the prompt text area is shown or hidden.
boolean
Specifies whether the header is displayed in the AIAssistView component.
Specifies the toolbar settings for the AIAssistView component. Represents the configuration for toolbar items and actions within the component.
<div id='assistview-container' style="height: 350px; width: 650px;">
<div id="toolbarItems"></div>
</div>
import { AIAssistView, PromptRequestEventArgs, ToolbarSettingsModel } from '@syncfusion/ej2-interactive-chat';
let assistViewToolbarSettings: ToolbarSettingsModel = {
items: [
{ type: 'Button', iconCss: 'e-icons e-user', align: 'Right', disabled: true }
]
};
let aiAssistView: AIAssistView = new AIAssistView({
toolbarSettings: assistViewToolbarSettings,
promptRequest: (args: PromptRequestEventArgs) => {
setTimeout(() => {
aiAssistView.addPromptResponse('Connect the AIAssistView component to OpenAI or Azure Cognitive Services for real-time prompts, using API credentials for authentication.');
}, 1000);
}
});
aiAssistView.appendTo('#toolbarItems');
Specifies the collection of assist view models in the AIAssistView component. Represents the views available in the assist view.
<div id='assistview-container' style="height: 350px; width: 650px;">
<div id="views"></div>
</div>
import { AIAssistView, PromptRequestEventArgs, AssistViewModel } from '@syncfusion/ej2-interactive-chat';
let assistViews: AssistViewModel[] = [
{
type: 'Assist',
name: "Prompt"
},
{
type: 'Custom',
name: 'Response',
iconCss: 'e-icons e-comment-show',
viewTemplate: '<div class="view-container"><h5>Response view content</h5></div>'
}
];
let aiAssistView: AIAssistView = new AIAssistView({
views: assistViews,
promptRequest: (args: PromptRequestEventArgs) => {
setTimeout(() => {
aiAssistView.addPromptResponse('Connect the AIAssistView component to OpenAI or Azure Cognitive Services for real-time prompts, using API credentials for authentication.');
}, 1000);
}
});
aiAssistView.appendTo('#views');
string
| number
Specifies the width of the AIAssistView component.