From 481ae0c24785a1798a0445a2a982acce6db7e4f2 Mon Sep 17 00:00:00 2001
From: omagdy7 <omar.professional8777@gmail.com>
Date: Thu, 22 Feb 2024 19:12:22 +0200
Subject: Added the ability to Ask in context of the block only instead of the
 whole page

---
 src/components/PromptAI.tsx | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'src/components/PromptAI.tsx')

diff --git a/src/components/PromptAI.tsx b/src/components/PromptAI.tsx
index 5fb9942..6b4616d 100644
--- a/src/components/PromptAI.tsx
+++ b/src/components/PromptAI.tsx
@@ -4,7 +4,7 @@ import { Input } from '@/components/ui/input';
 
 export const PromptAI = ({ type, theme }: { type: string, theme: string }) => {
 
-  const placeholder = type === 'ask ai' ? "Prompt..." : "Define..."
+  const placeholder = type.startsWith('ask') ? "Prompt..." : "Define..."
   const [inputValue, setInputValue] = useState('');
   const [hitEnter, setHitEnter] = useState(false)
 
@@ -15,8 +15,10 @@ export const PromptAI = ({ type, theme }: { type: string, theme: string }) => {
         askAI(inputValue, "")
       } else if (type === 'define') {
         defineWord(inputValue)
-      } else if (type === 'ask with context') {
-        askWithContext(inputValue)
+      } else if (type === 'ask with page context') {
+        askWithContext(inputValue, 'page')
+      } else if (type === 'ask with block context') {
+        askWithContext(inputValue, 'block')
       }
     }
   }, [hitEnter])
-- 
cgit v1.2.3

