From 95620a4331f18580a26358ad1dff739c8132f60d Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Tue, 31 Mar 2026 18:18:24 +0200 Subject: [PATCH] Unify frontend prompt rendering to use API-only prompt library Remove hardcoded DEFAULT_ACTIONS and icon map from prompt-picker, fetch all prompts from the backend. Simplify Zod types to match the single-table schema (drop source/system_prompt_slug/is_modified, add version). Update PromptsContent empty state copy. --- .../components/PromptsContent.tsx | 52 ++++--- .../components/new-chat/prompt-picker.tsx | 144 ++---------------- .../contracts/types/prompts.types.ts | 20 +-- 3 files changed, 44 insertions(+), 172 deletions(-) diff --git a/surfsense_web/app/dashboard/[search_space_id]/user-settings/components/PromptsContent.tsx b/surfsense_web/app/dashboard/[search_space_id]/user-settings/components/PromptsContent.tsx index c2f9c7123..e8c45a31a 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/user-settings/components/PromptsContent.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/user-settings/components/PromptsContent.tsx @@ -173,32 +173,32 @@ export function PromptsContent() { -
- setFormData((p) => ({ ...p, is_public: checked }))} - /> - -
+
+ setFormData((p) => ({ ...p, is_public: checked }))} + /> + +
-
- - -
+
+ + +
)} {prompts.length === 0 && !showForm && (
-

No custom prompts yet

+

No prompts yet

Create prompts to quickly transform or explore text with /

@@ -228,7 +228,9 @@ export function PromptsContent() { )}
-

+

{prompt.prompt}

{prompt.prompt.length > 100 && ( @@ -247,7 +249,9 @@ export function PromptsContent() { title={prompt.is_public ? "Make private" : "Share with community"} onClick={async () => { try { - const updated = await promptsApiService.update(prompt.id, { is_public: !prompt.is_public }); + const updated = await promptsApiService.update(prompt.id, { + is_public: !prompt.is_public, + }); setPrompts((prev) => prev.map((p) => (p.id === prompt.id ? updated : p))); toast.success(updated.is_public ? "Shared with community" : "Made private"); } catch { @@ -256,7 +260,11 @@ export function PromptsContent() { }} className="flex items-center justify-center size-7 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors" > - {prompt.is_public ? : } + {prompt.is_public ? ( + + ) : ( + + )} ))} - {customFiltered.length > 0 &&
} - - {customFiltered.map((action, i) => { - const index = defaultFiltered.length + i; - return ( - - ); - })} -