### Run Development Server with npm Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/README.md Starts the application development server using the 'npm run start' command. This command compiles the project and serves it, typically in a default web browser. ```bash npm run start ``` -------------------------------- ### Clone Smart AI Samples Repository Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/README.md Clones the smart-ai-samples GitHub repository to your local machine. This is the initial step to get the project structure. ```bash git clone https://github.com/syncfusion/smart-ai-samples.git cd smart-ai-samples/typescript ``` -------------------------------- ### Configure Stability AI API Key (C# Example) Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/README.md Provides a C# example for configuring the API key for Stability AI, which is used for AI Image processing. This shows how the key might be stored in a C# application. ```csharp // Stability AI APIKEY public string ApiKey = "your-api-key"; ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/README.md Installs all the required Node.js packages for the project, as defined in the package.json file. This command should be run after cloning the repository. ```bash npm install ``` -------------------------------- ### Register Syncfusion License Key Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/README.md Activates the Syncfusion license key by running an npx command. This requires creating a syncfusion-license.txt file in the project root with the license key. ```bash npx syncfusion-license activate ``` -------------------------------- ### Install Ollama NuGet Packages for Blazor Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/README.md Installs the necessary NuGet packages for integrating Ollama with Blazor applications. These packages include core AI libraries and Ollama-specific integrations. ```powershell Install-Package Microsoft.Extensions.AI Install-Package OllamaSharp ``` -------------------------------- ### Run Development Server Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/README.md Starts the application development server using an npm script. This command compiles the code and launches the application in the default web browser, allowing for real-time development. ```bash npm run dev ``` -------------------------------- ### Install OpenAI NuGet Packages for Blazor Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/README.md Installs the necessary NuGet packages for integrating OpenAI with Blazor applications. These packages provide the core libraries for AI functionalities. ```powershell Install-Package Microsoft.Extensions.AI Install-Package Microsoft.Extensions.AI.OpenAI ``` -------------------------------- ### Install Azure OpenAI NuGet Packages for Blazor Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/README.md Installs the necessary NuGet packages for integrating Azure OpenAI with Blazor applications. These packages include core AI libraries and Azure-specific integrations. ```powershell Install-Package Microsoft.Extensions.AI Install-Package Microsoft.Extensions.AI.OpenAI Install-Package Azure.AI.OpenAI ``` -------------------------------- ### Configure Azure OpenAI and Gemini AI Models Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/README.md Demonstrates how to configure AI service credentials in the ai-models.ts file for both Azure OpenAI and Google Gemini. It shows placeholder values for resource names, API keys, and model names. ```typescript // for Azure Open AI service const azure = createAzure({ resourceName: 'YOUR_RESOURCE_NAME', apiKey: 'YOUR_API_KEY', }); const aiModel = azure('YOUR_MODEL_NAME'); // for gemini model const google = createGoogleGenerativeAI({ baseURL: "https://generativelanguage.googleapis.com/v1beta", apiKey: "API_KEY" }); const aiModel = google('YOUR_MODEL_NAME'); ``` -------------------------------- ### Configure Stability AI API Key for Image Editor Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/README.md Sets up the API key for Stability AI, a third-party service used for AI Image processing in the Image Editor component. The key is added as a bearer token. ```typescript const apiKey= `Bearer YOUR_API_KEY`; ``` -------------------------------- ### Configure OpenAI Service in Blazor Server App Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/README.md Configures the OpenAI service for Blazor Server applications. Requires installing Microsoft.Extensions.AI and Microsoft.Extensions.AI.OpenAI NuGet packages. It injects the OpenAI inference service into the application. ```csharp using Syncfusion.Blazor.SmartComponents; using Syncfusion.Blazor.AI; using Microsoft.Extensions.AI; using OpenAI; var builder = WebApplication.CreateBuilder(args); .... builder.Services.AddSyncfusionBlazor(); string openAIApiKey = "API-KEY"; string openAIModel = "OPENAI_MODEL"; OpenAIClient openAIClient = new OpenAIClient(openAIApiKey); IChatClient openAIChatClient = openAIClient.GetChatClient(openAIModel).AsIChatClient(); builder.Services.AddChatClient(openAIChatClient); builder.Services.AddSyncfusionSmartComponents() .InjectOpenAIInference(); var app = builder.Build(); .... ``` -------------------------------- ### Configure Ollama Service in Blazor Server App Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/README.md Configures the Ollama service for Blazor Server applications, allowing the use of self-hosted AI models. Requires installing Microsoft.Extensions.AI and OllamaSharp NuGet packages. It injects the Ollama chat client. ```csharp using Syncfusion.Blazor.SmartComponents; using Syncfusion.Blazor.AI; using Microsoft.Extensions.AI; using OllamaSharp; var builder = WebApplication.CreateBuilder(args); .... builder.Services.AddSyncfusionBlazor(); string ModelName = "MODEL_NAME"; IChatClient chatClient = new OllamaApiClient("http://localhost:11434", ModelName); builder.Services.AddChatClient(chatClient); builder.Services.AddSyncfusionSmartComponents() .InjectOpenAIInference(); var app = builder.Build(); .... ``` -------------------------------- ### Configure Azure OpenAI Service in Blazor Server App Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/README.md Configures the Azure OpenAI service for Blazor Server applications. Requires installing Microsoft.Extensions.AI, Microsoft.Extensions.AI.OpenAI, and Azure.AI.OpenAI NuGet packages. It injects the Azure OpenAI inference service. ```csharp using Syncfusion.Blazor.SmartComponents; using Syncfusion.Blazor.AI; using Azure.AI.OpenAI; using Microsoft.Extensions.AI; using System.ClientModel; var builder = WebApplication.CreateBuilder(args); .... builder.Services.AddSyncfusionBlazor(); string azureOpenAIKey = "AZURE_OPENAI_KEY"; string azureOpenAIEndpoint = "AZURE_OPENAI_ENDPOINT"; string azureOpenAIModel = "AZURE_OPENAI_MODEL"; AzureOpenAIClient azureOpenAIClient = new AzureOpenAIClient( new Uri(azureOpenAIEndpoint), new ApiKeyCredential(azureOpenAIKey) ); IChatClient azureOpenAIChatClient = azureOpenAIClient.GetChatClient(azureOpenAIModel).AsIChatClient(); builder.Services.AddChatClient(azureOpenAIChatClient); builder.Services.AddSyncfusionSmartComponents() .InjectOpenAIInference(); var app = builder.Build(); .... ``` -------------------------------- ### Use Open Iconic Standalone Icon Font Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/SyncfusionAISamples/wwwroot/open-iconic/README.md This example shows how to use Open Iconic's icon font on its own, without a specific framework. It requires linking the default stylesheet and using span elements with the 'oi' class and a 'data-glyph' attribute to specify the icon. ```html ``` -------------------------------- ### Implementing SmartTextArea in Vue.js Source: https://github.com/syncfusion/smart-ai-samples/blob/master/vue/src/ai-components/ai-smart-textarea/Readme.md This snippet demonstrates how to integrate the Syncfusion SmartTextArea component into a Vue.js application. It includes template setup, component registration, and property configuration for placeholder, label type, resize mode, dimensions, user role, predefined phrases, and AI suggestion handling. The `aiSuggestionHandler` is configured to call an asynchronous function for fetching AI suggestions. ```html ``` ```typescript import { Component, Vue } from 'vue-property-decorator'; import { SmartTextAreaComponent } from '@syncfusion/ej2-vue-inputs'; @Component({ components: { 'ejs-smarttextarea': SmartTextAreaComponent } }) export default class App extends Vue { public placeholder: string = 'Enter your queries here'; public floatLabelType: string = 'Auto'; public resizeMode: string = 'Both'; public rows: number = 3; public cols: number = 35; public userRole: string = 'Employee communicating with internal team'; public userPhrases: string[] = [ "Please find the attached report.", "Let's schedule a meeting to discuss this further.", "Can you provide an update on this task?", "I appreciate your prompt response.", "Let's collaborate on this project to ensure timely delivery." ]; public serverAIRequest = async (settings: any) => { let output = ''; try { const response = await (window as any).AzureAIRequest(settings) as string; output = response; } catch (error) { console.error("Error:", error); } return output; } } ``` -------------------------------- ### Annotate Form Fields for SmartPasteButton Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/src/ai-components/smartpaste/Readme.md These HTML examples illustrate how to use the `data-smartpaste-description` attribute on form elements (``, ` ``` -------------------------------- ### CSS: Reset and Basic Body Styling Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/src/index.html This snippet resets default margin and padding for all elements and sets the font family for the body. It ensures a consistent starting point for styling across different browsers. ```css /* Reset default margin and padding for all elements */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: Arial, sans-serif; } ``` -------------------------------- ### HTML: Custom Form Field Descriptions for Smart Paste Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/SyncfusionAISamples/Components/Pages/SmartPaste/Readme.md Demonstrates how to use the `data-smartpaste-description` attribute in HTML to provide custom descriptions for form fields. These descriptions guide the language model in generating accurate field values. This is useful for input, textarea, and checkbox elements. ```html ``` -------------------------------- ### Clone Git Repository Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/README.md Clones the smart-ai-samples repository and navigates into the React directory. This is the initial step to set up the project locally. ```bash git clone https://github.com/syncfusion/smart-ai-samples.git cd smart-ai-samples/react ``` -------------------------------- ### Configure AI Models (Azure OpenAI and Gemini) Source: https://github.com/syncfusion/smart-ai-samples/blob/master/angular/README.md This code demonstrates how to configure AI models for the project, specifically supporting both Azure OpenAI and Gemini. It shows how to create instances for each service using their respective SDKs and placeholders for credentials like resource name, API key, and model name. This configuration is done in the `./src/app/ai-models/ai-models.ts` file. ```typescript const azure = createAzure({ resourceName: 'YOUR_RESOURCE_NAME', apiKey: 'YOUR_API_KEY', }); const aiModel = azure('YOUR_MODEL_NAME'); // for gemini model const google = createGoogleGenerativeAI({ baseURL: "https://generativelanguage.googleapis.com/v1beta", apiKey: "API_KEY" }); const aiModel = google('YOUR_MODEL_NAME'); ``` -------------------------------- ### Initialize SmartTextArea with User Phrases Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/src/ai-components/smarttextarea/Readme.md Demonstrates how to initialize a SmartTextArea component, defining custom user phrases for AI suggestions and setting the suggestion display behavior. ```typescript let textareaObj: SmartTextArea = new SmartTextArea({ placeholder: 'Enter your queries here', floatLabelType: 'Auto', resizeMode: 'Both', rows: 3, cols: 35, userRole: 'Employee communicating with internal team', UserPhrases: [ "Please find the attached report.", "Let's schedule a meeting to discuss this further.", "Can you provide an update on this task?", "I appreciate your prompt response.", "Let's collaborate on this project to ensure timely delivery." ], aiSuggestionHandler: serverAIRequest, showSuggestionOnPopup: 'Enable' }); ``` -------------------------------- ### Configure Azure OpenAI and Gemini Models Source: https://github.com/syncfusion/smart-ai-samples/blob/master/vue/README.md This code illustrates how to configure AI models using the Vercel AI SDK for both Azure OpenAI and Gemini. It shows how to instantiate the clients with resource details and API keys, and then select a model. Replace placeholders with your actual credentials and model names. ```typescript const azure = createAzure({ resourceName: 'YOUR_RESOURCE_NAME', apiKey: 'YOUR_API_KEY', }); const aiModel = azure('YOUR_MODEL_NAME'); // for gemini model const google = createGoogleGenerativeAI({ baseURL: "https://generativelanguage.googleapis.com/v1beta", apiKey: "API_KEY" }); const aiModel = google('YOUR_MODEL_NAME'); ``` -------------------------------- ### Configure Azure OpenAI and Gemini Models Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/README.md Configures AI services for the project, supporting both Azure OpenAI and Gemini models. Replace placeholder values with your actual credentials and model names. The Azure endpoint format is provided for reference. ```typescript const azure = createAzure({ resourceName: 'YOUR_RESOURCE_NAME', apiKey: 'YOUR_API_KEY', }); const aiModel = azure('YOUR_MODEL_NAME'); // for gemini model const google = createGoogleGenerativeAI({ baseURL: "https://generativelanguage.googleapis.com/v1beta", apiKey: "API_KEY" }); const aiModel = google('YOUR_MODEL_NAME'); // Azure endpoint example: https://{resource_name}.openai.azure.com/ ``` -------------------------------- ### Configure Stability AI API Key for Image Editor Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/README.md Sets up the API key for Stability AI, used for AI image processing in the Image Editor component. Obtain an API key from Stability AI and replace the placeholder in the specified file. ```typescript const apiKey = `Bearer YOUR_API_KEY`; ``` -------------------------------- ### Register Syncfusion License Key Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/README.md Registers the Syncfusion license key in the main.tsx file. This is a mandatory step before using Syncfusion components in the React application. Replace the placeholder with your actual license key. ```typescript import { registerLicense } from '@syncfusion/ej2-base'; import { createRoot } from 'react-dom/client'; import { StrictMode } from 'react'; import { RouterProvider } from 'react-router-dom'; // Registering Syncfusion license key registerLicense('Replace your generated license key here'); // Assuming routerEle is defined elsewhere // createRoot(document.getElementById('root')!).render( // // // // ); ``` -------------------------------- ### Generate Content using Azure AI Chat Request Source: https://github.com/syncfusion/smart-ai-samples/blob/master/angular/src/app/document-editor/smart-editor/smart-editor.component copy.txt This function repeatedly calls the Azure AI Chat API to generate content. It attempts to get unique responses up to 3 times, storing them in 'this.outList'. The first generated response is then used to update the 'this.editableDiv'. ```typescript async onGenerate(options: AzureAIRequestOptions): Promise { this.outList = []; for (let i = 0; i < 3; i++) { const response = await getAzureChatAIRequest(options); if (response && this.outList.indexOf(response) === -1) { this.outList.push(response); } else { i--; } } if (this.outList.length > 0) { this.editableDiv.nativeElement.innerHTML = this.outList[0]; this.updateIndex(); } } ``` -------------------------------- ### Use Open Iconic with Foundation Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/SyncfusionAISamples/wwwroot/open-iconic/README.md This code demonstrates integrating Open Iconic icons with the Foundation framework. Similar to Bootstrap, it involves linking a Foundation-specific stylesheet and using span elements with 'fi' and 'fi-icon-name' classes. ```html ``` -------------------------------- ### Configure Stability AI for Image Editor Source: https://github.com/syncfusion/smart-ai-samples/blob/master/angular/README.md This snippet shows how to configure the API key for Stability AI, used for AI image processing in the Image Editor feature. The API key is formatted as a Bearer token and should be placed in the `./src/app/ai-models/stability-model.ts` file. Obtain your API key from the Stability AI platform. ```typescript const apiKey = `Bearer YOUR_API_KEY`; ``` -------------------------------- ### Handle AI Translation Request - TypeScript Source: https://github.com/syncfusion/smart-ai-samples/blob/master/angular/src/app/document-editor/smart-editor/smart-editor.component copy.txt Prepares and initiates an AI translation request. It displays a spinner, captures the text from 'questionDiv', and sets up the 'AzureAIRequestOptions' object with messages for the AI model, including system instructions and the user's text. This function relies on external 'showSpinner' and 'hideSpinner' utilities. ```TypeScript async onTranslateClick() { showSpinner(document.getElementById('dialog') as HTMLElement); let text: string = this.questionDiv.nativeElement.innerText; const options: AzureAIRequestOptions = { messages: [ ``` -------------------------------- ### Image Editor Toolbar and Sidebar Integration Source: https://github.com/syncfusion/smart-ai-samples/blob/master/angular/src/app/image-editor/smart-editor/dd.txt This Angular snippet shows the integration of a toolbar and a sidebar for the Image Editor. The toolbar is configured with items and an event handler for click events. The sidebar is set to a 'Push' type, targeting the main content area, and contains a tree view for navigation. Event bindings for 'ToolbarClicked', 'onFileOpened', 'onCreated', and 'OnSelect' are included. ```html ``` -------------------------------- ### Use Open Iconic SVGs Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/SyncfusionAISamples/wwwroot/open-iconic/README.md This snippet demonstrates how to use Open Iconic's SVG files directly. It's a straightforward method, treating SVGs like any other image. Ensure to include an 'alt' attribute for accessibility. ```html icon name ``` -------------------------------- ### Use Open Iconic SVG Sprite Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/SyncfusionAISamples/wwwroot/open-iconic/README.md This section shows how to utilize Open Iconic's SVG sprite for efficient icon loading. It suggests adding a general class to the SVG and a unique class to the use tag for easier styling. Basic CSS for sizing and fill properties for coloring are also provided. ```html ``` ```css .icon { width: 16px; height: 16px; } .icon-account-login { fill: #f00; } ``` -------------------------------- ### Razor Component: Configure User Phrases with Placeholders for SmartTextArea Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/SyncfusionAISamples/Components/Pages/SmartTextArea/Readme.md This Razor component demonstrates how to configure user phrases for Syncfusion's SfSmartTextArea. It uses a placeholder `NEED_INFO` within phrases to prevent the AI from reusing specific details inappropriately, allowing the user to fill in the necessary information. This approach helps in generating more relevant and controlled AI suggestions. ```razor @using Syncfusion.Blazor.SmartComponents @code { string? text; string userRole = "Maintainer of an open-source project replying to GitHub issues"; string[] userPhrases = [ "Thank you for contacting us.", "To investigate, We will need a reproducible example as a public Git repository.", "Could you please post a screenshot of NEED_INFO?", "This sounds like a usage question. This issue tracker is intended for bugs and feature proposals. Unfortunately, we don't have the capacity to answer general usage questions and would recommend StackOverflow for a faster response.", "We do not accept ZIP files as reproducible examples.", "Bug report: File not found error occurred in NEED_INFO" ]; } ``` -------------------------------- ### Background Changer UI with Color Picker and Textbox Source: https://github.com/syncfusion/smart-ai-samples/blob/master/angular/src/app/image-editor/smart-editor/dd.txt This Angular code illustrates the UI for the Background Changer feature. It includes a color picker for selecting a new background color, preset color options, a textbox for custom background input (e.g., 'Waterfalls, Mountains, etc..'), and an 'Apply' button. Event bindings for 'bgRemoveBtnClick', 'change', 'beforeTileRender', and 'backgrounchanger' are shown. ```html
New Color

Preset Colors
Custom Background
``` -------------------------------- ### Register Syncfusion License Key in Vue Project Source: https://github.com/syncfusion/smart-ai-samples/blob/master/vue/README.md This code snippet demonstrates how to register your Syncfusion license key within a Vue.js application's main entry point. It imports the necessary function and applies the key before mounting the application. Ensure you replace 'YOUR_LICENSE_KEY' with your actual license key. ```typescript import { createApp } from 'vue' import App from './App.vue' import { registerLicense } from '@syncfusion/ej2-base'; // Register your Syncfusion license key registerLicense('YOUR_LICENSE_KEY'); createApp(App).mount('#app') ``` -------------------------------- ### CSS: Container and Layout Styling Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/src/index.html Sets up a flex container for main layout, defining its height to be the viewport height minus the navigation bar's height. It also styles the sidebar and the main content area. ```css #container { display: flex; height: calc(100vh - 50px);; } #sidebar { width: 250px; border-right: 1px solid #ccc; } #content { flex: 1; padding: 20px; } ``` -------------------------------- ### Kanban Board Card Template HTML Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/src/app/kanban/smart-recommendation/index.html HTML structure for the card template used in the Kanban board to display task details like title, description, and story points. ```html
${Title}
${Description}
``` -------------------------------- ### Register Syncfusion License Key in Angular Source: https://github.com/syncfusion/smart-ai-samples/blob/master/angular/README.md This snippet demonstrates how to register your Syncfusion license key in the main.ts file of an Angular project. This is a mandatory step before using Syncfusion components. It imports necessary functions and shows the correct placement for the license key. ```typescript import { bootstrapApplication } from '@angular/platform-browser'; import { appConfig } from './app/app.config'; import { AppComponent } from './app/app.component'; import { registerLicense } from '@syncfusion/ej2-base'; registerLicense('Replace your generated license key here'); bootstrapApplication(AppComponent, appConfig) .catch((err) => console.error(err)); ``` -------------------------------- ### Configure AI Services for Blazor Smart Components Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/SyncfusionAISamples/Components/Pages/SmartPaste/Readme.md Configures Syncfusion Smart Components, including the Smart Paste Button, by injecting necessary services and setting AI credentials. It supports both cloud-based API keys and self-hosted Ollama deployments. Ensure you replace placeholders with your actual API credentials. ```csharp builder.Services.AddSyncfusionSmartComponents() .ConfigureCredentials(new AIServiceCredentials("your-apiKey", "your-deploymentName", "your-endpoint")) .InjectOpenAIInference(); ``` ```csharp builder.Services.AddSyncfusionSmartComponents() .ConfigureCredentials(new AIServiceCredentials { SelfHosted=true, Endpoint= new Uri("Your self-hosted end point url") ,DeploymentName = "Your model name" }) .InjectOpenAIInference(); ``` -------------------------------- ### Handle AI Rephrase Request - TypeScript Source: https://github.com/syncfusion/smart-ai-samples/blob/master/angular/src/app/document-editor/smart-editor/smart-editor.component copy.txt Initiates an AI rephrasing request using Azure OpenAI. It shows a spinner, retrieves text from 'questionDiv', constructs an options object with system and user messages specifying tone, format, and length, and then calls an 'onGenerate' method. Dependencies include spinner functions and 'AzureAIRequestOptions'. ```TypeScript async onRewriteClick() { showSpinner(document.getElementById('dialog') as HTMLElement); let text: string = this.questionDiv.nativeElement.innerText; const options: AzureAIRequestOptions = { messages: [ { role: "system", content: `You are a helpful assistant. Your task is to analyze the provided text and rephrase it. Please adjust the text to reflect a tone of '${this.toneValue}', formatted in '${this.formatValue}' style, and maintain a length of '${this.lengthValue}'. Always respond in proper HTML format, excluding , , and tags.` }, { role: "user", content: text } ], model: "gpt-4", }; await this.onGenerate(options); hideSpinner(document.getElementById('dialog') as HTMLElement); } ``` -------------------------------- ### Initialize Document Editor with SFDT Data - TypeScript Source: https://github.com/syncfusion/smart-ai-samples/blob/master/angular/src/app/document-editor/smart-editor/smart-editor.component copy.txt Initializes the Syncfusion Document Editor with data in the SFDT format. It opens a document, sets its name, updates the title bar, and adds custom context menu items. Dependencies include the Document Editor and TitleBar components. ```typescript let sfdt: string = '{"sfdt":"UEsD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leBar(document.getElementById('documenteditor_titlebar')!, this.container.documentEditor, true); this.container.documentEditor.documentName = 'Getting Started'; this.titleBar.updateDocumentTitle(); this.container.documentEditor.contextMenu.addCustomMenu(this.menuItems, false); ``` -------------------------------- ### Initialize Syncfusion SmartPasteButton in React Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/src/ai-components/smartpaste/Readme.md This TypeScript code demonstrates how to import and initialize the SmartPasteButton component in a React application. It includes setting basic properties like content and icon, and a crucial `aiAssistHandler` for AI interactions. ```ts import { SmartPasteButton } from '@syncfusion/ej2-buttons'; // Initialize SmartPasteButton control. let button: SmartPasteButton = new SmartPasteButton({ content: 'Smart Paste', iconCss: "e-icons e-paste", aiAssistHandler: serverAIRequest }); // Render initialized SmartPasteButton. button.appendTo('#smart-paste'); const serverAIRequest = async (options: ChatOptions) => { let output: string | null = ''; try { output = await (window as any).AzureAIRequest(options) as string; output = output.replace('END_RESPONSE', '') } catch (error) { console.error("Error:", error); } return output; }; ``` -------------------------------- ### Use Open Iconic with Bootstrap Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/SyncfusionAISamples/wwwroot/open-iconic/README.md This snippet illustrates how to integrate Open Iconic icons when using the Bootstrap framework. It requires linking a specific Bootstrap stylesheet and then using span elements with predefined 'oi' and 'oi-icon-name' classes. ```html ``` -------------------------------- ### Initialize Syncfusion TextBox for Filtering (JavaScript) Source: https://github.com/syncfusion/smart-ai-samples/blob/master/angular/src/app/pivot-table/smart-pivottable/smart-pivottable.component copy.txt This snippet demonstrates the initialization of a Syncfusion TextBox component, used for user input in filter criteria. It includes configuration for placeholder text, CSS classes, a default value, and width. ```javascript let filterTextBox: TextBox = new TextBox({ placeholder: 'Enter filter category', cssClass: 'product-class', value: 'Bikes', width: '100%' }); filterTextBox.appendTo('#filterInput'); ``` -------------------------------- ### Handle Before Open Event - TypeScript Source: https://github.com/syncfusion/smart-ai-samples/blob/master/angular/src/app/document-editor/smart-editor/smart-editor.component copy.txt Sets the toolbar visibility to enable rephrasing before the dialog is opened. This ensures the rephrase functionality is ready when the user interacts with the document editor. ```typescript onBeforeOpen(): void { this.onChangeToolbarVisibility(true, false, false); } ``` -------------------------------- ### Add SmartTextArea Component in TypeScript Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/src/ai-components/smarttextarea/Readme.md Demonstrates how to initialize and append the Syncfusion SmartTextArea component in a TypeScript application. It requires the '@syncfusion/ej2-react-inputs' package and initializes the textarea with user-defined phrases and an AI suggestion handler. ```ts let textareaObj: SmartTextArea = new SmartTextArea({ placeholder: 'Enter your queries here', floatLabelType: 'Auto', resizeMode: 'Both', rows: 3, cols: 35, userRole: 'Employee communicating with internal team', UserPhrases: [ "Please find the attached report.", "Let's schedule a meeting to discuss this further.", "Can you provide an update on this task?", "I appreciate your prompt response.", "Let's collaborate on this project to ensure timely delivery." ], aiSuggestionHandler: serverAIRequest }); textareaObj.appendTo('#default'); const serverAIRequest = async (settings: any) => { let output = ''; try { const response = await (window as any).AzureAIRequest(settings) as string; output = response; } catch (error) { console.error("Error:", error); } return output; }; ``` -------------------------------- ### HTML for SmartTextArea Element Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/src/ai-components/smarttextarea/Readme.md Provides the necessary HTML structure to render the Syncfusion SmartTextArea component. It involves adding a simple textarea element with a unique ID that will be targeted by the JavaScript initialization. ```html ``` -------------------------------- ### CSS: Sidebar and Title Header Styling Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/src/index.html Styles the sidebar's top position and the title header's bottom border, shadow, width, and fixed positioning to ensure it stays visible at the top. ```css #sidebar{ top: 39px; } #title-header{ border-bottom: 1px solid #dee2e6; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); width: 100%; position: fixed; z-index: 1000001; } ``` -------------------------------- ### Initialize Syncfusion MultiSelect for Field Selection (JavaScript) Source: https://github.com/syncfusion/smart-ai-samples/blob/master/angular/src/app/pivot-table/smart-pivottable/smart-pivottable.component copy.txt This snippet initializes a Syncfusion MultiSelect component, allowing users to select multiple fields from a predefined data source. It includes configuration for placeholder text, dimensions, filtering, data binding, and selection mode. ```javascript let fieldsMultiSelect: MultiSelect = new MultiSelect({ placeholder: 'Select Fields', width: '150px', popupWidth: '180px', allowFiltering: true, dataSource: ['Country', 'Products', 'Product_Categories', 'Quarter', 'Year', 'Sold', 'Amount', 'In_Stock'], // Sample data mode: 'CheckBox', value: ['Year', 'Product_Categories', 'Sold'] }); fieldsMultiSelect.appendTo('#fieldsInput'); ``` -------------------------------- ### Configure Web Service URL in React TypeScript Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/src/ai-components/pdfviewer/Readme.md This snippet shows how to configure the local web service URL within a React TypeScript application. It highlights the need to replace a placeholder with the actual service address. This configuration is crucial for the AI features to communicate with the backend. ```typescript // Replace the SERVICE_URL with your local host const SERVICE_URL: string = 'webservice_localhost/api/pdfviewer'; Example: const SERVICE_URL: string = 'http://localhost:62870/api/pdfviewer'; ``` -------------------------------- ### CSS: Hamburger Icon Styling Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/src/index.html Styles hamburger menu icons, defining their dimensions, cursor style, and the fill color for their rect elements. Includes styles for two variations (.hamburger and .hamburger1). ```css .hamburger,.hamburger1 { width: 10px; height: 10px; cursor: pointer; } .hamburger rect,.hamburger1 rect { fill: #000; width: 100%; height: 4px; rx: 2; /* Rounded corners */ } .hamburger1 rect{ fill: #cbc2c2; } ```