For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt, and this page is available as Markdown at /apps-plugin/docs/js-api/open/business/sendFollowUpMessage.md.

sendFollowUpMessage

以用户身份发送后续消息,触发新一轮对话、API 调用或引导模型响应。

扫码预览

扫码预览 sendFollowUpMessage

支持版本

前端库版本不低于 0.0.37。

支持平台

平台支持情况
Android支持
iOS支持
PC不支持
HarmonyOS不支持

支持场景

场景支持情况
页面支持
卡片支持

接入准备

前置条件

  • Android:在卡片或应用插件页面中调用
  • iOS:在卡片或应用插件页面中调用,且当前上下文已关联有效会话

使用说明

可在卡片或应用插件页面中调用,不支持在 app.ts 代码中调用。客户端会根据调用上下文关联会话: 卡片使用其所在会话,从卡片打开的页面沿用该会话,其他页面使用主会话。

  • Promise 解析表示发送请求已提交,不表示消息已成功送达;实际发送失败不会通过该 Promise 返回。

调用方式

异步 API

sendFollowUpMessage(params: SendFollowUpMessageParams): Promise<object>

入参

名称类型必填默认值约束说明
contentContent[]是-至少包含一条 text 类型且 text 不为空白的消息;第一条符合条件的消息作为本轮用户输入。消息内容。

content[].type = "text"

名称类型必填默认值约束说明
content[].type"text"是--文本消息。
content[].textstring是--后续消息的文本内容。

content[].type = "api/call"

名称类型必填默认值约束说明
content[].type"api/call"是--API 调用消息。
content[].dataobject是--要调用的 API 及其参数。
content[].data.argumentsobject是--API 调用参数。
content[].data.namestring是--API 名称。

content[].type = "responseHint"

名称类型必填默认值约束说明
content[].type"responseHint"是--模型响应提示。
content[].dataobject是--用户动作和模型响应建议。
content[].data.responseGuidancestring否--建议模型如何响应。
content[].data.userActionstring否--用户做了什么。

调用示例

import { sendFollowUpMessage } from '@doubao-dev/framework/api';

await sendFollowUpMessage({
  content: [
    { type: 'text', text: '选择拿铁' },
    {
      type: 'api/call',
      data: {
        name: 'selectDrink',
        arguments: { drinkId: 'latte_001' }
      }
    },
    {
      type: 'responseHint',
      data: {
        userAction: '用户选择了拿铁',
        responseGuidance: '确认已选择拿铁,并询问是否需要调整杯型'
      }
    }
  ]
});

成功返回

无返回字段。