@progress/kendo-angular-conversational-ui
Version:
Kendo UI for Angular Conversational UI components
76 lines (75 loc) • 2.64 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
import * as i0 from "@angular/core";
/**
* @hidden
* Default settings for the Speech to Text button.
* These settings can be overridden by the user.
*/
const STB_DEFAULT_SETTINGS = {
continuous: false,
disabled: false,
fillMode: 'flat',
integrationMode: 'webSpeech',
interimResults: false,
lang: 'en-US',
maxAlternatives: 1,
rounded: 'medium',
size: 'medium',
themeColor: 'base'
};
/**
* @hidden
*/
export class AIPromptService {
aiPrompt;
promptValue = '';
showOutputRating = false;
requestEvent = new Subject();
executeEvent = new Subject();
outputCopyEvent = new Subject();
outputRatingChangeEvent = new Subject();
promptCommands;
promptOutputs;
promptSuggestions;
textAreaSettings;
outputTemplate;
outputBodyTemplate;
_speechToTextButton;
get speechToTextButton() {
return this._speechToTextButton;
}
set speechToTextButton(settings) {
if (settings === true) {
this._speechToTextButton = STB_DEFAULT_SETTINGS;
}
else if (settings === false) {
this._speechToTextButton = null;
}
else {
this._speechToTextButton = { ...settings };
}
}
getFlattenPromptCommands(commands = this.promptCommands) {
let newArr = [];
commands.forEach(c => {
if (c.hasOwnProperty('children')) {
const childrenArr = c.children;
newArr = newArr.concat(childrenArr);
if (childrenArr.length > 0) {
this.getFlattenPromptCommands(childrenArr);
}
}
});
return newArr.concat(this.promptCommands);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptService });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AIPromptService, decorators: [{
type: Injectable
}] });