[PR #7938] [MERGED] feat: allow users to map fields while importing prompts from database #8225

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

📋 Pull Request Information

Original PR: https://github.com/AppFlowy-IO/AppFlowy/pull/7938
Author: @richardshiue
Created: 5/16/2025
Status: Merged
Merged: 5/19/2025
Merged by: @richardshiue

Base: mainHead: feat/database-prompt-map


📝 Commits (1)

  • b9e0b4e feat: allow users to map fields while importing prompts from database

📊 Changes

22 files changed (+1365 additions, -568 deletions)

View changed files

📝 frontend/appflowy_flutter/lib/ai/service/ai_entities.dart (+99 -0)
frontend/appflowy_flutter/lib/ai/service/ai_prompt_database_selector_cubit.dart (+161 -0)
📝 frontend/appflowy_flutter/lib/ai/service/ai_prompt_selector_cubit.dart (+80 -56)
📝 frontend/appflowy_flutter/lib/ai/service/appflowy_ai_service.dart (+9 -9)
frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_database_modal.dart (+657 -0)
frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_database_selector.dart (+0 -346)
📝 frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_modal.dart (+1 -1)
📝 frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_onboarding.dart (+21 -13)
📝 frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_preview.dart (+3 -3)
📝 frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_visible_list.dart (+137 -80)
📝 frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_sources_menu.dart (+6 -3)
📝 frontend/appflowy_flutter/lib/plugins/database/domain/field_service.dart (+11 -0)
📝 frontend/appflowy_flutter/packages/appflowy_ui/lib/src/component/popover/popover.dart (+5 -5)
📝 frontend/resources/translations/en-US.json (+8 -2)
📝 frontend/rust-lib/flowy-ai/src/ai_manager.rs (+14 -8)
📝 frontend/rust-lib/flowy-ai/src/entities.rs (+19 -0)
📝 frontend/rust-lib/flowy-ai/src/event_handler.rs (+10 -10)
📝 frontend/rust-lib/flowy-ai/src/event_map.rs (+8 -8)
📝 frontend/rust-lib/flowy-database2/src/entities/database_entities.rs (+19 -0)
📝 frontend/rust-lib/flowy-database2/src/event_handler.rs (+22 -6)

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

Introduce a structured custom prompt database configuration workflow that lets users choose a database view and map its fields for AI prompts. Implement a multi-layer solution—including UI modals, new RPC handlers, and data model refactors—to replace the previous view-only approach with full field mapping.

New Features:

  • Enable users to select and map database fields (title, content, example, category) when importing AI prompts from a custom database view
  • Persist a complete CustomPromptDatabaseConfig (including field IDs) in preferences and pass it across front-end and back-end layers
  • Expose and handle new plugin events to test, get, and set custom prompt database configurations

Enhancements:

  • Refactor AI and database services to work with CustomPromptDatabaseConfig instead of a plain view ID
  • Add loading indicators and improve popover decoration and styling for field selectors

🔄 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/7938 **Author:** [@richardshiue](https://github.com/richardshiue) **Created:** 5/16/2025 **Status:** ✅ Merged **Merged:** 5/19/2025 **Merged by:** [@richardshiue](https://github.com/richardshiue) **Base:** `main` ← **Head:** `feat/database-prompt-map` --- ### 📝 Commits (1) - [`b9e0b4e`](https://github.com/AppFlowy-IO/AppFlowy/commit/b9e0b4ec8bf822a6a2984c99537fd40b755cdeb9) feat: allow users to map fields while importing prompts from database ### 📊 Changes **22 files changed** (+1365 additions, -568 deletions) <details> <summary>View changed files</summary> 📝 `frontend/appflowy_flutter/lib/ai/service/ai_entities.dart` (+99 -0) ➕ `frontend/appflowy_flutter/lib/ai/service/ai_prompt_database_selector_cubit.dart` (+161 -0) 📝 `frontend/appflowy_flutter/lib/ai/service/ai_prompt_selector_cubit.dart` (+80 -56) 📝 `frontend/appflowy_flutter/lib/ai/service/appflowy_ai_service.dart` (+9 -9) ➕ `frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_database_modal.dart` (+657 -0) ➖ `frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_database_selector.dart` (+0 -346) 📝 `frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_modal.dart` (+1 -1) 📝 `frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_onboarding.dart` (+21 -13) 📝 `frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_preview.dart` (+3 -3) 📝 `frontend/appflowy_flutter/lib/ai/widgets/ai_prompt_modal/ai_prompt_visible_list.dart` (+137 -80) 📝 `frontend/appflowy_flutter/lib/ai/widgets/prompt_input/select_sources_menu.dart` (+6 -3) 📝 `frontend/appflowy_flutter/lib/plugins/database/domain/field_service.dart` (+11 -0) 📝 `frontend/appflowy_flutter/packages/appflowy_ui/lib/src/component/popover/popover.dart` (+5 -5) 📝 `frontend/resources/translations/en-US.json` (+8 -2) 📝 `frontend/rust-lib/flowy-ai/src/ai_manager.rs` (+14 -8) 📝 `frontend/rust-lib/flowy-ai/src/entities.rs` (+19 -0) 📝 `frontend/rust-lib/flowy-ai/src/event_handler.rs` (+10 -10) 📝 `frontend/rust-lib/flowy-ai/src/event_map.rs` (+8 -8) 📝 `frontend/rust-lib/flowy-database2/src/entities/database_entities.rs` (+19 -0) 📝 `frontend/rust-lib/flowy-database2/src/event_handler.rs` (+22 -6) _...and 2 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 Introduce a structured custom prompt database configuration workflow that lets users choose a database view and map its fields for AI prompts. Implement a multi-layer solution—including UI modals, new RPC handlers, and data model refactors—to replace the previous view-only approach with full field mapping. New Features: - Enable users to select and map database fields (title, content, example, category) when importing AI prompts from a custom database view - Persist a complete CustomPromptDatabaseConfig (including field IDs) in preferences and pass it across front-end and back-end layers - Expose and handle new plugin events to test, get, and set custom prompt database configurations Enhancements: - Refactor AI and database services to work with CustomPromptDatabaseConfig instead of a plain view ID - Add loading indicators and improve popover decoration and styling for field selectors --- <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:12 +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#8225
No description provided.