mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2026-07-25 21:46:08 -04:00
dify官方网站的在线案例:https://cloud.dify.ai/app,chat-messages接口是有传parent_message_id参数,但是webapp-conversation仓库的案例没有追加parent_message_id参数,导致多轮会话上下文丢失 #82
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fengyun2 on GitHub (May 22, 2025).
dify官方网站的在线案例:https://cloud.dify.ai/app,
/v1/chat-messages接口是有传parent_message_id参数,但是webapp-conversation仓库的案例没有追加parent_message_id参数,导致多轮会话上下文丢失。
日志查询接口:
https://cloud.dify.ai/console/api/apps/APP_ID/chat-messages?conversation_id=CONVERSATION_ID&limit=10通过nextjs接口调用方案
实际效果:
接口:
https://api.dify.ai/v1/chat-messages第一轮请求参数:
{'inputs': {}, 'query': '你好', 'response_mode': 'blocking', 'user': 'user_周星星007'}第二轮请求参数:
{'inputs': {}, 'query': '今天天气怎么样', 'response_mode': 'blocking', 'user': 'user_周星星007', 'conversation_id': '9bec66d4-0117-4048-b1a9-6c94f5c82a5d', 'parent_message_id': '379d3964-4c62-48ec-bc60-102c75b61adb'}第三轮请求参数:
{'inputs': {}, 'query': '今天适宜露营吗', 'response_mode': 'blocking', 'user': 'user_周星星007', 'conversation_id': '9bec66d4-0117-4048-b1a9-6c94f5c82a5d', 'parent_message_id': 'c295269d-d7fb-415d-a17c-8c5f8bcd14ec'}三轮日志结果如下:
通过官网内置网址运行方案(https://cloud.dify.ai/app)
期望效果:
接口:
https://udify.app/api/chat-messages第一轮请求参数:
第二轮请求参数:
第三轮请求参数:
{ "response_mode": "streaming", "conversation_id": "3805bb3e-a5b4-4be0-93a0-65b3f748a024", "files": [], "query": "今天适宜露营吗", "inputs": {}, "parent_message_id": "ebd902ee-c18f-4af1-961e-5636f39ff100" }三轮日志结果如下:
期望效果
通过nextjs接口调用方案时,dify后端接口也能接收
parent_message_id参数,且在 [发送对话消息]:/v1/chat-messages接口、/console/api/apps/APP_ID/chat-messages接口以及 [获取会话历史消息]:/v1/messages)接口也能返回正确的parent_message_id。(非00000000-0000-0000-0000-000000000000`或null)。