-
由 Will Chen 提交于
## Summary - Add a native notification that appears when a chat response completes while the Dyad app window is not focused - Controlled by a new setting "Show notification when chat completes" in Workflow Settings - Enabled by default for a seamless notification experience ## Implementation - Added `enableChatCompletionNotifications` setting to UserSettingsSchema (default: true) - Added `isWindowFocused` IPC contract and handler to check window focus state from main process - Added notification logic to `useStreamChat`'s `onEnd` callback using the Web Notification API - Created `ChatCompletionNotificationSwitch` component for the settings toggle - Added the toggle to the Workflow Settings section in the Settings page ## Test plan 1. Start the app and enable notifications in Workflow Settings (enabled by default) 2. Start a chat and switch focus to another application 3. Wait for the chat response to complete 4. Verify a native notification appears saying "Chat response completed" 5. When Dyad is focused, verify no notification appears 6. Disable the setting and verify notifications stop appearing
🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2413"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end --> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Mostly additive UI/renderer changes with an optional IPC payload field; main risk is runtime differences around `Notification` permissions/focus detection across platforms. > > **Overview** > Adds an opt-in Workflow Settings toggle (`enableChatCompletionNotifications`) that requests Web Notification permission when enabled. > > When a chat stream ends, the renderer now conditionally fires a native `Notification` if the setting is enabled, permission is granted, and the window is not focused, using the app name as the title and a truncated `chatSummary`/chat title as the body. > > Extends the `ChatResponseEnd` IPC payload with optional `chatSummary` and populates it from both the standard stream handler and the local-agent handler so the renderer can display richer completion notifications. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 02cb0c28d1bd72cf01e48f6923f4d2285df4aaa3. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds a native desktop notification when a chat response completes while Dyad isn’t focused, controlled by a new Workflow Settings toggle enabled by default. Helps you notice finished replies while multitasking. - **New Features** - New setting: “Show notification when chat completes” (default on). - Requests notification permission when you enable it; notifications show only if permission is granted. - Sends a notification via the Web Notification API when the window isn’t focused (document.hasFocus), using the app name as the title and the chat summary (or chat title) as the body. <sup>Written for commit 02cb0c28d1bd72cf01e48f6923f4d2285df4aaa3. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --------- Co-authored-by:Claude Opus 4.5 <noreply@anthropic.com>
| 名称 |
最后提交
|
最后更新 |
|---|---|---|
| .. | ||
| handlers | ||
| processors |