Custom theme generator (#2182)
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Prototype custom theme generator that lets users create themes manually
or generate prompts from images, manage them from a new Themes page, and
apply them in chat. Themes are global and used in streaming and token
counting.
- **New Features**
- Added custom_themes table.
- Implemented IPC and hooks to list/create/update/delete themes with
query cache invalidation.
- New CustomThemeDialog with manual prompt entry and prompt generation
from uploaded images and optional keywords; uses the selected model via
Dyad Pro and requires Dyad Pro enabled.
- New Themes page with CRUD, EditThemeDialog, and a sidebar link.
- Updated chat Themes menu to show built-in plus recent custom themes,
with “New Theme” and a “More themes” dialog; newly created themes
auto-select and selection persists per app.
- **Refactors**
- Replaced getThemePrompt with async getThemePromptById to support
custom theme IDs (custom:<id>); integrated in chat_stream and
token_count handlers.
- Whitelisted new IPC channels in preload.
<sup>Written for commit 37d9e5f0c477e2bb0847df506450b45a25ab4874.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds end-to-end custom theme support, including storage, IPC, UI, and
chat/system-prompt integration.
>
> - New `custom_themes` table (+ migration `0022_loving_wendigo`) and
Drizzle schema `customThemes`
> - IPC: moved/expanded theme handlers to
`pro/main/ipc/handlers/themes_handlers.ts` with endpoints for
`get/set-app-theme`, `get/create/update/delete` custom themes, image
save/cleanup, and `generate-theme-prompt`; whitelisted channels in
`preload`
> - Hooks and client: `useCustomThemes` CRUD/generation hooks;
`IpcClient` methods for custom themes, image handling, and generation
> - UI: new `ThemesPage` with cards, `CustomThemeDialog` (AI + manual),
`AIGeneratorTab` (image upload, model/mode, Pro-gated),
`EditThemeDialog`, improved `DeleteConfirmationDialog`; added
`LibraryList` and updated `app-sidebar` default Library route
> - Chat: `AuxiliaryActionsMenu` shows built-in and recent custom
themes, "New Theme" and "More themes"; auto-select newly created theme
> - Prompt resolution: replaced `getThemePrompt` with async
`getThemePromptById` (supports `custom:<id>`) in chat stream and token
count handlers
> - Routing: added `/themes` route; e2e tests for themes CRUD, AI
generator flow/limits, and prompt library navigation
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
37d9e5f0c477e2bb0847df506450b45a25ab4874. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
正在显示
drizzle/0022_loving_wendigo.sql
0 → 100644
drizzle/meta/0022_snapshot.json
0 → 100644
差异被折叠。
src/components/AIGeneratorTab.tsx
0 → 100644
差异被折叠。
src/components/LibraryList.tsx
0 → 100644
src/hooks/useCustomThemes.ts
0 → 100644
src/ipc/utils/theme_utils.ts
0 → 100644
src/pages/themes.tsx
0 → 100644
差异被折叠。
src/routes/themes.ts
0 → 100644
请
注册
或者
登录
后发表评论