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

按照Stream Chat Angular文档添加自定义消息操作未生效的问题求助

Stream Chat Angular文档添加自定义消息操作未生效的问题求助

我按照Stream Chat Angular的官方文档步骤来添加自定义消息操作,但试了好几次都没生效,有没有大佬能帮我看看哪里出问题了?

我写的代码如下:

import {
  StreamMessage,
  CustomMessageActionItem,
  DefaultStreamChatGenerics
} from "stream-chat-angular";

customActions: CustomMessageActionItem<DefaultStreamChatGenerics>[] = [
    {
      actionName: 'custom-action',
      actionLabelOrTranslationKey: 'Custom Action',
      actionHandler: (message: StreamMessage<DefaultStreamChatGenerics>) => {
        console.log('Custom action executed for:', message);
      },
      isVisible: (enabledActions: string[]) => {
        return enabledActions.includes('custom-action');
      },
    }
  ];

ngAfterViewInit(): void {
  this.messageActionsService.customActions$.next(this.customActions);
}

我已经在ngAfterViewInit里通过messageActionsService把自定义操作推送到customActions$流里了,但消息的操作菜单里就是看不到我加的这个“Custom Action”,也不会触发对应的控制台日志。有没有人遇到过类似的问题,或者能帮我排查下哪里写错了?

备注:内容来源于stack exchange,提问作者Calvin Seng

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.14 13:28:07