Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Prompt update

Terry Sutton24dd986f7c4f
diff --git a/apps/docs/components/Clippy/ClippyModal.tsx b/apps/docs/components/Clippy/ClippyModal.tsx
index 15ce44eb2b2..708431cc614 100644
--- a/apps/docs/components/Clippy/ClippyModal.tsx
+++ b/apps/docs/components/Clippy/ClippyModal.tsx
@@ -7,7 +7,7 @@ import clippyImage from '../../public/img/clippy.png'
import { useTheme } from 'common/Providers'
import Image from 'next/image'
-import { Button, IconAlertCircle, IconChevronRight, IconSearch, Input, Loading, Modal } from 'ui'
+import { Button, IconAlertCircle, IconLoader, IconSearch, Input, Loading, Modal } from 'ui'
import components from '~/components'
type Props = {
@@ -18,22 +18,28 @@ const questions = [
'How do I get started with Supabase?',
'How do I run Supabase locally?',
'How do I connect to my database?',
+ 'How do I run migrations? ',
+ 'How do I listen to changes in a table?',
]
const ClippyModal: FC<Props> = ({ onClose }) => {
const { isDarkMode } = useTheme()
const [query, setQuery] = useState('')
- const [answer, setAnswer] = useState<string>()
+ const [status, setStatus] = useState('')
+ const [answer, setAnswer] = useState('')
+ const [cantHelp, setCantHelp] = useState(false)
const [isLoading, setIsLoading] = useState(false)
const supabaseClient = useSupabaseClient()
const handleConfirm = useCallback(async () => {
setAnswer(undefined)
setIsLoading(true)
+ setStatus('Clippy is searching...')
const response = await supabaseClient.functions.invoke('clippy-search', { body: { query } })
setIsLoading(false)
+ setStatus('')
// TODO: display an error on the UI
if (response.error) {
@@ -41,6 +47,14 @@ const ClippyModal: FC<Props> = ({ onClose }) => {
return
}
+ if (response.data.answer.includes('Sorry, I don')) {
+ setCantHelp(true)
+ setStatus('Clippy has faild you')
+ } else {
+ setStatus('')
+ setCantHelp(false)
+ }
+
setAnswer(response.data.answer)
}, [query, supabaseClient])
@@ -52,44 +66,52 @@ const ClippyModal: FC<Props> = ({ onClose }) => {
function handleResetPrompt() {
setQuery('')
setAnswer(undefined)
+ setStatus('')
+ setCantHelp(false)
}
return (
- <Modal size="xlarge" visible={true} onCancel={onClose} hideFooter closable={false}>
+ <Modal size="xlarge" visible={true} onCancel={onClose} closable={false} hideFooter>
<div
- className={`mx-auto flex flex-col gap-4 rounded-lg p-6 w-full max-w-3xl shadow-2xl overflow-hidden border text-left border-scale-500 bg-scale-300 cursor-auto relative`}
+ className={`mx-auto flex flex-col gap-4 rounded-lg pt-6 px-6 pb-2 w-full max-w-3xl shadow-2xl overflow-hidden border text-left border-scale-500 bg-scale-100 dark:bg-scale-300 cursor-auto relative`}
onClick={(e) => e.stopPropagation()}
>
- <Input
- className="w-full"
- size="xlarge"
- autoFocus
- placeholder="Ask me anything about Supabase"
- value={query}
- onChange={(e) => setQuery(e.target.value)}
- icon={<IconSearch size="small" />}
- onKeyDown={(e) => {
- switch (e.key) {
- case 'Enter':
- handleConfirm()
- return
- default:
- return
- }
- }}
- />
+ <div className="relative">
+ <Input
+ className="w-full"
+ size="xlarge"
+ autoFocus
+ placeholder="Ask me anything about Supabase"
+ value={query}
+ onChange={(e) => setQuery(e.target.value)}
+ icon={<IconSearch size="small" />}
+ onKeyDown={(e) => {
+ switch (e.key) {
+ case 'Enter':
+ handleConfirm()
+ return
+ default:
+ return
+ }
+ }}
+ />
+ <div className="absolute right-0 top-0 mt-3 mr-4">
+ <Button type="default" size="tiny" onClick={onClose}>
+ esc
+ </Button>
+ </div>
+ </div>
{!isLoading && !answer && (
- <div className="flex justify-between relative">
+ <div className="">
<div className="mt-2">
<h2 className="text-xs text-scale-900">Not sure where to start?</h2>
- <ul className="text-xs leading-7 mt-1 text-scale-1000">
+ <ul className="text-xs mt-4 text-scale-1000 flex gap-4 flex-wrap max-w-3xl">
{questions.map((question) => (
- <li className="flex gap-1 items-center">
- <IconChevronRight width={12} height={12} />
+ <li>
<button
- className="hover:underline"
+ className="hover:bg-slate-400 hover:dark:bg-slate-400 px-4 py-2 bg-slate-300 dark:bg-slate-200 rounded-lg transition-colors"
onClick={() => handleQueryPreload(question)}
>
{question}
@@ -98,26 +120,22 @@ const ClippyModal: FC<Props> = ({ onClose }) => {
))}
</ul>
</div>
- <div className="absolute bottom-4 right-4">
- <Image
- width={45}
- height={48}
- src={isDarkMode ? clippyImageDark : clippyImage}
- alt="Clippy"
- />
- </div>
</div>
)}
{isLoading && (
- <div className="p-6">
+ <div className="p-6 grid gap-6 mt-4">
<Loading active>{}</Loading>
+ <p className="text-lg text-center">Searching for results</p>
</div>
)}
{answer && (
- <div className={`clippy-modal-container px-4 py-4 dark rounded-lg overflow-y-scroll`}>
+ <div className="px-4 py-4 dark rounded-lg overflow-y-scroll">
{answer.includes('Sorry, I don') ? (
- <p className="flex gap-4">
- <IconAlertCircle /> Sorry, I don&apos;t know how to help with that.{' '}
+ <p className="flex flex-col gap-4 items-center">
+ <div className="flex items-center gap-2 mt-4">
+ <IconAlertCircle />
+ <p>Sorry, I don&apos;t know how to help with that.</p>
+ </div>
<Button size="tiny" type="secondary" onClick={handleResetPrompt}>
Try again?
</Button>
@@ -143,6 +161,33 @@ const ClippyModal: FC<Props> = ({ onClose }) => {
)}
</div>
)}
+ <div className="border-t border-scale-600 mt-4 text-scale-900">
+ <div className="flex justify-between items-center py-2 text-xs">
+ <div className="flex items-centerp gap-1 pt-3 pb-1">
+ Powered by OpenAI.{' '}
+ <a href="" className="underline">
+ Read the blog post
+ </a>{' '}
+ →
+ </div>
+ <div className="flex items-center gap-6 py-1">
+ {isLoading || cantHelp ? (
+ <span className="bg-scale-400 rounded-lg py-1 px-2 flex items-center gap-2">
+ {isLoading && <IconLoader size={14} className="animate-spin" />}
+ {status}
+ </span>
+ ) : (
+ <></>
+ )}
+ <Image
+ width={30}
+ height={34}
+ src={isDarkMode ? clippyImageDark : clippyImage}
+ alt="Clippy"
+ />
+ </div>
+ </div>
+ </div>
</div>
</Modal>
)
diff --git a/apps/docs/styles/algolia-search.scss b/apps/docs/styles/algolia-search.scss
index 0e2b90589f6..56ac843d5d2 100644
--- a/apps/docs/styles/algolia-search.scss
+++ b/apps/docs/styles/algolia-search.scss
@@ -953,6 +953,7 @@ body {
// search bar
input[type='search'].DocSearch-Input {
background-color: var(--colors-scale1);
+ box-shadow: none;
}
.dark .DocSearch-Input {