You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Rasa自定义action_redirect_to_scholarship未注册错误求助

解决Rasa中「No registered action found for name 'action_redirect_to_scholarship'」错误的方案

核心排查步骤

1. 确认自定义Action类的命名与注册

  • 检查actions/目录下的Python文件(比如actions/actions.py),确保类的name方法返回值与报错中的action名称完全一致:
    from rasa_sdk import Action, Tracker
    from rasa_sdk.executor import CollectingDispatcher
    
    class ActionRedirectToScholarship(Action):
        def name(self) -> str:
            return "action_redirect_to_scholarship"  # 必须和domain、触发逻辑里的名称完全匹配
    
        def run(self, dispatcher: CollectingDispatcher,
                tracker: Tracker,
                domain: dict) -> list:
            # 编写跳转逻辑,比如发送带链接的提示
            dispatcher.utter_message(text=f"奖学金详情请查看:[点击进入](https://your-school-scholarship-url.com)")
            return []
    
  • 确保actions/目录下存在空的__init__.py文件,让Rasa能识别该模块。

2. 验证domain.yml的配置

  • 在domain.yml的actions列表里必须显式添加这个action,不能有拼写或大小写错误:
    actions:
      - action_redirect_to_scholarship
      # 其他已定义的action...
    

3. 检查Action Server的运行状态

  • 本地开发时,要单独启动Action Server,且指定正确的actions模块:
    rasa run actions --actions actions
    
  • 确保Action Server和Rasa Core服务同时运行,端口默认5055,若有修改需和endpoints.yml配置一致。

4. 核对endpoints.yml的Action配置

  • 如果配置了自定义Action Server地址,确认地址正确且服务可访问:
    action_endpoint:
      url: "http://localhost:5055/webhook"
    
  • 本地开发无特殊需求时,保持默认配置即可,但必须保证Action Server在运行。

5. 清理缓存并重启服务

  • 清理旧模型缓存,重新训练:
    rasa train
    
  • 重启Rasa Core和Action Server,避免旧缓存导致的识别异常。

额外排查点

  • 检查stories.yml/rules.yml中触发该action的逻辑是否正确,确保意图与action的关联无误:
    stories:
      - story: 查询奖学金触发跳转
        steps:
          - intent: ask_scholarship
          - action: action_redirect_to_scholarship
    
  • 确认rasa和rasa-sdk版本一致,版本不兼容会导致action注册失败:
    pip list | grep rasa
    
    比如两者都保持3.6.x系列版本。

内容的提问来源于stack exchange,提问作者Radical Rosh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 17:32:36