chore: fix message id (#5943)

This commit is contained in:
Nathan.fooo 2024-08-12 22:24:06 +08:00 committed by GitHub
parent d3d9ab2fb0
commit 6e26dc128c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 4 deletions

View File

@ -88,7 +88,13 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
Int64? beforeMessageId;
final oldestMessage = _getOlderstMessage();
if (oldestMessage != null) {
beforeMessageId = Int64.parseInt(oldestMessage.id);
try {
beforeMessageId = Int64.parseInt(oldestMessage.id);
} catch (e) {
Log.error(
"Failed to parse message id: $e, messaeg_id: ${oldestMessage.id}",
);
}
}
_loadPrevMessage(beforeMessageId);
emit(
@ -439,7 +445,9 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
QuestionStream stream,
Map<String, dynamic>? sentMetadata,
) {
questionStreamMessageId = nanoid();
final now = DateTime.now();
final timestamp = now.millisecondsSinceEpoch;
questionStreamMessageId = timestamp.toString();
final Map<String, dynamic> metadata = {};
// if (sentMetadata != null) {

View File

@ -15,7 +15,7 @@ class ChatUserMessageBloc
),
) {
on<ChatUserMessageEvent>(
(event, emit) async {
(event, emit) {
event.when(
initial: () {
if (state.stream != null) {

View File

@ -337,7 +337,7 @@ impl FolderManager {
pub async fn get_workspace_pb(&self) -> FlowyResult<WorkspacePB> {
let workspace_id = self.user.workspace_id()?;
let guard = self.mutex_folder.read();
let guard = self.mutex_folder.write();
let folder = guard
.as_ref()
.ok_or(FlowyError::internal().with_context("folder is not initialized"))?;