Merged PR 22929: Allow user embed standalone qna part

Allow user embed standalone qna part in two supported modes: interactive and answer/result view.
This commit is contained in:
Arina Hantsis 2017-08-17 08:28:33 +00:00
Родитель 899d87bee3
Коммит 3936fd1f94
4 изменённых файлов: 124 добавлений и 0 удалений

Просмотреть файл

@ -11,6 +11,9 @@ export const settingsSchema = require('./schemas/settings.json');
export const basicFilterSchema = require('./schemas/basicFilter.json');
export const createReportSchema = require('./schemas/reportCreateConfiguration.json');
export const saveAsParametersSchema = require('./schemas/saveAsParameters.json');
export const loadQnaConfigurationSchema = require('./schemas/loadQnaConfiguration.json');
export const qnaSettingsSchema = require('./schemas/qnaSettings.json');
export const qnaInterpretInputDataSchema = require('./schemas/qnaInterpretInputData.json');
/* tslint:enable:no-var-requires */
import * as jsen from 'jsen';
@ -473,3 +476,39 @@ export interface ISaveAsParameters {
}
export const validateSaveAsParameters = validate(saveAsParametersSchema);
export interface IQnaSettings {
filterPaneEnabled?: boolean;
}
export interface ILoadQnaConfiguration {
accessToken: string;
datasetIds: string[];
utterance?: string;
viewMode?: QnAMode;
settings?: IQnaSettings;
tokenType?: TokenType;
}
export const validateLoadQnaConfiguration = validate(loadQnaConfigurationSchema, {
schemas: {
qnaSettings: qnaSettingsSchema,
}
});
export enum QnAMode {
Interactive,
NonInteractive,
}
export interface IQnaInterpretInputData {
utterance: string;
datasetIds?: string[];
}
export const validateQnaInterpretInputData = validate(qnaInterpretInputDataSchema);
export interface IQnaVisualRenderedEvent {
utterance: string;
normalizedUtterance?: string;
}

Просмотреть файл

@ -0,0 +1,48 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"accessToken": {
"type": "string",
"messages": {
"type": "accessToken must be a string",
"required": "accessToken is required"
}
},
"datasetIds": {
"type": "array",
"items": {
"type": "string"
},
"messages": {
"type": "datasetIds must be an array of strings",
"required": "datasetIds is required"
}
},
"utterance": {
"type": "string",
"messages": {
"type": "utterance must be a string"
}
},
"viewMode": {
"type": "number",
"enum": [ 0, 1 ],
"default": 0,
"invalidMessage": "viewMode property is invalid"
},
"settings": {
"$ref": "#qnaSettings"
},
"tokenType": {
"type": "number",
"enum": [ 0, 1 ],
"default": 0,
"invalidMessage": "tokenType property is invalid"
}
},
"required": [
"accessToken",
"datasetIds"
]
}

Просмотреть файл

@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"datasetIds": {
"type": "array",
"items": {
"type": "string"
},
"messages": {
"type": "datasetIds must be an array of strings"
}
},
"utterance": {
"type": "string",
"messages": {
"type": "utterance must be a string",
"required": "utterance is required"
}
}
},
"required": [
"utterance"
]
}

Просмотреть файл

@ -0,0 +1,12 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"filterPaneEnabled": {
"type": "boolean",
"messages": {
"type": "filterPaneEnabled must be a boolean"
}
}
}
}