[PR #7777] [MERGED] refactor: save chat and chat message #8107

Closed
opened 2026-03-23 23:22:38 +00:00 by mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AppFlowy-IO/AppFlowy/pull/7777
Author: @appflowy
Created: 4/18/2025
Status: Merged
Merged: 4/18/2025
Merged by: @appflowy

Base: mainHead: prepare_auto_sync_chat


📝 Commits (4)

📊 Changes

35 files changed (+620 additions, -420 deletions)

View changed files

📝 frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_bloc.dart (+1 -1)
📝 frontend/rust-lib/Cargo.lock (+12 -12)
📝 frontend/rust-lib/Cargo.toml (+2 -2)
📝 frontend/rust-lib/event-integration-test/tests/chat/chat_message_test.rs (+1 -6)
📝 frontend/rust-lib/event-integration-test/tests/sql_test/chat_message_test.rs (+28 -15)
📝 frontend/rust-lib/flowy-ai-pub/src/cloud.rs (+4 -5)
📝 frontend/rust-lib/flowy-ai-pub/src/persistence/chat_message_sql.rs (+34 -2)
📝 frontend/rust-lib/flowy-ai-pub/src/persistence/chat_sql.rs (+32 -21)
📝 frontend/rust-lib/flowy-ai/src/ai_manager.rs (+5 -33)
📝 frontend/rust-lib/flowy-ai/src/chat.rs (+15 -33)
📝 frontend/rust-lib/flowy-ai/src/entities.rs (+2 -7)
📝 frontend/rust-lib/flowy-ai/src/event_handler.rs (+1 -32)
📝 frontend/rust-lib/flowy-ai/src/lib.rs (+1 -0)
📝 frontend/rust-lib/flowy-ai/src/local_ai/controller.rs (+54 -55)
📝 frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs (+17 -47)
frontend/rust-lib/flowy-ai/src/offline/mod.rs (+1 -0)
frontend/rust-lib/flowy-ai/src/offline/offline_message_sync.rs (+258 -0)
📝 frontend/rust-lib/flowy-ai/src/stream_message.rs (+1 -0)
📝 frontend/rust-lib/flowy-core/src/deps_resolve/cloud_service_impl.rs (+8 -9)
📝 frontend/rust-lib/flowy-core/src/lib.rs (+2 -2)

...and 15 more files

📄 Description

Feature Preview


PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

Summary by Sourcery

Refactor and enhance chat message persistence and synchronization in the AppFlowy AI module, introducing support for offline message storage and synchronization

New Features:

  • Added an offline message synchronization service
  • Implemented is_sync flag for chat messages and chats to track synchronization state

Enhancements:

  • Introduced an auto-sync mechanism for chat messages and chats
  • Simplified chat service implementations by extracting common synchronization logic
  • Added support for tracking message and chat synchronization status

Chores:

  • Renamed several service and implementation classes to improve clarity
  • Updated database schema to support synchronization tracking

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AppFlowy-IO/AppFlowy/pull/7777 **Author:** [@appflowy](https://github.com/appflowy) **Created:** 4/18/2025 **Status:** ✅ Merged **Merged:** 4/18/2025 **Merged by:** [@appflowy](https://github.com/appflowy) **Base:** `main` ← **Head:** `prepare_auto_sync_chat` --- ### 📝 Commits (4) - [`31d8653`](https://github.com/AppFlowy-IO/AppFlowy/commit/31d8653ba61f5885630f7bad13e2d08f4e0968d1) refactor: save chat and chat message - [`165e95c`](https://github.com/AppFlowy-IO/AppFlowy/commit/165e95c480663f989b32a1be7d59dbc878f58525) chore: fix test - [`59efb7d`](https://github.com/AppFlowy-IO/AppFlowy/commit/59efb7d9e54d2c044721e2be6b884a86914cbce7) chore: fix test - [`4925e99`](https://github.com/AppFlowy-IO/AppFlowy/commit/4925e991660a5a6d89ada9705473051553e06f8b) chore: fix compile ### 📊 Changes **35 files changed** (+620 additions, -420 deletions) <details> <summary>View changed files</summary> 📝 `frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_bloc.dart` (+1 -1) 📝 `frontend/rust-lib/Cargo.lock` (+12 -12) 📝 `frontend/rust-lib/Cargo.toml` (+2 -2) 📝 `frontend/rust-lib/event-integration-test/tests/chat/chat_message_test.rs` (+1 -6) 📝 `frontend/rust-lib/event-integration-test/tests/sql_test/chat_message_test.rs` (+28 -15) 📝 `frontend/rust-lib/flowy-ai-pub/src/cloud.rs` (+4 -5) 📝 `frontend/rust-lib/flowy-ai-pub/src/persistence/chat_message_sql.rs` (+34 -2) 📝 `frontend/rust-lib/flowy-ai-pub/src/persistence/chat_sql.rs` (+32 -21) 📝 `frontend/rust-lib/flowy-ai/src/ai_manager.rs` (+5 -33) 📝 `frontend/rust-lib/flowy-ai/src/chat.rs` (+15 -33) 📝 `frontend/rust-lib/flowy-ai/src/entities.rs` (+2 -7) 📝 `frontend/rust-lib/flowy-ai/src/event_handler.rs` (+1 -32) 📝 `frontend/rust-lib/flowy-ai/src/lib.rs` (+1 -0) 📝 `frontend/rust-lib/flowy-ai/src/local_ai/controller.rs` (+54 -55) 📝 `frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs` (+17 -47) ➕ `frontend/rust-lib/flowy-ai/src/offline/mod.rs` (+1 -0) ➕ `frontend/rust-lib/flowy-ai/src/offline/offline_message_sync.rs` (+258 -0) 📝 `frontend/rust-lib/flowy-ai/src/stream_message.rs` (+1 -0) 📝 `frontend/rust-lib/flowy-core/src/deps_resolve/cloud_service_impl.rs` (+8 -9) 📝 `frontend/rust-lib/flowy-core/src/lib.rs` (+2 -2) _...and 15 more files_ </details> ### 📄 Description <!--- Thank you for submitting a pull request to AppFlowy. The team will dedicate their best efforts to reviewing and approving your pull request. If you have any questions about the project or feedback for us, please join our [Discord](https://discord.gg/wdjWUXXhtw). --> <!--- If your pull request adds a new feature, please drag and drop a video into this section to showcase what you've done! If not, you may delete this section. --> ### Feature Preview <!--- List at least one issue here that this PR addresses. If it fixes the issue, please use the [fixes](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests) keyword to close the issue. For example: fixes https://github.com/AppFlowy-IO/AppFlowy/pull/2106 --> --- <!--- Before you mark this PR ready for review, run through this checklist! --> #### PR Checklist - [ ] My code adheres to [AppFlowy's Conventions](https://docs.appflowy.io/docs/documentation/software-contributions/conventions) - [ ] I've listed at least one issue that this PR fixes in the description above. - [ ] I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes. - [ ] All existing tests are passing. ## Summary by Sourcery Refactor and enhance chat message persistence and synchronization in the AppFlowy AI module, introducing support for offline message storage and synchronization New Features: - Added an offline message synchronization service - Implemented is_sync flag for chat messages and chats to track synchronization state Enhancements: - Introduced an auto-sync mechanism for chat messages and chats - Simplified chat service implementations by extracting common synchronization logic - Added support for tracking message and chat synchronization status Chores: - Renamed several service and implementation classes to improve clarity - Updated database schema to support synchronization tracking --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
mirror 2026-03-23 23:22:38 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AppFlowy-IO/AppFlowy#8107
No description provided.