Bot Framework Composer移交请求报错:Dialog.onComputeId()未实现
Bot Framework Composer启动报错:Dialog.onComputeId(): not implemented.
在Bot Framework Composer中创建空白机器人,仅在「Unknown intent」触发器中添加「Send a handoff request」操作后,点击「Start bot」时触发以下错误:
Error: Dialog.onComputeId(): not implemented.
完整错误日志
Error occurred building the bot Error: Dialog.onComputeId(): not implemented. at SendHandoffActivity.onComputeId (C:\Users\User\Handoff\Handoff\node_modules\botbuilder-dialogs\lib\dialog.js:336:15) at SendHandoffActivity.get id [as id] (C:\Users\User\Handoff\Handoff\node_modules\botbuilder-dialogs\lib\dialog.js:133:29) at C:\Users\User\Handoff\Handoff\node_modules\botbuilder-dialogs-adaptive\lib\actions\actionScope.js:276:57 at Array.map (<anonymous>) at ActionScope.onComputeId (C:\Users\User\Handoff\Handoff\node_modules\botbuilder-dialogs-adaptive\lib\actions\actionScope.js:276:34) at ActionScope.get id [as id] (C:\Users\User\Handoff\Handoff\node_modules\botbuilder-dialogs\lib\dialog.js:133:29) at DialogSet.add (C:\Users\User\Handoff\Handoff\node_modules\botbuilder-dialogs\lib\dialogSet.js:126:71) at C:\Users\User\Handoff\Handoff\node_modules\botbuilder-dialogs-adaptive\lib\adaptiveDialog.js:140:75 at Array.forEach (<anonymous>) at AdaptiveDialog.ensureDependenciesInstalled (C:\Users\User\Handoff\Handoff\node_modules\botbuilder-dialogs-adaptive\lib\adaptiveDialog.js:140:43)
机器人完整代码
{ "$kind": "Microsoft.AdaptiveDialog", "$designer": { "name": "Handoff", "description": "", "id": "A79tBe" }, "autoEndDialog": true, "defaultResultProperty": "dialog.result", "triggers": [ { "$kind": "Microsoft.OnConversationUpdateActivity", "$designer": { "id": "376720" }, "actions": [ { "$kind": "Microsoft.Foreach", "$designer": { "id": "518944", "name": "Loop: for each item" }, "itemsProperty": "turn.Activity.membersAdded", "actions": [ { "$kind": "Microsoft.IfCondition", "$designer": { "id": "641773", "name": "Branch: if/else" }, "condition": "=string(dialog.foreach.value.id) != string(turn.Activity.Recipient.id)", "actions": [ { "$kind": "Microsoft.SendActivity", "$designer": { "id": "859266", "name": "Send a response" }, "activity": "${SendActivity_Greeting()}" } ] } ] } ] }, { "$kind": "Microsoft.OnUnknownIntent", "$designer": { "id": "mb2n1u" }, "actions": [ { "$kind": "Microsoft.SendHandoffActivity", "$designer": { "id": "74xAHm" }, "context": { "context": "c" }, "transcript": { "transcript": "t" } } ] } ], "generator": "Handoff.lg", "id": "Handoff", "recognizer": "Handoff.lu.qna" }
解决方案
- 统一依赖版本:检查
package.json中botbuilder-dialogs、botbuilder-dialogs-adaptive等核心包的版本,确保所有Bot Framework相关包版本一致,避免版本不兼容导致的抽象方法未实现问题,建议升级到官方稳定兼容版本。 - 修正组件配置:
SendHandoffActivity的context和transcript字段需传入合法的表达式而非固定字符串,示例中的"context": "c"不符合要求,可修改为如"context": "=turn.context"、"transcript": "=turn.transcript"这类符合Bot Framework表达式语法的值。 - 重置项目依赖:删除项目根目录下的
node_modules文件夹和package-lock.json文件,执行npm install重新安装所有依赖,清除可能存在的缓存异常。 - 匹配Composer版本:确保使用的Bot Framework Composer版本与项目依赖包版本兼容,优先选择官方推荐的稳定版Composer。
内容的提问来源于stack exchange,提问作者xaleel
相关产品推荐
相关产品推荐

