botbuilder-dialogs package
クラス
| ChoiceFactory |
選択肢の一覧を含む 'message' アクティビティの書式設定を支援する一連のユーティリティ関数。 |
| ComponentDialog |
他の子ダイアログを含むダイアログの基本クラス。 |
| Configurable |
すべての構成可能なクラスの基本クラス。 |
| Dialog |
すべてのダイアログのコア動作を定義します。 |
| DialogContainer |
一連のダイアログのコンテナー。 |
| DialogContext |
現在のダイアログのコンテキストは、特定の DialogSetに関して変わります。 |
| DialogContextError |
ダイアログ スタックを含む追加のダイアログ コンテキストを含むエラー。 |
| DialogEvents |
ダイアログの "ライフサイクル" に関連するイベントを表します。 |
| DialogManager |
ダイアログ システムを実行するクラス。 |
| DialogSet |
すべてのユーザーが相互に呼び出すことができる、関連するダイアログ のセット。 |
| DialogTurnStateConstants |
ダイアログ ターン状態定数を定義します。 |
| DialogsBotComponent |
ボット ダイアログ用のボット コンポーネント。 |
| DialogsComponentRegistration |
ダイアログ コンポーネントをシステム登録機能で使用できるようにします。 |
| DialogPath |
使用可能なダイアログのパスを定義します。 |
| DialogStateManager |
DialogStateManager は、メモリ スコープとパス リゾルバーを管理します。 |
| AliasPathResolver |
aliasXXX -> path.xxx ($foo => dialog.foo) をマップします。 |
| AtAtPathResolver |
マップ @@ = 配列> turn.recognized.entitites.xxx。 |
| AtPathResolver |
Maps @@ => turn.recognized.entitites.xxx[0] |
| DollarPathResolver |
マップ $xxx => dialog.xxx |
| HashPathResolver |
マップ #xxx => turn.recognized.intents.xxx |
| PercentPathResolver |
マップ %xxx => class.xxx (別名 activeDialog.properties.xxx) |
| ScopePath |
使用可能なスコープのパスを定義します。 |
| BotStateMemoryScope |
BotState に基づくメモリ スコープの基本クラス。 |
| ClassMemoryScope |
ClassMemoryScope マップ "class" - dc.activeDialog.properties> |
| ConversationMemoryScope |
現在の会話にスコープが設定されているメモリ。 |
| DialogClassMemoryScope |
DialogClassMemoryScope マップ "dialogClass" - dc.parent.activeDialog.properties> |
| DialogContextMemoryScope |
|
| DialogMemoryScope |
DialogMemoryScope マップ "dialog" -> dc.parent.activeDialog.state ||dc.activeDialog.state |
| MemoryScope |
すべてのメモリ スコープの抽象基本クラス。 |
| SettingsMemoryScope |
SettingsMemoryScope maps "settings" -> dc.context.turnState['settings'] |
| ThisMemoryScope |
ThisMemoryScope maps "this" -> dc.activeDialog.state |
| TurnMemoryScope |
TurnMemoryScope は、現在のターンをスコープとするメモリを表します。 |
| UserMemoryScope |
現在のユーザーにスコープが設定されているメモリ。 |
| ThisPath |
アクティブなダイアログに渡されるパスを定義します。 |
| TurnPath |
有効なターンのパスを定義します。 |
| ActivityPrompt |
アクティビティの受信を待機します。 |
| AttachmentPrompt |
画像などの添付ファイルをアップロードするようにユーザーに求めます。 |
| ChoicePrompt |
選択肢の一覧から選択するようにユーザーに求めます。 |
| ConfirmPrompt |
"はい" または "いいえ" の応答で何かを確認するようにユーザーに求めます。 |
| DateTimePrompt |
datetime 式の入力をユーザーに求めます。 |
| NumberPrompt |
ユーザーに数値の入力を求めるメッセージを表示します。 |
| OAuthPrompt |
Bot Frameworks シングル サインオン (SSO) サービスを使用してサインインするようにユーザーに求める新しいプロンプトを作成します。 |
| Prompt |
すべてのプロンプトの基本クラス。 |
| PromptCultureModels |
Confirm and Choice Prompt で現在サポートされているカルチャ モデルのクラス コンテナー。 |
| TextPrompt |
ユーザーにテキストの入力を求めます。 |
| Recognizer |
認識エンジンの基本クラス。 |
| SkillDialog |
スキルへのリモート呼び出しをラップできる特殊なダイアログ。 |
| WaterfallDialog |
ウォーターフォールは、ユーザーに一連の質問を求める目的で最適化されたダイアログです。 |
| WaterfallStepContext |
|
インターフェイス
| BeginSkillDialogOptions |
SkillDialog のダイアログ引数を持つクラス。 |
| ChoiceFactoryOptions |
選択肢リストの書式設定を調整するために使用される追加のオプション。 |
| Choice |
選択肢をユーザーにレンダリングしたり、ユーザーが選択した内容を認識したりするために使用できる選択肢のインスタンス。 |
| FindChoicesOptions |
|
| FoundChoice |
|
| FindValuesOptions |
ユーザーの発話での選択肢の認識方法を制御するために使用される基本的な検索オプション。 |
| FoundValue |
INTERNAL: |
| SortedValue |
INTERNAL: 並べ替え可能で、ソース配列内の元の位置を参照できる値。
|
| ModelResult |
|
| Token |
|
| Converter |
コンバーターは、オブジェクトをある型から別の型に変換します。 |
| DialogConfiguration | |
| DialogEvent | |
| DialogInstance |
スタック上のダイアログのインスタンスの状態情報を格納します。 |
| DialogTurnResult |
ダイアログ コンテキストが 1 つ以上のダイアログを開始、続行、または操作しようとした結果を表します。 |
| DialogState |
特定の DialogSetのダイアログ状態、ダイアログ スタックの状態に関する情報が含まれます。 |
| DialogManagerConfiguration | |
| DialogManagerResult | |
| DialogDependencies | |
| ComponentMemoryScopes |
メモリ スコープを列挙するためのインターフェイス。 |
| ComponentPathResolvers |
パス リゾルバーを宣言するためのインターフェイス。 |
| DialogStateManagerConfiguration | |
| PathResolver |
Copyright (c) Microsoft Corporation。 すべての権限が予約されています。 MIT ライセンスに基づくライセンス。 |
| ChoiceDefaultsChoicePrompt | |
| ChoiceDefaultsConfirmPrompt | |
| DateTimeResolution |
|
| OAuthPromptSettings |
|
| PromptOptions |
すべてのプロンプトでサポートされる基本的な構成オプション。 |
| PromptRecognizerResult |
プロンプト認識エンジン関数によって返される結果。 |
| PromptValidatorContext |
カスタム |
| PromptCultureModel | |
| RecognizerConfiguration | |
| SkillDialogOptions | |
| TemplateInterface |
データを T にバインドするためのテンプレート インターフェイスを定義します。 |
| WaterfallStepInfo |
|
型エイリアス
| TokenizerFunction |
|
| ConverterFactory | |
| PromptValidator |
カスタム プロンプト 検証コントロールを提供するための関数シグネチャ。
|
| WaterfallStep |
個々のウォーターフォール ステップの関数シグネチャ。
|
列挙型
| DialogReason |
ダイアログ メソッドが呼び出される理由を示します。 |
| DialogTurnStatus |
ダイアログ コンテキストが 1 つ以上のダイアログの開始、続行、またはその他の操作を試みた後のダイアログ スタックの状態を表します。 も参照 |
| ListStyle |
|
関数
関数の詳細
findChoices(string, string | Choice[], FindChoicesOptions)
発話内の選択肢を認識するための中間レベルの検索機能。
function findChoices(utterance: string, choices: string | Choice[], options?: FindChoicesOptions): ModelResult<FoundChoice>[]
パラメーター
- utterance
-
string
検索対象のテキストまたはユーザーの発話。 受信 "メッセージ" アクティビティの場合は、単に context.activity.textを使用できます。
- choices
-
string | Choice[]
検索対象の選択肢の一覧。
- options
- FindChoicesOptions
(省略可能) 実行される検索を調整するために使用されるオプション。
戻り値
最も関連性の高い順に並べ替えられた、見つかった選択肢の一覧。
注釈
この関数は findValues() の上に階層化されており、実際の検索を実行するために findValues() を呼び出す前に検索する必要があるすべてのシノニムを単に決定します。
recognizeChoices() 関数は、この関数の上に階層化され、リスト内のインデックスまたは序数で選択を選択する機能を追加します。 この特定の関数を呼び出すことは、recognizeChoices()によってインデックスと序数位置の認識が行われないようにする場合に便利です。
const { findChoices } = require('botbuilder-choices');
const choices = ['red', 'green', 'blue'];
const utterance = context.activity.text;
const results = findChoices(utterance, choices);
if (results.length == 1) {
await context.sendActivity(`I like ${results[0].resolution.value} too!`);
} else if (results.length > 1) {
const ambiguous = results.map((r) => r.resolution.value);
await context.sendActivity(ChoiceFactory.forChannel(context, ambiguous, `Which one?`));
} else {
await context.sendActivity(ChoiceFactory.forChannel(context, choices, `I didn't get that... Which color?`));
}
findValues(string, SortedValue[], FindValuesOptions)
INTERNAL: 発話内の値のセットを検索する低レベル関数。
findChoices() や recognizeChoices() などの上位レベルの関数は、この関数の上に階層化されています。 ほとんどの場合、より高いレベルの関数の 1 つを呼び出す方が簡単ですが、この関数には選択肢の認識を促進するあいまい検索アルゴリズムが含まれています。
function findValues(utterance: string, values: SortedValue[], options?: FindValuesOptions): ModelResult<FoundValue>[]
パラメーター
- utterance
-
string
検索対象のテキストまたはユーザーの発話。
- values
検索対象の値の一覧。
- options
- FindValuesOptions
(省略可能) 実行される検索を調整するために使用されるオプション。
戻り値
見つかった値の一覧。
recognizeChoices(string, string | Choice[], FindChoicesOptions)
ユーザーの発話内の選択肢を認識するための高レベル関数。
function recognizeChoices(utterance: string, choices: string | Choice[], options?: FindChoicesOptions): ModelResult<FoundChoice>[]
パラメーター
- utterance
-
string
検索対象のテキストまたはユーザーの発話。 受信 "メッセージ" アクティビティの場合は、単に context.activity.textを使用できます。
- choices
-
string | Choice[]
検索対象の選択肢の一覧。
- options
- FindChoicesOptions
(省略可能) 実行される検索を調整するために使用されるオプション。
戻り値
最も関連性の高い順に並べ替えられた、見つかった選択肢の一覧。
注釈
これは findChoices() 関数の上に重ねられ、ユーザーがインデックスで選択を指定できるようにするロジック ("1" を選択して choice[0]を選択できます) または序数位置 ("2 番目の位置" を指定して choice[1]を選択できるようにするロジックを追加します。ユーザーの発話は、次の順序で認識されます。
-
findChoices()を使用して名前を指定します。 - 1 の基づく序数位置。
- 1 の基準インデックス位置。
const { recognizeChoices } = require('botbuilder-choices');
const choices = ['red', 'green', 'blue'];
const utterance = context.activity.text;
const results = recognizeChoices(utterance, choices);
if (results.length == 1) {
await context.sendActivity(`I like ${results[0].resolution.value} too!`);
} else if (results.length > 1) {
const ambiguous = results.map((r) => r.resolution.value);
await context.sendActivity(ChoiceFactory.forChannel(context, ambiguous, `Which one?`));
} else {
await context.sendActivity(ChoiceFactory.forChannel(context, choices, `I didn't get that... Which color?`));
}
defaultTokenizer(string, string)
スペースと句読点を区切る単純なトークナイザー。
function defaultTokenizer(text: string, _locale?: string): Token[]
パラメーター
- text
-
string
入力テキスト。
- _locale
-
string
省略可能。入力テキストのロケールを識別します。
戻り値
Token[]
トークンの一覧。
注釈
行われる唯一の正規化は、トークンを小文字にすることです。 開発者は、このトークナイザーを独自の関数でラップして、ステミングなどの追加の正規化
const { recognizeChoices, defaultTokenizer } = require('botbuilder-choices');
const stemmer = require('stemmer');
function customTokenizer(text, locale) {
const tokens = defaultTokenizer(text, locale);
tokens.forEach((t) => {
t.normalized = stemmer(t.normalized);
});
return tokens;
}
const choices = ['red', 'green', 'blue'];
const utterance = context.activity.text;
const results = recognizeChoices(utterance, choices, { tokenizer: customTokenizer });
getActiveDialogContext(DialogContext)
DC スタックを再帰的にウォークアップして、アクティブな DC を見つけます。
function getActiveDialogContext(dialogContext: DialogContext): DialogContext
パラメーター
- dialogContext
- DialogContext
(xref:botbuilder-dialogs。DialogContext) ユーザーとの会話の現在のターン。
戻り値
Active DialogContext。
internalRun(TurnContext, string, DialogContext, DialogStateManagerConfiguration)
function internalRun(context: TurnContext, dialogId: string, dialogContext: DialogContext, dialogStateManagerConfiguration?: DialogStateManagerConfiguration): Promise<DialogTurnResult>
パラメーター
- context
-
TurnContext
ターンの TurnContext。
- dialogId
-
string
ダイアログ ID。
- dialogContext
- DialogContext
会話の現在のターンの DialogContext。
- dialogStateManagerConfiguration
- DialogStateManagerConfiguration
ダイアログ状態マネージャーの構成。
戻り値
Promise<DialogTurnResult>
ダイアログ ターンの結果に解決する Promise。
isFromParentToSkill(TurnContext)
スキルがスキルの親として機能しているかどうかを判断します。
function isFromParentToSkill(context: TurnContext): boolean
パラメーター
- context
-
TurnContext
(xref:botbuilder-core。ユーザーとの会話の現在のターンの TurnContext) オブジェクト。
戻り値
boolean
スキルがスキルの親として機能しているかどうかを表すブール値。
runDialog(Dialog, TurnContext, StatePropertyAccessor<DialogState>)
特定のコンテキストとアクセサーからダイアログを実行します。
function runDialog(dialog: Dialog, context: TurnContext, accessor: StatePropertyAccessor<DialogState>): Promise<void>
パラメーター
- context
-
TurnContext
(xref:botbuilder-core。ユーザーとの会話の現在のターンの TurnContext) オブジェクト。
- accessor
-
StatePropertyAccessor<DialogState>
BotState オブジェクトで作成された状態プロパティにアクセスするための定義されたメソッド。
戻り値
Promise<void>
shouldSendEndOfConversationToParent(TurnContext, DialogTurnResult)
親に EoC を送信する必要があるかどうかを判断するヘルパー。
function shouldSendEndOfConversationToParent(context: TurnContext, turnResult: DialogTurnResult): boolean
パラメーター
- context
-
TurnContext
ターンの TurnContext。
- turnResult
- DialogTurnResult
ダイアログ ターンの結果。
戻り値
boolean
EoC を送信する必要がある場合は True、それ以外の場合は false。
isComponentMemoryScopes(unknown)
function isComponentMemoryScopes(component: unknown): boolean
パラメーター
- component
-
unknown
コンポーネントの登録。
戻り値
boolean
型チェックの結果。
isComponentPathResolvers(unknown)
function isComponentPathResolvers(component: unknown): boolean
パラメーター
- component
-
unknown
コンポーネントの登録。
戻り値
boolean
型チェックの結果。
createConnectorClient(TurnContext, string, ClaimsIdentity, string)
function createConnectorClient(context: TurnContext, serviceUrl: string, claimsIdentity: ClaimsIdentity, audience: string): Promise<ConnectorClient>
パラメーター
- context
-
TurnContext
- serviceUrl
-
string
- claimsIdentity
-
ClaimsIdentity
- audience
-
string
戻り値
Promise<ConnectorClient>
exchangeToken(TurnContext, OAuthPromptSettings, TokenExchangeRequest)
function exchangeToken(context: TurnContext, settings: OAuthPromptSettings, tokenExchangeRequest: TokenExchangeRequest): Promise<TokenResponse>
パラメーター
- context
-
TurnContext
- settings
- OAuthPromptSettings
- tokenExchangeRequest
-
TokenExchangeRequest
戻り値
Promise<TokenResponse>
getSignInResource(TurnContext, OAuthPromptSettings)
function getSignInResource(context: TurnContext, settings: OAuthPromptSettings): Promise<SignInUrlResponse>
パラメーター
- context
-
TurnContext
- settings
- OAuthPromptSettings
戻り値
Promise<SignInUrlResponse>
getUserToken(TurnContext, OAuthPromptSettings, string)
function getUserToken(context: TurnContext, settings: OAuthPromptSettings, magicCode: string): Promise<TokenResponse>
パラメーター
- context
-
TurnContext
- settings
- OAuthPromptSettings
- magicCode
-
string
戻り値
Promise<TokenResponse>
signOutUser(TurnContext, OAuthPromptSettings)
function signOutUser(context: TurnContext, settings: OAuthPromptSettings): Promise<void>
パラメーター
- context
-
TurnContext
- settings
- OAuthPromptSettings
戻り値
Promise<void>