复制 Markdown查看 Markdown#欢迎语 如果您想在用户进入对话页面时,发送一条欢迎消息,或者在用户隔一段时间后重新进入小程序时,发送一条问候消息,可以在 createAgent 函数中添加以下逻辑。 想了解更多详细信息,请访问定制欢迎语与问候语。 const createAgent = () => { const { onChatStart, createMessage, onChatResume } = agent; // 创建一条初始的欢迎信息 onChatStart(async (result) => { const hello = createMessage({ role: 'assistant', }); hello.bubble.setText('你好'); // 此处定义您想写的问候的多语言 result.messages.push(hello); await hello.persist('createText'); // 将这个消息气泡持久化下来 }); return agent; };上一页t-agent-ui-ray下一页定制外观