[PR #7894] [MERGED] feat: load custom prompts from a database #8192

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

📋 Pull Request Information

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

Base: mainHead: feat/database-custom-prompts


📝 Commits (3)

  • 14b55e5 feat: load custom prompts from a database
  • 55c1421 chore: code review
  • ef38c44 chore: process trashed views and reduce widget rebuilds

📊 Changes

24 files changed (+1095 additions, -249 deletions)

View changed files

📝 frontend/appflowy_flutter/lib/ai/ai.dart (+1 -0)
📝 frontend/appflowy_flutter/lib/ai/service/ai_entities.dart (+20 -1)
📝 frontend/appflowy_flutter/lib/ai/service/ai_prompt_selector_cubit.dart (+242 -38)
📝 frontend/appflowy_flutter/lib/ai/service/appflowy_ai_service.dart (+20 -0)
📝 frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_category_list.dart (+156 -83)
frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_database_selector.dart (+284 -0)
📝 frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_modal.dart (+126 -82)
📝 frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_preview.dart (+2 -4)
📝 frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_visible_list.dart (+41 -34)
📝 frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_message_selector_banner.dart (+0 -1)
📝 frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dart (+0 -1)
📝 frontend/resources/translations/en.json (+7 -1)
📝 frontend/rust-lib/flowy-ai-pub/src/cloud.rs (+1 -0)
📝 frontend/rust-lib/flowy-ai/Cargo.toml (+1 -1)
📝 frontend/rust-lib/flowy-ai/src/ai_manager.rs (+24 -0)
📝 frontend/rust-lib/flowy-ai/src/entities.rs (+6 -0)
📝 frontend/rust-lib/flowy-ai/src/event_handler.rs (+33 -0)
📝 frontend/rust-lib/flowy-ai/src/event_map.rs (+14 -0)
📝 frontend/rust-lib/flowy-database-pub/Cargo.toml (+1 -1)
📝 frontend/rust-lib/flowy-database2/Cargo.toml (+1 -1)

...and 4 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

Implement a feature to load custom AI prompts from a database, allowing users to select and use custom prompts dynamically

New Features:

  • Add ability to load custom prompts from a database view
  • Implement a database view selector for custom prompts
  • Support dynamic loading and filtering of custom prompts

Enhancements:

  • Refactor AI prompt selector to support custom and featured prompts
  • Improve prompt category selection and filtering
  • Add support for storing and retrieving custom prompt database view ID

Tests:

  • Add support for loading prompts from a database
  • Implement error handling for invalid database views

🔄 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/7894 **Author:** [@richardshiue](https://github.com/richardshiue) **Created:** 5/7/2025 **Status:** ✅ Merged **Merged:** 5/8/2025 **Merged by:** [@richardshiue](https://github.com/richardshiue) **Base:** `main` ← **Head:** `feat/database-custom-prompts` --- ### 📝 Commits (3) - [`14b55e5`](https://github.com/AppFlowy-IO/AppFlowy/commit/14b55e515852a41f461f895505e568b01f12dd26) feat: load custom prompts from a database - [`55c1421`](https://github.com/AppFlowy-IO/AppFlowy/commit/55c1421da1cf2114182ee1a009c73c6bee31b35e) chore: code review - [`ef38c44`](https://github.com/AppFlowy-IO/AppFlowy/commit/ef38c44c8e19b8be477ff1a8e34b3f551988f529) chore: process trashed views and reduce widget rebuilds ### 📊 Changes **24 files changed** (+1095 additions, -249 deletions) <details> <summary>View changed files</summary> 📝 `frontend/appflowy_flutter/lib/ai/ai.dart` (+1 -0) 📝 `frontend/appflowy_flutter/lib/ai/service/ai_entities.dart` (+20 -1) 📝 `frontend/appflowy_flutter/lib/ai/service/ai_prompt_selector_cubit.dart` (+242 -38) 📝 `frontend/appflowy_flutter/lib/ai/service/appflowy_ai_service.dart` (+20 -0) 📝 `frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_category_list.dart` (+156 -83) ➕ `frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_database_selector.dart` (+284 -0) 📝 `frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_modal.dart` (+126 -82) 📝 `frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_preview.dart` (+2 -4) 📝 `frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_visible_list.dart` (+41 -34) 📝 `frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_message_selector_banner.dart` (+0 -1) 📝 `frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dart` (+0 -1) 📝 `frontend/resources/translations/en.json` (+7 -1) 📝 `frontend/rust-lib/flowy-ai-pub/src/cloud.rs` (+1 -0) 📝 `frontend/rust-lib/flowy-ai/Cargo.toml` (+1 -1) 📝 `frontend/rust-lib/flowy-ai/src/ai_manager.rs` (+24 -0) 📝 `frontend/rust-lib/flowy-ai/src/entities.rs` (+6 -0) 📝 `frontend/rust-lib/flowy-ai/src/event_handler.rs` (+33 -0) 📝 `frontend/rust-lib/flowy-ai/src/event_map.rs` (+14 -0) 📝 `frontend/rust-lib/flowy-database-pub/Cargo.toml` (+1 -1) 📝 `frontend/rust-lib/flowy-database2/Cargo.toml` (+1 -1) _...and 4 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 - [x] My code adheres to [AppFlowy's Conventions](https://docs.appflowy.io/docs/documentation/software-contributions/conventions) - [x] I've listed at least one issue that this PR fixes in the description above. - [x] I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes. - [x] All existing tests are passing. ## Summary by Sourcery Implement a feature to load custom AI prompts from a database, allowing users to select and use custom prompts dynamically New Features: - Add ability to load custom prompts from a database view - Implement a database view selector for custom prompts - Support dynamic loading and filtering of custom prompts Enhancements: - Refactor AI prompt selector to support custom and featured prompts - Improve prompt category selection and filtering - Add support for storing and retrieving custom prompt database view ID Tests: - Add support for loading prompts from a database - Implement error handling for invalid database views --- <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:02 +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#8192
No description provided.