From d5949fd54f346ca7d1093763e570a73d4f6155c5 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Fri, 2 May 2025 20:50:48 +0100 Subject: [PATCH] Improve actions buttons --- .../TopicDetail/PredefinedActionGroup.tsx | 2 +- .../TopicDetail/PredefinedActions.tsx | 26 +++++++++++++++++-- src/components/TopicDetail/TopicDetailAI.tsx | 4 +-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/components/TopicDetail/PredefinedActionGroup.tsx b/src/components/TopicDetail/PredefinedActionGroup.tsx index 07f06bf16..adc718e55 100644 --- a/src/components/TopicDetail/PredefinedActionGroup.tsx +++ b/src/components/TopicDetail/PredefinedActionGroup.tsx @@ -39,7 +39,7 @@ export function PredefinedActionGroup(props: PredefinedActionGroupProps) { { onSelect(action); setIsOpen(false); diff --git a/src/components/TopicDetail/PredefinedActions.tsx b/src/components/TopicDetail/PredefinedActions.tsx index 665ec9268..b1ac35d20 100644 --- a/src/components/TopicDetail/PredefinedActions.tsx +++ b/src/components/TopicDetail/PredefinedActions.tsx @@ -3,7 +3,9 @@ import { BookOpenTextIcon, BrainIcon, ChevronDownIcon, + ListIcon, NotebookPenIcon, + PencilLine, type LucideIcon, } from 'lucide-react'; import { cn } from '../../lib/classname'; @@ -23,9 +25,20 @@ export const actions: PredefinedActionType[] = [ children: [ { icon: NotebookPenIcon, - label: 'Explain Topic', + label: 'Explain the topic', prompt: 'Explain this topic in detail and include examples', }, + { + icon: ListIcon, + label: 'List the key points', + prompt: 'List the key points to remember from this topic', + }, + { + icon: PencilLine, + label: 'Summarize the topic', + prompt: + 'Briefly explain the topic in a few sentences. Treat it as a brief answer to an interview question. Your response should just be the answer to the question, nothing else.', + }, { icon: BabyIcon, label: 'Explain like I am five', @@ -46,6 +59,15 @@ export const promptLabelMapping = actions.reduce( if (action.prompt) { acc[action.prompt] = action.label; } + + if (action.children) { + action.children.forEach((child) => { + if (child.prompt) { + acc[child.prompt] = child.label; + } + }); + } + return acc; }, {} as Record, @@ -107,7 +129,7 @@ export function PredefinedActionButton(props: PredefinedActionButtonProps) { )} onClick={onClick} > - {Icon && } + {Icon && } {label} {isGroup && } diff --git a/src/components/TopicDetail/TopicDetailAI.tsx b/src/components/TopicDetail/TopicDetailAI.tsx index ad9b93c29..0b346f048 100644 --- a/src/components/TopicDetail/TopicDetailAI.tsx +++ b/src/components/TopicDetail/TopicDetailAI.tsx @@ -267,7 +267,7 @@ export function TopicDetailAI(props: TopicDetailAIProps) {
{hasSubjects && ( @@ -295,7 +295,7 @@ export function TopicDetailAI(props: TopicDetailAIProps) {
{hasChatHistory && (