mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: fix message id (#5943)
This commit is contained in:
parent
d3d9ab2fb0
commit
6e26dc128c
@ -88,7 +88,13 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
|
|||||||
Int64? beforeMessageId;
|
Int64? beforeMessageId;
|
||||||
final oldestMessage = _getOlderstMessage();
|
final oldestMessage = _getOlderstMessage();
|
||||||
if (oldestMessage != null) {
|
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);
|
_loadPrevMessage(beforeMessageId);
|
||||||
emit(
|
emit(
|
||||||
@ -439,7 +445,9 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
|
|||||||
QuestionStream stream,
|
QuestionStream stream,
|
||||||
Map<String, dynamic>? sentMetadata,
|
Map<String, dynamic>? sentMetadata,
|
||||||
) {
|
) {
|
||||||
questionStreamMessageId = nanoid();
|
final now = DateTime.now();
|
||||||
|
final timestamp = now.millisecondsSinceEpoch;
|
||||||
|
questionStreamMessageId = timestamp.toString();
|
||||||
final Map<String, dynamic> metadata = {};
|
final Map<String, dynamic> metadata = {};
|
||||||
|
|
||||||
// if (sentMetadata != null) {
|
// if (sentMetadata != null) {
|
||||||
|
@ -15,7 +15,7 @@ class ChatUserMessageBloc
|
|||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
on<ChatUserMessageEvent>(
|
on<ChatUserMessageEvent>(
|
||||||
(event, emit) async {
|
(event, emit) {
|
||||||
event.when(
|
event.when(
|
||||||
initial: () {
|
initial: () {
|
||||||
if (state.stream != null) {
|
if (state.stream != null) {
|
||||||
|
@ -337,7 +337,7 @@ impl FolderManager {
|
|||||||
|
|
||||||
pub async fn get_workspace_pb(&self) -> FlowyResult<WorkspacePB> {
|
pub async fn get_workspace_pb(&self) -> FlowyResult<WorkspacePB> {
|
||||||
let workspace_id = self.user.workspace_id()?;
|
let workspace_id = self.user.workspace_id()?;
|
||||||
let guard = self.mutex_folder.read();
|
let guard = self.mutex_folder.write();
|
||||||
let folder = guard
|
let folder = guard
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or(FlowyError::internal().with_context("folder is not initialized"))?;
|
.ok_or(FlowyError::internal().with_context("folder is not initialized"))?;
|
||||||
|
Loading…
Reference in New Issue
Block a user