[PR #7875] [MERGED] refactor: Model select #8177

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

📋 Pull Request Information

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

Base: mainHead: model_select


📝 Commits (6)

📊 Changes

17 files changed (+1168 additions, -306 deletions)

View changed files

📝 frontend/appflowy_flutter/lib/workspace/application/settings/ai/settings_ai_bloc.dart (+1 -4)
📝 frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/model_selection.dart (+1 -3)
📝 frontend/rust-lib/flowy-ai-pub/src/cloud.rs (+16 -0)
📝 frontend/rust-lib/flowy-ai/src/ai_manager.rs (+148 -262)
📝 frontend/rust-lib/flowy-ai/src/event_handler.rs (+2 -1)
📝 frontend/rust-lib/flowy-ai/src/lib.rs (+3 -1)
📝 frontend/rust-lib/flowy-ai/src/local_ai/controller.rs (+4 -4)
📝 frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs (+11 -0)
frontend/rust-lib/flowy-ai/src/model_select.rs (+471 -0)
frontend/rust-lib/flowy-ai/src/model_select_test.rs (+434 -0)
📝 frontend/rust-lib/flowy-ai/src/offline/offline_message_sync.rs (+11 -0)
frontend/rust-lib/flowy-ai/src/util.rs (+0 -3)
📝 frontend/rust-lib/flowy-core/src/app_life_cycle.rs (+25 -12)
📝 frontend/rust-lib/flowy-core/src/deps_resolve/cloud_service_impl.rs (+12 -0)
📝 frontend/rust-lib/flowy-core/src/server_layer.rs (+4 -14)
📝 frontend/rust-lib/flowy-server/src/af_cloud/impls/chat.rs (+16 -2)
📝 frontend/rust-lib/flowy-server/src/local_server/impls/chat.rs (+9 -0)

📄 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 model selection mechanism in the AI module to provide a more flexible and robust approach to managing AI models across different sources and workspaces

New Features:

  • Introduced a new ModelSelectionControl to manage AI model selection across different sources
  • Added support for multiple model sources (local, server)
  • Implemented fallback mechanisms for model selection

Enhancements:

  • Improved model storage and retrieval logic
  • Added more flexible model source management
  • Enhanced workspace-specific model selection

Chores:

  • Removed deprecated model caching mechanisms
  • Simplified AI manager model selection logic
  • Consolidated model-related code into a new module

🔄 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/7875 **Author:** [@appflowy](https://github.com/appflowy) **Created:** 5/2/2025 **Status:** ✅ Merged **Merged:** 5/2/2025 **Merged by:** [@appflowy](https://github.com/appflowy) **Base:** `main` ← **Head:** `model_select` --- ### 📝 Commits (6) - [`6b99346`](https://github.com/AppFlowy-IO/AppFlowy/commit/6b99346f23f3de55e04170f9a14a02e5d7957d57) refactor: model select - [`fe7a932`](https://github.com/AppFlowy-IO/AppFlowy/commit/fe7a932d1f668d5f6d7810de6ff306317b474326) refactor: add test - [`5c5adff`](https://github.com/AppFlowy-IO/AppFlowy/commit/5c5adff39eb361bb11ba9115698816f9b19b2a78) fix: add source - [`9e2c38d`](https://github.com/AppFlowy-IO/AppFlowy/commit/9e2c38d5fef8cac9512472896198582001098075) fix: add source - [`117763d`](https://github.com/AppFlowy-IO/AppFlowy/commit/117763de4788c9d7b28313bc5e22587e412fbb29) chore: notify all unset source - [`ff9f6a3`](https://github.com/AppFlowy-IO/AppFlowy/commit/ff9f6a39ea3ee4f31a43f40dcaa75c5ed6418ed3) chore: fix test ### 📊 Changes **17 files changed** (+1168 additions, -306 deletions) <details> <summary>View changed files</summary> 📝 `frontend/appflowy_flutter/lib/workspace/application/settings/ai/settings_ai_bloc.dart` (+1 -4) 📝 `frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/model_selection.dart` (+1 -3) 📝 `frontend/rust-lib/flowy-ai-pub/src/cloud.rs` (+16 -0) 📝 `frontend/rust-lib/flowy-ai/src/ai_manager.rs` (+148 -262) 📝 `frontend/rust-lib/flowy-ai/src/event_handler.rs` (+2 -1) 📝 `frontend/rust-lib/flowy-ai/src/lib.rs` (+3 -1) 📝 `frontend/rust-lib/flowy-ai/src/local_ai/controller.rs` (+4 -4) 📝 `frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs` (+11 -0) ➕ `frontend/rust-lib/flowy-ai/src/model_select.rs` (+471 -0) ➕ `frontend/rust-lib/flowy-ai/src/model_select_test.rs` (+434 -0) 📝 `frontend/rust-lib/flowy-ai/src/offline/offline_message_sync.rs` (+11 -0) ➖ `frontend/rust-lib/flowy-ai/src/util.rs` (+0 -3) 📝 `frontend/rust-lib/flowy-core/src/app_life_cycle.rs` (+25 -12) 📝 `frontend/rust-lib/flowy-core/src/deps_resolve/cloud_service_impl.rs` (+12 -0) 📝 `frontend/rust-lib/flowy-core/src/server_layer.rs` (+4 -14) 📝 `frontend/rust-lib/flowy-server/src/af_cloud/impls/chat.rs` (+16 -2) 📝 `frontend/rust-lib/flowy-server/src/local_server/impls/chat.rs` (+9 -0) </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 model selection mechanism in the AI module to provide a more flexible and robust approach to managing AI models across different sources and workspaces New Features: - Introduced a new ModelSelectionControl to manage AI model selection across different sources - Added support for multiple model sources (local, server) - Implemented fallback mechanisms for model selection Enhancements: - Improved model storage and retrieval logic - Added more flexible model source management - Enhanced workspace-specific model selection Chores: - Removed deprecated model caching mechanisms - Simplified AI manager model selection logic - Consolidated model-related code into a new module --- <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:58 +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#8177
No description provided.