feat(docs): improve RongCloud IM × Dify integration guide with better wording and image layout

This commit is contained in:
wangqijia
2025-06-17 14:41:54 +08:00
parent b1f36d3275
commit 365a29b819
2 changed files with 25 additions and 24 deletions

View File

@@ -1,24 +1,21 @@
Here is the full English translation of your document titled **"AI Bot Development: Integration of RongCloud IM with Dify A Practical Guide"**:
---
# AI Bot Development: RongCloud IM and Dify Integration Guide
title: Building AI Bots with RongCloud Instant Messaging and Dify
---
> Author: wangqijiaRongCloud Developer Team
> Date: June 2025
---
## 1. Overview
[RongCloud IM PaaS](https://www.rongcloud.cn/) achieves seamless deep integration with the Dify platform, establishing an end-to-end conversational channel between end users and large language models (LLMs). It supports streaming responses and multi-turn context, widely applied in scenarios such as intelligent Q&A, content creation, and emotional companionship, helping enterprises build efficient and intelligent user interaction experiences.
RongCloud IM PaaS provides comprehensive [AI bot management]((https://docs.rongcloud.cn/platform-chat-api/bot/overview)) capabilities, supporting rich event callbacks triggered by specific bots. This enables developers to flexibly handle various business scenarios, such as:
The platform provides comprehensive [AI bot](https://docs.rongcloud.cn/platform-chat-api/bot/overview) management capabilities, supporting richer event callbacks triggered by specified bots, assisting developers in flexibly handling various business scenarios, such as:
* Initiating one-on-one conversations with bots
* Using @mention to trigger contextual responses
* Triggering contextual responses by mentioning (@) bots
In addition, the platform comes with built-in integration capabilities for AI platforms, allowing bot messages to be automatically forwarded to connected LLM platforms (e.g., Dify). This eliminates the need for an intermediate service layer, greatly improving the stability of message flow, reducing integration costs, and accelerating development delivery.
Additionally, the platform has built-in AI platform integration capabilities, allowing bot messages to be automatically forwarded to connected large model platforms (such as Dify), eliminating the need for intermediate processing services, effectively improving link stability, reducing integration costs, and accelerating development and delivery.
This guide will walk you through integrating AI bots into the RongCloud IM platform and connecting them with Dify LLM services.
This guide will explain how to integrate AI bots based on the RongCloud IM platform and connect to large model services via the Dify platform.
---
@@ -30,20 +27,20 @@ This guide will walk you through integrating AI bots into the RongCloud IM platf
1. **App Server**
* Manages bots, processes webhook callbacks, and receives bot messages.
* Manages bots, processes webhook callbacks, and receives bot messages.
2. **User Client**
* Sends user messages and receives bot responses.
* Sends user messages and receives bot responses.
3. **IM Server**
* **Message Forwarding**: Forwards messages to Dify based on callback types (e.g., `dify_chat`, `dify_completion`) and supports both streaming and non-streaming modes.
* **Response Handling and Session Management**:
* **Message Forwarding**: Forwards messages to Dify based on callback types (e.g., `dify_chat`, `dify_completion`) and supports both streaming and non-streaming modes.
* **Response Handling and Session Management**:
* *Streaming*: Pushes incremental content from Dify in real time.
* *Non-streaming*: Sends the complete message after receiving the full response.
* *Session Context*: Stores `conversation_id` from the first interaction (valid for 24 hours). Subsequent messages use this ID to maintain multi-turn context.
* *Streaming*: Pushes incremental content from Dify in real time.
* *Non-streaming*: Sends the complete message after receiving the full response.
* *Session Context*: Stores `conversation_id` from the first interaction (valid for 24 hours). Subsequent messages use this ID to maintain multi-turn context.
4. **Dify**
@@ -171,8 +168,10 @@ curl -X POST "https://api.rong-api.com/message/private/publish.json" \
> Demo screenshots from Sealtalk APP:
<img src="https://docs.rongcloud.cn/platform-chat-api/assets/bot/send-bot-message.png" alt="Demo" width="50%" />
<img src="https://docs.rongcloud.cn/platform-chat-api/assets/bot/send-bot-message2.png" alt="Demo" width="50%" />
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<img src="https://docs.rongcloud.cn/platform-chat-api/assets/bot/send-bot-message.png" alt="图示1" style={{ width: '70%' }} />
<img src="https://docs.rongcloud.cn/platform-chat-api/assets/bot/send-bot-message2.png" alt="图示2" style={{ width: '70%' }} />
</div>
---

View File

@@ -7,8 +7,9 @@ title: AI 机器人开发:融云 IM 与 Dify 集成实战
## 1. 概述
[融云 IM PaaS](https://www.rongcloud.cn/) 通过与 Dify 平台的深度无缝集成,打通了 C 端用户与大语言模型LLM之间的端到端对话链路支持流式响应和多轮上下文广泛应用于智能问答、内容创作、情感陪聊等场景助力企业构建高效、智能的用户交互体验。
融云 IM PaaS 提供完善的 [AI 机器人](https://docs.rongcloud.cn/platform-chat-api/bot/overview)管理能力,支持基于指定机器人触发更丰富的事件回调,帮助开发者灵活处理各类业务场景,例如:
平台提供完善的 [AI 机器人](https://docs.rongcloud.cn/platform-chat-api/bot/overview)管理能力,支持基于指定机器人触发更丰富的事件回调,帮助开发者灵活处理各类业务场景,例如:
* 与机器人发起单聊对话
* @ 机器人触发上下文响应
@@ -163,9 +164,10 @@ curl -X POST "https://api.rong-api.com/message/private/publish.json" \
```
> 以下是演示效果,截图来自融云 Sealtalk APP Demo
<img src="https://docs.rongcloud.cn/platform-chat-api/assets/bot/send-bot-message.png" alt="图示" width="50%" />
<img src="https://docs.rongcloud.cn/platform-chat-api/assets/bot/send-bot-message2.png" alt="图示" width="50%" />
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<img src="https://docs.rongcloud.cn/platform-chat-api/assets/bot/send-bot-message.png" alt="图示1" style={{ width: '70%' }} />
<img src="https://docs.rongcloud.cn/platform-chat-api/assets/bot/send-bot-message2.png" alt="图示2" style={{ width: '70%' }} />
</div>
---
@@ -173,7 +175,7 @@ curl -X POST "https://api.rong-api.com/message/private/publish.json" \
使用同一用户持续向同一机器人发送消息,验证对话上下文是否正确延续。融云将自动维持与 Dify 的上下文会话,实现连续对话体验。
<img src="https://docs.rongcloud.cn/platform-chat-api/assets/bot/send-bot-message3.png" alt="图示" width="50%" />
<img src="https://docs.rongcloud.cn/platform-chat-api/assets/bot/send-bot-message3.png" alt="图示" width="50%" />
> Dify 日志显示共记录了 4 条消息,验证了多轮对话过程中上下文得以正确延续,说明聊天会话在同一上下文中持续进行。