diff --git a/examples-standalone/coffee-warehouse/src/app/components/numeric-textbox-buttons/numeric-textbox-buttons.component.ts b/examples-standalone/coffee-warehouse/src/app/components/numeric-textbox-buttons/numeric-textbox-buttons.component.ts index adb821aa..36a7ac76 100644 --- a/examples-standalone/coffee-warehouse/src/app/components/numeric-textbox-buttons/numeric-textbox-buttons.component.ts +++ b/examples-standalone/coffee-warehouse/src/app/components/numeric-textbox-buttons/numeric-textbox-buttons.component.ts @@ -44,6 +44,7 @@ export class NumericTextboxButtonsComponent { public increaseValue(): void { if (this.max && this.value + this.step >= this.max) { this.value = this.max; + this.valueChange.emit(this.value); return; } this.value += this.step; @@ -53,6 +54,7 @@ export class NumericTextboxButtonsComponent { public decreaseValue(): void { if (this.min && this.value - this.step <= this.min) { this.value = this.min; + this.valueChange.emit(this.value); return; } this.value -= this.step; diff --git a/examples-standalone/coffee-warehouse/src/app/components/settings-list/settings-list.component.html b/examples-standalone/coffee-warehouse/src/app/components/settings-list/settings-list.component.html index d1f9533e..16ffd880 100644 --- a/examples-standalone/coffee-warehouse/src/app/components/settings-list/settings-list.component.html +++ b/examples-standalone/coffee-warehouse/src/app/components/settings-list/settings-list.component.html @@ -1,56 +1,72 @@ - - - - - + + + + + + + +
- + - - - - + + + + + + + - - - - + + + + + + +
- - + + + + + + + +
- + - + diff --git a/examples-standalone/coffee-warehouse/src/app/components/settings-list/settings-list.component.ts b/examples-standalone/coffee-warehouse/src/app/components/settings-list/settings-list.component.ts index 3c3e4f85..6afd0d47 100644 --- a/examples-standalone/coffee-warehouse/src/app/components/settings-list/settings-list.component.ts +++ b/examples-standalone/coffee-warehouse/src/app/components/settings-list/settings-list.component.ts @@ -1,5 +1,5 @@ import { Component, ViewChild } from '@angular/core'; -import { SettingsService } from '../../settings.service'; +import { defaultFont, SettingsService } from '../../settings.service'; import { groupBy } from '@progress/kendo-data-query'; import { SVGIcon, arrowRotateCcwIcon, fontFamilyIcon, imageResizeIcon, pauseSmIcon, underlineIcon } from '@progress/kendo-svg-icons'; import { contrastIcon, darkModeIcon, dyslexiaFontIcon, microphoneIcon } from './svg-icons'; @@ -15,6 +15,7 @@ import { IWindow } from '../../models/window.model'; export class SettingsListComponent { public settingsExpanded = true; public settings: any; + public comboboxValue = null; public disabilitiesData: any[] = groupBy([{ type: 'Visual Impairments', @@ -44,7 +45,7 @@ export class SettingsListComponent { type: 'Cognitive Disabilities', text: 'ADHD' }], [{field: 'type'}]); - + public recognition: any; public resetIcon: SVGIcon = arrowRotateCcwIcon; @@ -56,6 +57,7 @@ export class SettingsListComponent { public pauseIcon: SVGIcon = pauseSmIcon; public resizeIcon: SVGIcon = imageResizeIcon; public dyslexiaFontIcon: SVGIcon = dyslexiaFontIcon; + public defaultFont = defaultFont; @ViewChild(ComboBoxComponent) private combo: ComboBoxComponent; private subs: Subscription = new Subscription(); @@ -92,7 +94,7 @@ export class SettingsListComponent { }; } - public getSetting(prop: string): string { + public getSetting(prop: string): any { return this.settingsService.settings[prop]; } @@ -118,6 +120,8 @@ export class SettingsListComponent { body: 'body', userId: 1, }).subscribe(r => console.log('from API', r))); + + this.comboboxValue = value; } public activateSpeech() { diff --git a/examples-standalone/coffee-warehouse/src/app/openai.service.ts b/examples-standalone/coffee-warehouse/src/app/openai.service.ts index 759a4874..73fc9bb8 100644 --- a/examples-standalone/coffee-warehouse/src/app/openai.service.ts +++ b/examples-standalone/coffee-warehouse/src/app/openai.service.ts @@ -35,14 +35,17 @@ export class OpenAIService { const completion = await this.client.chat.completions.create(messages); const result = completion.choices[0].message.content; + console.log(result); return result; } private createMessages(selectedDisabilities: string[]): ChatCompletionCreateParamsNonStreaming { const prompt = ` Based on the following disabilities: ${selectedDisabilities.join(', ')}, - suggest the appropriate accessibility settings as a list of key-value pairs. - The keys should match the following settings: + suggest the appropriate accessibility settings as a single object. + Only include the settings that are applicable to the disabilities. + + The possible settings are: - textSize: Numeric value for text size (e.g. 16) - colorTheme: Either 'contrast' or 'dark' - font: Either 'legible' or 'dyslexia' @@ -52,9 +55,9 @@ export class OpenAIService { - lineHeight: Numeric value for line height (e.g. 1.2) - letterSpacing: Numeric value for letter spacing (e.g. 1) - The response should only return valid key-value pairs, for example: - [{textSize: 16}, {colorTheme: 'contrast'}, {pauseAnimations: true}] - Please provide the best configuration based on the disabilities. + Respond with only an object that contains the applicable settings. + Do not wrap the object in any syntax, such as \`\`\`json\`. + For example: { textSize: 18, font: 'dyslexia' } `; return { @@ -72,5 +75,4 @@ export class OpenAIService { }; } - } diff --git a/examples-standalone/coffee-warehouse/src/app/settings.service.ts b/examples-standalone/coffee-warehouse/src/app/settings.service.ts index 8048643e..11f4d649 100644 --- a/examples-standalone/coffee-warehouse/src/app/settings.service.ts +++ b/examples-standalone/coffee-warehouse/src/app/settings.service.ts @@ -3,8 +3,8 @@ import { } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; -const defaultFont = `'Roboto', sans-serif`; -const defaultTheme = 'https://kendo.cdn.telerik.com/themes/8.2.1/default/default-turquoise.css'; +export const defaultFont = `'Roboto', sans-serif`; +export const defaultTheme = 'https://kendo.cdn.telerik.com/themes/8.2.1/default/default-turquoise.css'; @Injectable() export class SettingsService { @@ -15,7 +15,7 @@ export class SettingsService { underlineLinks: false, pauseAnimations: false, lgSizeWidgets: false, - lineHeight: 1.2, + lineHeight: 1, letterSpacing: 0 }; @@ -41,7 +41,7 @@ export class SettingsService { underlineLinks: false, pauseAnimations: false, lgSizeWidgets: false, - lineHeight: 1.2, + lineHeight: 1, letterSpacing: 0 }