[PR #7887] [MERGED] Custom langchain rust #8184

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

📋 Pull Request Information

Original PR: https://github.com/AppFlowy-IO/AppFlowy/pull/7887
Author: @appflowy
Created: 5/7/2025
Status: Merged
Merged: 5/7/2025
Merged by: @appflowy

Base: mainHead: custom_langchain_rust


📝 Commits (2)

  • ef9fe82 chore: implement custom memory store chain
  • 28f2143 chore: do not allow edit embedding model

📊 Changes

21 files changed (+558 additions, -370 deletions)

View changed files

📝 frontend/appflowy_flutter/lib/workspace/application/settings/ai/ollama_setting_bloc.dart (+4 -1)
📝 frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/ollama_setting.dart (+20 -9)
📝 frontend/resources/translations/en.json (+1 -0)
📝 frontend/rust-lib/Cargo.lock (+9 -10)
📝 frontend/rust-lib/Cargo.toml (+2 -2)
📝 frontend/rust-lib/flowy-ai-pub/src/persistence/chat_sql.rs (+64 -25)
📝 frontend/rust-lib/flowy-ai/Cargo.toml (+0 -1)
📝 frontend/rust-lib/flowy-ai/src/ai_manager.rs (+37 -32)
📝 frontend/rust-lib/flowy-ai/src/event_handler.rs (+3 -1)
📝 frontend/rust-lib/flowy-ai/src/local_ai/chat/conversation_chain.rs (+16 -10)
📝 frontend/rust-lib/flowy-ai/src/local_ai/chat/llm_chat.rs (+43 -59)
📝 frontend/rust-lib/flowy-ai/src/local_ai/chat/mod.rs (+15 -14)
frontend/rust-lib/flowy-ai/src/local_ai/chat/summary_memory.rs (+124 -0)
📝 frontend/rust-lib/flowy-ai/src/local_ai/controller.rs (+10 -5)
📝 frontend/rust-lib/flowy-ai/tests/chat_test/mod.rs (+1 -190)
frontend/rust-lib/flowy-ai/tests/chat_test/qa_test.rs (+133 -0)
📝 frontend/rust-lib/flowy-ai/tests/main.rs (+58 -1)
📝 frontend/rust-lib/flowy-server/src/local_server/impls/chat.rs (+9 -9)
frontend/rust-lib/flowy-sqlite/migrations/2025-05-06-131915_chat_summary/down.sql (+3 -0)
frontend/rust-lib/flowy-sqlite/migrations/2025-05-06-131915_chat_summary/up.sql (+5 -0)

...and 1 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 the local AI chat functionality in AppFlowy, introducing a more flexible and extensible chat system with improved memory management and summary generation.

New Features:

  • Introduced a summary-based memory system for chat conversations
  • Added support for generating and storing chat summaries
  • Enhanced chat information structure with more flexible initialization

Enhancements:

  • Improved chat initialization and configuration
  • Refactored chat memory and message handling
  • Made chat information more modular and configurable

Tests:

  • Added comprehensive test cases for new chat functionality
  • Migrated existing chat tests to new implementation

Chores:

  • Updated database schema to support chat summaries
  • Removed deprecated chat name column
  • Simplified chat-related code structure

🔄 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/7887 **Author:** [@appflowy](https://github.com/appflowy) **Created:** 5/7/2025 **Status:** ✅ Merged **Merged:** 5/7/2025 **Merged by:** [@appflowy](https://github.com/appflowy) **Base:** `main` ← **Head:** `custom_langchain_rust` --- ### 📝 Commits (2) - [`ef9fe82`](https://github.com/AppFlowy-IO/AppFlowy/commit/ef9fe82a02e3045010f539bed72386ef62efa30a) chore: implement custom memory store chain - [`28f2143`](https://github.com/AppFlowy-IO/AppFlowy/commit/28f21431bef967feb09c77131055e7742f4250db) chore: do not allow edit embedding model ### 📊 Changes **21 files changed** (+558 additions, -370 deletions) <details> <summary>View changed files</summary> 📝 `frontend/appflowy_flutter/lib/workspace/application/settings/ai/ollama_setting_bloc.dart` (+4 -1) 📝 `frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/ollama_setting.dart` (+20 -9) 📝 `frontend/resources/translations/en.json` (+1 -0) 📝 `frontend/rust-lib/Cargo.lock` (+9 -10) 📝 `frontend/rust-lib/Cargo.toml` (+2 -2) 📝 `frontend/rust-lib/flowy-ai-pub/src/persistence/chat_sql.rs` (+64 -25) 📝 `frontend/rust-lib/flowy-ai/Cargo.toml` (+0 -1) 📝 `frontend/rust-lib/flowy-ai/src/ai_manager.rs` (+37 -32) 📝 `frontend/rust-lib/flowy-ai/src/event_handler.rs` (+3 -1) 📝 `frontend/rust-lib/flowy-ai/src/local_ai/chat/conversation_chain.rs` (+16 -10) 📝 `frontend/rust-lib/flowy-ai/src/local_ai/chat/llm_chat.rs` (+43 -59) 📝 `frontend/rust-lib/flowy-ai/src/local_ai/chat/mod.rs` (+15 -14) ➕ `frontend/rust-lib/flowy-ai/src/local_ai/chat/summary_memory.rs` (+124 -0) 📝 `frontend/rust-lib/flowy-ai/src/local_ai/controller.rs` (+10 -5) 📝 `frontend/rust-lib/flowy-ai/tests/chat_test/mod.rs` (+1 -190) ➕ `frontend/rust-lib/flowy-ai/tests/chat_test/qa_test.rs` (+133 -0) 📝 `frontend/rust-lib/flowy-ai/tests/main.rs` (+58 -1) 📝 `frontend/rust-lib/flowy-server/src/local_server/impls/chat.rs` (+9 -9) ➕ `frontend/rust-lib/flowy-sqlite/migrations/2025-05-06-131915_chat_summary/down.sql` (+3 -0) ➕ `frontend/rust-lib/flowy-sqlite/migrations/2025-05-06-131915_chat_summary/up.sql` (+5 -0) _...and 1 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 the local AI chat functionality in AppFlowy, introducing a more flexible and extensible chat system with improved memory management and summary generation. New Features: - Introduced a summary-based memory system for chat conversations - Added support for generating and storing chat summaries - Enhanced chat information structure with more flexible initialization Enhancements: - Improved chat initialization and configuration - Refactored chat memory and message handling - Made chat information more modular and configurable Tests: - Added comprehensive test cases for new chat functionality - Migrated existing chat tests to new implementation Chores: - Updated database schema to support chat summaries - Removed deprecated chat name column - Simplified chat-related code structure --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
mirror 2026-03-23 23:23:00 +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#8184
No description provided.