Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: local and remote returning different data (#7843)

Richard Shiue2b03c34df1e4
diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_bloc.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_bloc.dart
index 602b46f97a..d0f1f1ab23 100644
--- a/frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_bloc.dart
@@ -72,6 +72,7 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
final request = ViewIdPB(value: chatId);
unawaited(FolderEventCloseView(request).send());
selectedSourcesNotifier.dispose();
+ chatController.dispose();
return super.close();
}
@@ -576,6 +577,7 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
if (temporaryMessageIDMap.containsKey(messageId)) {
messageId = temporaryMessageIDMap[messageId]!;
}
+ final metadata = message.metadata == 'null' ? '[]' : message.metadata;
return TextMessage(
author: User(id: message.authorId),
@@ -583,7 +585,7 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
text: message.content,
createdAt: message.createdAt.toDateTime(),
metadata: {
- messageRefSourceJsonStringKey: message.metadata,
+ messageRefSourceJsonStringKey: metadata,
},
);
}