Files
supabase/apps/studio/components/ui/AIAssistantPanel/elements/Reasoning.tsx
T
2538a5c8af Assistant UI refine (#38228)
* try a really long context window to maximize caching

* update examples

* attempt to update packages and useChat

* update endpoints

* update zod

* zod

* update to v5

* message update

* Revert "zod"

This reverts commit ec39bac6b6.

* revert zod

* zod i

* fix complete endpoints

* remove async

* change to content

* type cleanup

* Revert the package bumps to rebuild them.

* Bump zod to 2.25.76 in all packages.

* Bump openai in all packages.

* Bump ai and ai-related packages.

* Remove unneeded files.

* Fix the rest of the migration stuff.

* Prettier fixes.

* testing new gptoss models

* sonnet as pro

* back to 3.7

* revert test

* add policy list tool

* fix

* refactor

* ai sdk 5 fixes

* refactor complete endpoint

* edge function prompt

* remove example

* use limited model for completions

* remove duplicate

* Update bedrock.ts

Co-authored-by: divit <27228526+delgado3d@users.noreply.github.com>

* add default check

* only add prefix if more then one region

* temp use api

* refactor to use openai api

* test

* remove unused import

* Prettier lint

* Fix test

* revert back to bedrock

* Tiny style fix for spacing of code blocks from edit message button

* use conversation

* try generate text normally

* prompt adjust

* add list style to prompt

* prompt adjust

* status

* prompt adjust emphasise display query

* rendering

* prompt

* ui updates

* update prompts

* more ui

* ui finesse

* fix

* use streamdown

* remove package

* refactor header

* copy

* prompt adjust

* remove package

* prompt adjust

* Revert "use streamdown"

This reverts commit 22d0e88e54.

* remove streamdown

* margin adjust

* Nit

* Minor clean up

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
Co-authored-by: divit <27228526+delgado3d@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-08-28 12:39:26 +07:00

52 lines
1.5 KiB
TypeScript

import { BrainIcon, ChevronDownIcon, Loader2 } from 'lucide-react'
import type { ComponentProps } from 'react'
import { memo } from 'react'
import ReactMarkdown from 'react-markdown'
import {
cn,
Collapsible,
CollapsibleContent_Shadcn_ as CollapsibleContent,
CollapsibleTrigger_Shadcn_ as CollapsibleTrigger,
} from 'ui'
type ReasoningProps = Omit<ComponentProps<typeof Collapsible>, 'children'> & {
isStreaming?: boolean
children: string
}
export const Reasoning = memo(({ className, isStreaming, children, ...props }: ReasoningProps) => (
<Collapsible
className={cn('not-prose border rounded-md border-muted', className)}
defaultOpen={false}
{...props}
>
<CollapsibleTrigger
className={cn(
'flex items-center gap-2 text-foreground-lighter heading-meta px-3 py-2 w-full'
)}
>
{isStreaming ? (
<>
<Loader2 strokeWidth={1.5} size={12} className="animate-spin" />
<p>Thinking...</p>
</>
) : (
<>
<BrainIcon strokeWidth={1.5} size={12} className="text-foreground-muted" />
<p>Reasoned</p>
</>
)}
<ChevronDownIcon strokeWidth={1.5} size={12} className="text-foreground-muted" />
</CollapsibleTrigger>
<CollapsibleContent
className={cn('p-5 pt-2 text-xs leading-normal', 'max-h-64 overflow-y-auto')}
>
<ReactMarkdown>{children}</ReactMarkdown>
</CollapsibleContent>
</Collapsible>
))
Reasoning.displayName = 'Reasoning'