mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 15:13:07 +00:00
- Streaming AI endpoint at /campanha/api/ai-chat with DeepSeek V4 Flash - 8 tools: calculate, getMunicipalityVotes, getTopDeputies, getDobradinhas, getMunicipalityOverview, getLeaderships, getOrganizations, searchEntities - In-memory rate limiter (50 msgs / 15 min per user) - Desktop: resizable right sidebar via react-resizable-panels - Mobile: full-screen Drawer opened by FAB (2/3 size of quick-actions FAB) - Markdown rendering with react-markdown + remark-gfm (tables, bold, lists) - Session-bound context (clean slate each open) - Auth via existing campaign-token cookie, tools respect user RBAC - Architecture doc: docs/plans/ai-chat-sollinha.md - E2E tests: campaignAiChat.e2e.spec.ts (mocked endpoint)
66 lines
1.8 KiB
TypeScript
66 lines
1.8 KiB
TypeScript
import { cva, type VariantProps } from 'class-variance-authority'
|
|
import { Slot } from 'radix-ui'
|
|
import * as React from 'react'
|
|
|
|
import { cn } from '@/lib/utils'
|
|
|
|
const markerVariants = cva(
|
|
"group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: '',
|
|
separator:
|
|
'before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border',
|
|
border: 'border-b border-border pb-2',
|
|
},
|
|
},
|
|
},
|
|
)
|
|
|
|
function Marker({
|
|
className,
|
|
variant = 'default',
|
|
asChild = false,
|
|
...props
|
|
}: React.ComponentProps<'div'> &
|
|
VariantProps<typeof markerVariants> & {
|
|
asChild?: boolean
|
|
}) {
|
|
const Comp = asChild ? Slot.Root : 'div'
|
|
|
|
return (
|
|
<Comp
|
|
data-slot="marker"
|
|
data-variant={variant}
|
|
className={cn(markerVariants({ variant, className }))}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function MarkerIcon({ className, ...props }: React.ComponentProps<'span'>) {
|
|
return (
|
|
<span
|
|
data-slot="marker-icon"
|
|
aria-hidden="true"
|
|
className={cn("size-4 shrink-0 [&_svg:not([class*='size-'])]:size-4", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function MarkerContent({ className, ...props }: React.ComponentProps<'span'>) {
|
|
return (
|
|
<span
|
|
data-slot="marker-content"
|
|
className={cn(
|
|
'min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export { Marker, MarkerContent, MarkerIcon, markerVariants }
|