[PR #7923] [MERGED] chore: implement custom prompt usage metrics #8214

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

📋 Pull Request Information

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

Base: mainHead: chore/custom-prompt-metrics


📝 Commits (2)

  • 7adc056 chore: implement custom prompt usage metrics
  • d21761b chore: bump client-api

📊 Changes

24 files changed (+121 additions, -41 deletions)

View changed files

📝 frontend/appflowy_flutter/integration_test/shared/mock/mock_ai.dart (+1 -0)
📝 frontend/appflowy_flutter/lib/ai/service/ai_prompt_input_bloc.dart (+8 -0)
📝 frontend/appflowy_flutter/lib/ai/service/appflowy_ai_service.dart (+3 -0)
📝 frontend/appflowy_flutter/lib/ai/widgets/prompt_input/desktop_prompt_input.dart (+16 -7)
📝 frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_bloc.dart (+7 -4)
📝 frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_stream_manager.dart (+7 -1)
📝 frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_page/chat_footer.dart (+2 -1)
📝 frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/ai_writer_block_component.dart (+6 -3)
📝 frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/operations/ai_writer_cubit.dart (+24 -4)
📝 frontend/appflowy_flutter/test/bloc_test/ai_writer_test/ai_writer_bloc_test.dart (+4 -0)
📝 frontend/rust-lib/Cargo.lock (+13 -13)
📝 frontend/rust-lib/Cargo.toml (+6 -5)
📝 frontend/rust-lib/event-integration-test/src/chat_event.rs (+1 -0)
📝 frontend/rust-lib/event-integration-test/tests/chat/chat_message_test.rs (+2 -0)
📝 frontend/rust-lib/flowy-ai-pub/src/cloud.rs (+1 -0)
📝 frontend/rust-lib/flowy-ai/src/chat.rs (+1 -0)
📝 frontend/rust-lib/flowy-ai/src/completion.rs (+1 -0)
📝 frontend/rust-lib/flowy-ai/src/entities.rs (+7 -0)
📝 frontend/rust-lib/flowy-ai/src/event_handler.rs (+2 -0)
📝 frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs (+2 -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

Enable tracking of custom prompt usage by propagating a promptId across AI writer and chat workflows

Enhancements:

  • Propagate promptId parameter through AiWriterCubit operations and DesktopPromptInput submissions
  • Extend ChatBloc, ChatStreamManager, and related UI components to accept and forward promptId
  • Update protobuf definitions (StreamChatPayloadPB, CompleteTextPB) and cloud service interfaces to include prompt_id
  • Integrate promptId handling in middleware, offline sync, and server implementations
  • Bump client-api, client-api-entity, and workspace-template dependencies to latest rev

Build:

  • Update Cargo.toml to bump client-api related dependencies

Tests:

  • Extend mocks, bloc tests, and integration tests to include promptId in AI and chat scenarios

🔄 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/7923 **Author:** [@richardshiue](https://github.com/richardshiue) **Created:** 5/13/2025 **Status:** ✅ Merged **Merged:** 5/19/2025 **Merged by:** [@richardshiue](https://github.com/richardshiue) **Base:** `main` ← **Head:** `chore/custom-prompt-metrics` --- ### 📝 Commits (2) - [`7adc056`](https://github.com/AppFlowy-IO/AppFlowy/commit/7adc0563a10a5fd50424ca3018ff549b775b8d38) chore: implement custom prompt usage metrics - [`d21761b`](https://github.com/AppFlowy-IO/AppFlowy/commit/d21761b3e5ac344bfb1ec1fb6eae96afe09d49cc) chore: bump client-api ### 📊 Changes **24 files changed** (+121 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `frontend/appflowy_flutter/integration_test/shared/mock/mock_ai.dart` (+1 -0) 📝 `frontend/appflowy_flutter/lib/ai/service/ai_prompt_input_bloc.dart` (+8 -0) 📝 `frontend/appflowy_flutter/lib/ai/service/appflowy_ai_service.dart` (+3 -0) 📝 `frontend/appflowy_flutter/lib/ai/widgets/prompt_input/desktop_prompt_input.dart` (+16 -7) 📝 `frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_bloc.dart` (+7 -4) 📝 `frontend/appflowy_flutter/lib/plugins/ai_chat/application/chat_stream_manager.dart` (+7 -1) 📝 `frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_page/chat_footer.dart` (+2 -1) 📝 `frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/ai_writer_block_component.dart` (+6 -3) 📝 `frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/operations/ai_writer_cubit.dart` (+24 -4) 📝 `frontend/appflowy_flutter/test/bloc_test/ai_writer_test/ai_writer_bloc_test.dart` (+4 -0) 📝 `frontend/rust-lib/Cargo.lock` (+13 -13) 📝 `frontend/rust-lib/Cargo.toml` (+6 -5) 📝 `frontend/rust-lib/event-integration-test/src/chat_event.rs` (+1 -0) 📝 `frontend/rust-lib/event-integration-test/tests/chat/chat_message_test.rs` (+2 -0) 📝 `frontend/rust-lib/flowy-ai-pub/src/cloud.rs` (+1 -0) 📝 `frontend/rust-lib/flowy-ai/src/chat.rs` (+1 -0) 📝 `frontend/rust-lib/flowy-ai/src/completion.rs` (+1 -0) 📝 `frontend/rust-lib/flowy-ai/src/entities.rs` (+7 -0) 📝 `frontend/rust-lib/flowy-ai/src/event_handler.rs` (+2 -0) 📝 `frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs` (+2 -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 Enable tracking of custom prompt usage by propagating a promptId across AI writer and chat workflows Enhancements: - Propagate promptId parameter through AiWriterCubit operations and DesktopPromptInput submissions - Extend ChatBloc, ChatStreamManager, and related UI components to accept and forward promptId - Update protobuf definitions (StreamChatPayloadPB, CompleteTextPB) and cloud service interfaces to include prompt_id - Integrate promptId handling in middleware, offline sync, and server implementations - Bump client-api, client-api-entity, and workspace-template dependencies to latest rev Build: - Update Cargo.toml to bump client-api related dependencies Tests: - Extend mocks, bloc tests, and integration tests to include promptId in AI and chat scenarios --- <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:08 +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#8214
No description provided.