clwoz-models
Version:
Models for ConversationLearner
166 lines (165 loc) • 5.59 kB
TypeScript
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { IOptions } from './slateSerializer';
import { ScoredBase, ScoredAction } from './Score';
import { CallbackResult } from './Callback';
export declare enum ActionTypes {
TEXT = "TEXT",
API_LOCAL = "API_LOCAL",
CARD = "CARD",
END_SESSION = "END_SESSION",
SET_ENTITY = "SET_ENTITY",
DISPATCH = "DISPATCH",
CHANGE_MODEL = "CHANGE_MODEL"
}
export declare enum ConditionType {
EQUAL = "EQUAL",
NOT_EQUAL = "NOT_EQUAL",
GREATER_THAN = "GREATER_THAN",
GREATER_THAN_OR_EQUAL = "GREATER_THAN_OR_EQUAL",
LESS_THAN = "LESS_THAN",
LESS_THAN_OR_EQUAL = "LESS_THAN_OR_EQUAL",
STRING_EQUAL = "STRING_EQUAL"
}
export declare enum ComparisonType {
NUMBER_OF_VALUES = "NUMBER_OF_VALUES",
NUMERIC_VALUE = "NUMERIC_VALUE",
STRING = "STRING"
}
export interface Condition {
entityId: string;
valueId?: string;
value?: number;
stringValue?: string;
condition: ConditionType;
}
export interface ActionClientData {
actionHashes?: string[];
lgName?: string;
mockResults: CallbackResult[];
}
export declare const CL_STUB_IMPORT_ACTION_ID = "51cd7df5-e504-451d-b629-0932e604689c";
export declare class ActionBase {
actionId: string;
actionType: ActionTypes;
createdDateTime: string;
payload: string;
isTerminal: boolean;
isEntryNode?: boolean;
repromptActionId?: string;
requiredEntitiesFromPayload: string[];
requiredEntities: string[];
negativeEntities: string[];
requiredConditions: Condition[];
negativeConditions: Condition[];
suggestedEntity: string | undefined;
version: number;
packageCreationId: number;
packageDeletionId: number;
entityId: string | undefined;
enumValueId: string | undefined;
clientData?: ActionClientData;
constructor(action: ActionBase);
static GetPayload(action: ActionBase | ScoredBase, entityValues: Map<string, string>): string;
static isPlaceholderAPI(action: Partial<ActionBase> | undefined): boolean;
static isPVAContent(action: Partial<ActionBase> | undefined): boolean;
static createPlaceholderAPIAction(placeholderName: string, isTerminal: boolean): ActionBase;
/** Return arguments for an action */
static GetActionArguments(action: ActionBase | ScoredAction): ActionArgument[];
}
export interface ActionList {
actions: ActionBase[];
}
export interface ActionIdList {
actionIds: string[];
}
export interface TextPayload {
json: object;
}
export interface ActionPayload {
payload: string;
logicArguments: IActionArgument[];
renderArguments: IActionArgument[];
isPlaceholder?: boolean;
isCallbackUnassigned?: boolean;
}
export interface ActionPayloadSingleArguments {
payload: string;
arguments: IActionArgument[];
}
export interface CardPayload {
payload: string;
arguments: IActionArgument[];
}
export interface IActionArgument {
parameter: string;
value: TextPayload;
}
export declare class ActionArgument {
parameter: string;
value: object;
constructor(actionArgument: IActionArgument);
renderValue(entityValues: Map<string, string>, serializerOptions?: Partial<IOptions>): string;
}
export interface RenderedActionArgument {
parameter: string;
value: string | null;
}
export declare class TextAction extends ActionBase {
value: object;
constructor(action: ActionBase);
renderValue(entityValues: Map<string, string>, serializerOptions?: Partial<IOptions>): string;
}
export declare class ApiAction extends ActionBase {
name: string;
logicArguments: ActionArgument[];
renderArguments: ActionArgument[];
isPlaceholder?: boolean;
isCallbackUnassigned?: boolean;
constructor(action: ActionBase);
renderLogicArguments(entityValues: Map<string, string>, serializerOptions?: Partial<IOptions>): RenderedActionArgument[];
renderRenderArguments(entityValues: Map<string, string>, serializerOptions?: Partial<IOptions>): RenderedActionArgument[];
private renderArgs;
}
export declare class CardAction extends ActionBase {
templateName: string;
arguments: ActionArgument[];
constructor(action: ActionBase);
renderArguments(entityValues: Map<string, string>, serializerOptions?: Partial<IOptions>): RenderedActionArgument[];
}
export declare class SessionAction extends ActionBase {
value: object;
constructor(action: ActionBase);
renderValue(entityValues: Map<string, string>, serializerOptions?: Partial<IOptions>): string;
}
export declare class PVAAction extends ActionBase {
value: string;
constructor(action: ActionBase);
renderValue(entityValues: Map<string, string>): string;
}
export declare type SetEntityPayload = {
entityId: string;
enumValueId: string;
};
export declare class SetEntityAction extends ActionBase {
entityId: string;
enumValueId: string;
constructor(action: ActionBase);
}
export declare type ModelPayload = {
modelId: string;
modelName: string;
};
export declare class ModelAction extends ActionBase {
modelId: string;
modelName: string;
constructor(action: ActionBase);
}
export declare class DispatchAction extends ModelAction {
constructor(action: ActionBase);
}
export declare class ChangeModelAction extends ModelAction {
constructor(action: ActionBase);
}