diff --git a/ej2-javascript-toc.html b/ej2-javascript-toc.html
index 3645e0557..8d784f8a2 100644
--- a/ej2-javascript-toc.html
+++ b/ej2-javascript-toc.html
@@ -174,12 +174,25 @@
AI Assistance
To get started, provide input or choose a suggestion.
',
+ promptSuggestions: suggestions,
+ toolbarSettings: {
+ items: [{ iconCss: 'e-icons e-refresh', align: 'Right' }],
+ itemClicked: toolbarItemClicked,
+ },
+ promptRequest:onPromptrequest,
+ stopRespondingClick: handleStopResponse
+});
+async function onPromptrequest(args) {
+ var lastResponse = "";
+ var defaultResponse = "⚠️ Something went wrong while connecting to the AI service. Please check your Ollama application running background.";
+ try {
+ // Send request to Ollama API
+ var response = await fetch('http://localhost:11434/api/generate', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ model: 'deepseek-r1',
+ prompt: `### Instruction:\nRespond in up to 5 lines.\n\n### Input:\n${args.prompt}`,
+ stream: false,
+ }),
+ });
+ var reply = await response.json();
+ var responseUpdateRate = 10;
+ async function streamResponse(response) {
+ var i = 0;
+ var responseLength = response.length;
+ while (i < responseLength && !stopStreaming) {
+ lastResponse += response[i];
+ i++;
+ if (i % responseUpdateRate === 0 || i === responseLength) {
+ var htmlResponse =marked.parse(lastResponse);
+ aiAssist.addPromptResponse(htmlResponse, i === responseLength);
+ aiAssist.scrollToBottom();
+ }
+ await new Promise(resolve => setTimeout(resolve, 15)); // Delay before the next chunk
+ }
+ aiAssist.promptSuggestions = suggestions;
+ }
+ if(response) {
+ stopStreaming = false;
+ streamResponse(reply.response);
+ }
+
+ } catch (error) {
+ aiAssist.addPromptResponse(defaultResponse, true);
+ aiAssist.promptSuggestions = suggestions;
+ }
+}
+
+aiAssist.appendTo('#llmAssist');
+
+function handleStopResponse() {
+ stopStreaming = true;
+}
+
+function toolbarItemClicked(args) {
+ if (args.item?.iconCss === 'e-icons e-refresh') {
+ aiAssist.prompts = [];
+ aiAssist.promptSuggestions = suggestions;
+ }}
\ No newline at end of file
diff --git a/ej2-javascript/code-snippet/ai-assistview/ai-integrations/llm-model/index.ts b/ej2-javascript/code-snippet/ai-assistview/ai-integrations/llm-model/index.ts
new file mode 100644
index 000000000..dae3e8d06
--- /dev/null
+++ b/ej2-javascript/code-snippet/ai-assistview/ai-integrations/llm-model/index.ts
@@ -0,0 +1,74 @@
+import { AIAssistView, PromptRequestEventArgs, ToolbarItemClickedEventArgs } from "@syncfusion/ej2-interactive-chat";
+import marked from 'marked';
+
+const suggestions = [
+ 'What are the best tools for organizing my tasks?',
+ 'How can I maintain work-life balance effectively?',
+];
+let stopStreaming: boolean = false;
+
+// Initialize AI AssistView
+const aiAssist = new AIAssistView({
+ bannerTemplate:
+ 'AI Assistance
To get started, provide input or choose a suggestion.
',
+ promptSuggestions: suggestions,
+ toolbarSettings: {
+ items: [{ iconCss: 'e-icons e-refresh', align: 'Right' }],
+ itemClicked: toolbarItemClicked,
+ },
+ promptRequest:onPromptrequest,
+ stopRespondingClick: handleStopResponse
+});
+async function onPromptrequest(args: PromptRequestEventArgs) {
+ let lastResponse = "";
+ const defaultResponse = "⚠️ Something went wrong while connecting to the AI service. Please check your Ollama application running background.";
+ try {
+ // Send request to Ollama API
+ const response = await fetch('http://localhost:11434/api/generate', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ model: 'deepseek-r1',
+ prompt: `### Instruction:\nRespond in up to 5 lines.\n\n### Input:\n${args.prompt}`,
+ stream: false,
+ }),
+ });
+ const reply = await response.json();
+ const responseUpdateRate = 10;
+ async function streamResponse(response:string) {
+ let i = 0;
+ const responseLength = response.length;
+ while (i < responseLength && !stopStreaming) {
+ lastResponse += response[i];
+ i++;
+ if (i % responseUpdateRate === 0 || i === responseLength) {
+ const htmlResponse =marked.parse(lastResponse);
+ aiAssist.addPromptResponse(htmlResponse, i === responseLength);
+ aiAssist.scrollToBottom();
+ }
+ await new Promise(resolve => setTimeout(resolve, 15)); // Delay before the next chunk
+ }
+ aiAssist.promptSuggestions = suggestions;
+ }
+ if(response) {
+ stopStreaming = false;
+ streamResponse(reply.response);
+ }
+
+ } catch (error) {
+ aiAssist.addPromptResponse(defaultResponse, true);
+ aiAssist.promptSuggestions = suggestions;
+ }
+}
+// Append the AI AssistView to the container
+aiAssist.appendTo('#llmAssist');
+
+function handleStopResponse(): void {
+ stopStreaming = true;
+}
+
+function toolbarItemClicked(args: ToolbarItemClickedEventArgs) {
+ if (args.item?.iconCss === 'e-icons e-refresh') {
+ aiAssist.prompts = [];
+ aiAssist.promptSuggestions = suggestions;
+ }}
\ No newline at end of file
diff --git a/ej2-javascript/code-snippet/ai-assistview/ai-integrations/llm-model/js/index.html b/ej2-javascript/code-snippet/ai-assistview/ai-integrations/llm-model/js/index.html
new file mode 100644
index 000000000..a7c85d5a3
--- /dev/null
+++ b/ej2-javascript/code-snippet/ai-assistview/ai-integrations/llm-model/js/index.html
@@ -0,0 +1,28 @@
+
+
+
+
+ Loading....
+ Loading....
+ Loading....
+ Loading....
+ Loading....
+ Loading....
+