Application\<TInput, TOutput>
A DashaScript conversational application deployed to the Dasha platform.
Extends
EventEmitter<{dslLog: [string,string,string,Conversation<TInput,TOutput> |undefined];error: [Error];health: [boolean];reconnecting: [number];unableToReconnect: [Error]; }>
Type Parameters
• TInput extends Record<string, unknown>
conversation input data type
• TOutput extends Record<string, unknown>
conversation output data type
Properties
account
readonlyaccount:Account
A user Account that the application was deployed under.
applicationId
applicationId:
string
An internal application UID.
applicationName
applicationName:
string
Application name as seen in [.dashaapp].
[.dashaapp]: https://docs.dasha.ai/en-us/default/application/configuration/#application-name
axios
readonlyaxios:null|AxiosInstance
An instance of the axios HTTP client used for #httpRequest(),
or null if #httpRequest() has been disabled.
Initialized with the value of DeploymentOptions.axios
customerId
readonlycustomerId:string
An internal client UID.
groupId
readonlygroupId:string
An internal application group UID.
inputSchema?
optionalinputSchema:unknown
JSON Schema of DSL context input variables. Conversation context: https://docs.dasha.ai/en-us/default/dasha-script-language/conversation-context
log
readonlylog:Logger
outputSchema?
optionaloutputSchema:unknown
JSON Schema of DSL context output variables. Conversation context: https://docs.dasha.ai/en-us/default/dasha-script-language/conversation-context
queue
readonlyqueue:ConversationQueue<TInput,TOutput>
A ConversationQueue object for managing planned conversations.
Accessors
customTtsProvider
Get Signature
get customTtsProvider():
CustomTtsProvider
A CustomTtsProvider callback to use when the TtsProviderName | TTS provider
is set to "custom" in Conversation.audio.tts.
Assigning a handler opens the server-side TTS request stream lazily; the
stream is never opened if no handler is ever set. Handlers may be attached
after deploy() returns.
Returns
Set Signature
set customTtsProvider(
provider):void
Parameters
provider
Returns
void
Methods
createConversation()
createConversation(
input?):Conversation<TInput,TOutput>
Create a single Conversation.
Parameters
input?
TInput
conversation's input data; can also be set later with Conversation.input
Returns
Conversation<TInput, TOutput>
dispose()
dispose():
void
Close the connection with the application, freeing all local resources.
Returns
void
healthCheck()
healthCheck():
Promise<boolean>
Returns
Promise<boolean>
setExternal()
setExternal<
TArgs>(name,fn):void
Set an external call handler for this application.
The handler is called with all the call arguments passed as a dictionary,
as well as the current Conversation object. It can return a JSON-serializable
value, possibly wrapped in a promise, which then is treated as the call's return value.
As a special case, undefined gets converted to null.
Type Parameters
• TArgs extends Record<string, unknown>
Parameters
name
string
fn
(args, conv) => unknown
Returns
void
start()
start(
options?):Promise<void>
Start the deployed application, enabling it to receive incoming requests and run queued conversations.
Parameters
options?
concurrency
number
max number of conversations to run at once
Returns
Promise<void>
stop()
stop(
options?):Promise<void>
Stop the running application, disabling the creation of new conversations. Conversations that are already running are unaffected.
Parameters
options?
cancelationToken
checkPeriodInMs
number
waitUntilAllProcessed
boolean
Returns
Promise<void>
waitUntilCurrentProcessed()
waitUntilCurrentProcessed(
options?):Promise<boolean>
Parameters
options?
cancelationToken
checkPeriodInMs
number
Returns
Promise<boolean>