如何将收集的值传递给重新计划的操作?
How can I pass collected values to a replanned action?
当用户说 "read john 3:100" 时,我有一个匹配 book:john
、chapter:3
、verse:100
的 ReadBibleVerse 动作。端点将 return 一个 404,因为没有第 100 节。
我希望该操作捕获错误并 replan
到 "read chapter" 请求,并传递 book:john
和 chapter:3
。
我有什么...
action (ReadBibleVerse) {
collect {
input (book) {…}
input (chapter) { type (ChapterNum) … }
input (verse) {…}
}
output (Scripture) {
throws {
unknown-error {
on-catch {
replan {
dialog ("Unknown verse, trying the chapter.")
intent {
goal: Scripture
route: ReadBibleChapter
}}}}}}}
…我得到的是"Unknown verse, trying the chapter. I need a book to continue."
我很明显遇到了错误,我相信,"replanned" 到 ReadBibleChapter,但我也得到了 "I need a book to continue.",因为我需要明确地传递 book
和chapter
?
我找到了 intent.value,这似乎解决了我的问题,但我似乎找不到正确的格式:
value: ChapterNum
value: ChapterNum (chapter)
value: [namespace].ChapterNum { $expr(chapter) }
- 更各种废话
- …
这应该有效 value {$expr(chapter)}
当用户说 "read john 3:100" 时,我有一个匹配 book:john
、chapter:3
、verse:100
的 ReadBibleVerse 动作。端点将 return 一个 404,因为没有第 100 节。
我希望该操作捕获错误并 replan
到 "read chapter" 请求,并传递 book:john
和 chapter:3
。
我有什么...
action (ReadBibleVerse) {
collect {
input (book) {…}
input (chapter) { type (ChapterNum) … }
input (verse) {…}
}
output (Scripture) {
throws {
unknown-error {
on-catch {
replan {
dialog ("Unknown verse, trying the chapter.")
intent {
goal: Scripture
route: ReadBibleChapter
}}}}}}}
…我得到的是"Unknown verse, trying the chapter. I need a book to continue."
我很明显遇到了错误,我相信,"replanned" 到 ReadBibleChapter,但我也得到了 "I need a book to continue.",因为我需要明确地传递 book
和chapter
?
我找到了 intent.value,这似乎解决了我的问题,但我似乎找不到正确的格式:
value: ChapterNum
value: ChapterNum (chapter)
value: [namespace].ChapterNum { $expr(chapter) }
- 更各种废话
- …
这应该有效 value {$expr(chapter)}