mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-12-28 05:34:41 +00:00
fix: try to fix message regeneration being appended instead of replaced (#7084)
Some checks are pending
Commit messages lint / commitlint (push) Waiting to run
Docker-CI / build-app (push) Waiting to run
Flutter-CI / prepare-linux (development-linux-x86_64, ubuntu-latest, x86_64-unknown-linux-gnu) (push) Waiting to run
Flutter-CI / prepare-windows (development-windows-x86, windows-latest, x86_64-pc-windows-msvc) (push) Waiting to run
Flutter-CI / prepare-macos (development-mac-x86_64, macos-latest, x86_64-apple-darwin) (push) Waiting to run
Flutter-CI / unit_test (development-linux-x86_64, ubuntu-latest, x86_64-unknown-linux-gnu) (push) Blocked by required conditions
Flutter-CI / cloud_integration_test (development-linux-x86_64, ubuntu-latest, x86_64-unknown-linux-gnu) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 1) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 2) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 3) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 4) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 5) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 6) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 7) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 8) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 9) (push) Blocked by required conditions
iOS CI / build-self-hosted (push) Waiting to run
iOS CI / integration-tests (push) Waiting to run
Rust-CI / ubuntu-job (push) Waiting to run
Rust code coverage / tests (push) Waiting to run
Some checks are pending
Commit messages lint / commitlint (push) Waiting to run
Docker-CI / build-app (push) Waiting to run
Flutter-CI / prepare-linux (development-linux-x86_64, ubuntu-latest, x86_64-unknown-linux-gnu) (push) Waiting to run
Flutter-CI / prepare-windows (development-windows-x86, windows-latest, x86_64-pc-windows-msvc) (push) Waiting to run
Flutter-CI / prepare-macos (development-mac-x86_64, macos-latest, x86_64-apple-darwin) (push) Waiting to run
Flutter-CI / unit_test (development-linux-x86_64, ubuntu-latest, x86_64-unknown-linux-gnu) (push) Blocked by required conditions
Flutter-CI / cloud_integration_test (development-linux-x86_64, ubuntu-latest, x86_64-unknown-linux-gnu) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 1) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 2) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 3) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 4) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 5) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 6) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 7) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 8) (push) Blocked by required conditions
Flutter-CI / integration_test (ubuntu-latest, x86_64-unknown-linux-gnu, 9) (push) Blocked by required conditions
iOS CI / build-self-hosted (push) Waiting to run
iOS CI / integration-tests (push) Waiting to run
Rust-CI / ubuntu-job (push) Waiting to run
Rust code coverage / tests (push) Waiting to run
This commit is contained in:
parent
a521541cb7
commit
06d5bc734b
@ -272,15 +272,19 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
|
||||
|
||||
// 3 mean message response from AI
|
||||
if (pb.authorType == 3 && answerStreamMessageId.isNotEmpty) {
|
||||
temporaryMessageIDMap[pb.messageId.toString()] =
|
||||
answerStreamMessageId;
|
||||
temporaryMessageIDMap.putIfAbsent(
|
||||
pb.messageId.toString(),
|
||||
() => answerStreamMessageId,
|
||||
);
|
||||
answerStreamMessageId = '';
|
||||
}
|
||||
|
||||
// 1 mean message response from User
|
||||
if (pb.authorType == 1 && questionStreamMessageId.isNotEmpty) {
|
||||
temporaryMessageIDMap[pb.messageId.toString()] =
|
||||
questionStreamMessageId;
|
||||
temporaryMessageIDMap.putIfAbsent(
|
||||
pb.messageId.toString(),
|
||||
() => questionStreamMessageId,
|
||||
);
|
||||
questionStreamMessageId = '';
|
||||
}
|
||||
|
||||
@ -422,8 +426,9 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
|
||||
(question) {
|
||||
if (!isClosed) {
|
||||
final streamAnswer = _createAnswerStreamMessage(
|
||||
answerStream!,
|
||||
question.messageId,
|
||||
stream: answerStream!,
|
||||
questionMessageId: question.messageId,
|
||||
fakeQuestionMessageId: questionStreamMessage.id,
|
||||
);
|
||||
|
||||
lastSentMessage = question;
|
||||
@ -479,8 +484,8 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
|
||||
(success) {
|
||||
if (!isClosed) {
|
||||
final streamAnswer = _createAnswerStreamMessage(
|
||||
answerStream!,
|
||||
answerMessageId - 1,
|
||||
stream: answerStream!,
|
||||
questionMessageId: answerMessageId - 1,
|
||||
).copyWith(id: answerMessageIdString);
|
||||
|
||||
add(ChatEvent.receiveMessage(streamAnswer));
|
||||
@ -491,11 +496,14 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
|
||||
);
|
||||
}
|
||||
|
||||
Message _createAnswerStreamMessage(
|
||||
AnswerStream stream,
|
||||
Int64 questionMessageId,
|
||||
) {
|
||||
answerStreamMessageId = (questionMessageId + 1).toString();
|
||||
Message _createAnswerStreamMessage({
|
||||
required AnswerStream stream,
|
||||
required Int64 questionMessageId,
|
||||
String? fakeQuestionMessageId,
|
||||
}) {
|
||||
answerStreamMessageId = fakeQuestionMessageId == null
|
||||
? (questionMessageId + 1).toString()
|
||||
: "${fakeQuestionMessageId}_ans";
|
||||
|
||||
return TextMessage(
|
||||
id: answerStreamMessageId,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user