自检
- 这仅用于提交错误报告,如果您想提问,请访问 Discussions 。
- 我已在 search for existing issues 中搜索了现有问题,包括已关闭的问题。
- 我确认我使用英语提交此报告(我已阅读并同意 Language Policy )。
- 请不要修改此模板 :) 并填写所有必需的字段。
Dify版本
0.6.10
云或自托管
自托管(源代码)
重现步骤
嵌入iframe并开始对话。TypeError: Cannot destructure property 'onGetConvesationMessages' of '(intermediate value)(intermediate value)(intermediate value)' as it is undefined.
✔️ 预期行为
正常工作的嵌入式聊天
❌ 实际行为
在app/components/base/chat/chat/hooks.ts (200:7)处的@ onGetConvesationMessages错误
1条答案
按热度按时间7fhtutme1#
您遇到的错误表明
onGetConvesationMessages
属性没有正确传递给useChat
钩子中的handleSend
函数。要解决此问题,请确保在调用handleSend
函数时正确定义并传递onGetConvesationMessages
函数。以下是
handleSend
函数中相关部分的代码片段:const handleSend = useCallback(async (
url: string,
data: any,
{
onGetConvesationMessages,
onGetSuggestedQuestions,
onConversationComplete,
isPublicAPI,
}: SendCallback,
) => {
// ... rest of the code
handleSend(url, data, {
onGetConvesationMessages: yourOnGetConvesationMessagesFunction,
onGetSuggestedQuestions: yourOnGetSuggestedQuestionsFunction,
onConversationComplete: yourOnConversationCompleteFunction,
isPublicAPI: true, // or false, depending on your use case
});
const handleSend = useCallback(async (
url: string,
data: any,
{
onGetConvesationMessages = async () => {}, // Default implementation
onGetSuggestedQuestions,
onConversationComplete,
isPublicAPI,
}: SendCallback,
) => {
// ... rest of the code