text
stringlengths
3
8.33k
repo
stringclasses
52 values
path
stringlengths
6
141
language
stringclasses
35 values
sha
stringlengths
64
64
chunk_index
int32
0
273
n_tokens
int32
1
896
"use client"; import { BombIcon, ListIcon, PaletteIcon, PenLineIcon, PenSquareIcon, Trash2Icon, XIcon, } from "lucide-react"; import { type ReactNode, useEffect, useRef } from "react"; import { cn } from "@/lib/utils"; export type SlashCommand = { name: string; description: string; icon: ReactNode...
diplomarbeit-ideen
components/chat/slash-commands.tsx
TypeScript
7af3c1429291b767867d1382b1881362649c22e1e54ab9de9498e153202a9f61
0
896
"text-[12px] text-muted-foreground/50"> {cmd.description} </span> {cmd.shortcut && ( <span className="ml-auto text-[11px] text-muted-foreground/30"> {cmd.shortcut} </span> )} </button> ))} </div> </...
diplomarbeit-ideen
components/chat/slash-commands.tsx
TypeScript
ea81f93f8ded30104d0e8a35f2ccada22caf5e02d4647693cc6c3a813e8d45e6
1
84
"use client"; import type { UseChatHelpers } from "@ai-sdk/react"; import { motion } from "framer-motion"; import { memo } from "react"; import { suggestions } from "@/lib/constants"; import type { ChatMessage } from "@/lib/types"; import { Suggestion } from "../ai-elements/suggestion"; import type { VisibilityType } ...
diplomarbeit-ideen
components/chat/suggested-actions.tsx
TypeScript
30cb441ab800d9ebe060c1014230be4a07ee4e87f4e2bef3e6e8caae77c0e365
0
596
"use client"; import { AnimatePresence, motion } from "framer-motion"; import type { UISuggestion } from "@/lib/editor/suggestions"; import { Button } from "../ui/button"; import { CrossIcon, SparklesIcon } from "./icons"; export const SuggestionDialog = ({ suggestion, onApply, onClose, }: { suggestion: UISu...
diplomarbeit-ideen
components/chat/suggestion.tsx
TypeScript
e5b9adb5870f2c7c97ada2773ca9b70718769d3209bf6241d0b6d67d8544e941
0
633
"use client"; import { exampleSetup } from "prosemirror-example-setup"; import { inputRules } from "prosemirror-inputrules"; import { EditorState } from "prosemirror-state"; import { type Decoration, DecorationSet, EditorView } from "prosemirror-view"; import { memo, useCallback, useEffect, useRef, useState } from "re...
diplomarbeit-ideen
components/chat/text-editor.tsx
TypeScript
763c80b5e7f8b0ac7143357945cbbae7df1016cbf77673d305ff752828523511
0
896
if (editorRef.current?.state.doc && content) { const projectedSuggestions = projectWithPositions( editorRef.current.state.doc, suggestions ).filter( (suggestion) => suggestion.selectionStart && suggestion.selectionEnd ); suggestionsRef.current = projectedSuggestions; ...
diplomarbeit-ideen
components/chat/text-editor.tsx
TypeScript
115e629b2f1bc5c5a4a864312c4047dee0170eb0307d9c6f1723e7c6b8ed367d
1
528
yToLevel = useTransform(y, [0, -dragConstraints], [0, 5]); const [currentLevel, setCurrentLevel] = useState(2); const [hasUserSelectedLevel, setHasUserSelectedLevel] = useState<boolean>(false); useEffect(() => { const unsubscribe = yToLevel.on("change", (latest) => { const level = Math.min(5, Math...
diplomarbeit-ideen
components/chat/toolbar.tsx
TypeScript
59d52b169d6fa4675c23036005fc2fd4ef68c7246474e9b40804b1b3c653cde3
1
896
{ icon: <WrenchIcon className="size-4" />, description: "Fix error", onClick: ({ sendMessage: send }) => { send({ role: "user", parts: [ { type: "text", text: `Fix the error in the existing script${documentId ? ` (id: ${documentId})` : ""} using updateDocument. Do not c...
diplomarbeit-ideen
components/chat/toolbar.tsx
TypeScript
d9c145913217f7a90973a01e1852d544100d3afb11bc027eddcf567df36b075c
2
896
="size-4" /> </motion.div> )} {status === "streaming" ? ( <motion.div animate={{ scale: 1.4 }} className="p-3" exit={{ scale: 1 }} initial={{ scale: 1 }} key="stop-icon" onClick={() => { stop(); ...
diplomarbeit-ideen
components/chat/toolbar.tsx
TypeScript
4c158fe59d0ec218f77a410dca00f20517fd2e42423b9133968318bfd8875aa0
3
334
"use client"; import { isAfter } from "date-fns"; import { motion } from "framer-motion"; import { ChevronLeftIcon, ChevronRightIcon, DiffIcon } from "lucide-react"; import type { Dispatch, SetStateAction } from "react"; import { useState } from "react"; import { useSWRConfig } from "swr"; import { useArtifact } from ...
diplomarbeit-ideen
components/chat/version-footer.tsx
TypeScript
9ea5fb353ac643535b7da48f370e667303117e14df8f73ef1dddd3993129d7f7
0
896
onClick={async () => { setIsMutating(true); try { await mutate( `${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/document?id=${artifact.documentId}`, await fetch( `${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/document?id=${artifac...
diplomarbeit-ideen
components/chat/version-footer.tsx
TypeScript
61e55f9f164041b2c8571bf58b5710b9a282833b7c9061e9a579fe8657d2d049
1
302
"use client"; import cx from "classnames"; import { format, isWithinInterval } from "date-fns"; import { useEffect, useState } from "react"; const SunIcon = ({ size = 40 }: { size?: number }) => ( <svg fill="none" height={size} viewBox="0 0 24 24" width={size}> <circle cx="12" cy="12" fill="currentColor" r="5" ...
diplomarbeit-ideen
components/chat/weather.tsx
TypeScript
28e5e34419aea61188535412ebed906a1f49f0fcac26d2b13b11a2b766ba90ae
0
896
07T01:00", "2024-10-07T02:00", "2024-10-07T03:00", "2024-10-07T04:00", "2024-10-07T05:00", "2024-10-07T06:00", "2024-10-07T07:00", "2024-10-07T08:00", "2024-10-07T09:00", "2024-10-07T10:00", "2024-10-07T11:00", "2024-10-07T12:00", "2024-10-07T13:00...
diplomarbeit-ideen
components/chat/weather.tsx
TypeScript
3e5dd30be4a1165ad331d95c13c6f755bbb9c2cab401e1ecb299ee0277018a6f
1
896
2024-10-10T05:00", "2024-10-10T06:00", "2024-10-10T07:00", "2024-10-10T08:00", "2024-10-10T09:00", "2024-10-10T10:00", "2024-10-10T11:00", "2024-10-10T12:00", "2024-10-10T13:00", "2024-10-10T14:00", "2024-10-10T15:00", "2024-10-10T16:00", "2024-10-...
diplomarbeit-ideen
components/chat/weather.tsx
TypeScript
ee511fd6c54c2ba7722ffd6238e89459d9b431988cd235aee1f49b6dd5a9ffd8
2
896
); window.addEventListener("resize", handleResize); return () => window.removeEventListener("resize", handleResize); }, []); const hoursToShow = isMobile ? 5 : 6; const currentTimeIndex = weatherAtLocation.hourly.time.findIndex( (time) => new Date(time) >= new Date(weatherAtLocation.current.time) ...
diplomarbeit-ideen
components/chat/weather.tsx
TypeScript
9cb92f3c9a6425b476ebeef5af98abe508d919490259c137ea0bd5a72989c0e2
3
896
white/60", { "text-yellow-200": isDay, "text-blue-200": !isDay, })} > <CloudIcon size={16} /> </div> <div className="font-medium text-white text-xs"> {n(displayT...
diplomarbeit-ideen
components/chat/weather.tsx
TypeScript
85ddf2cf464db7cd6f616711cefcf9aef5ab3846cf2afdcbbd610bfbf1d1969e
4
202
"use client" import * as React from "react" import { AlertDialog as AlertDialogPrimitive } from "radix-ui" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) { return <AlertDialogPrimitive.Roo...
diplomarbeit-ideen
components/ui/alert-dialog.tsx
TypeScript
7ad29d745d067497f9793926ef8a3724f79a416adf87839b44ccaeac8845920d
0
896
:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end", className )} {...props} /> ) } function AlertDialogMedia({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="alert-dialog-media" className={cn( "...
diplomarbeit-ideen
components/ui/alert-dialog.tsx
TypeScript
a2b80879438fad253d7cd359a144294b6074cd2ddaaa04c05e114dbb38f7fcd4
1
631
import * as React from "react" import { cva, type VariantProps } from "class-variance-authority" import { Slot } from "radix-ui" import { cn } from "@/lib/utils" const badgeVariants = cva( "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transpa...
diplomarbeit-ideen
components/ui/badge.tsx
TypeScript
3a41ceadb0a13070e475b7b75f3e005bf39c79e980953895a77c06a9c9149570
0
517
import { cva, type VariantProps } from "class-variance-authority" import { Slot } from "radix-ui" import { cn } from "@/lib/utils" import { Separator } from "@/components/ui/separator" const buttonGroupVariants = cva( "flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-gr...
diplomarbeit-ideen
components/ui/button-group.tsx
TypeScript
8e3c2aadec35831b9b86d199ee6d4394afa59ff4f99c764cabbd1328c80272f5
0
714
import * as React from "react" import { cva, type VariantProps } from "class-variance-authority" import { Slot } from "radix-ui" import { cn } from "@/lib/utils" const buttonVariants = cva( "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm fo...
diplomarbeit-ideen
components/ui/button.tsx
TypeScript
dd43f02e0e6324694ddf4edd684d820e2edc38ed82ea7dcbfe72ed5143d1be92
0
791
"use client" import { Collapsible as CollapsiblePrimitive } from "radix-ui" function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) { return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} /> } function CollapsibleTrigger({ ...props }: React.ComponentProps<typeo...
diplomarbeit-ideen
components/ui/collapsible.tsx
TypeScript
c6598e5584f4258b5d9fefadbc5ad6a66888ad58729f4b634a0bb2d9c513188b
0
158
"use client" import * as React from "react" import { Command as CommandPrimitive } from "cmdk" import { cn } from "@/lib/utils" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog" import { InputGroup, InputGroupAddon, } from "@/components/ui/inpu...
diplomarbeit-ideen
components/ui/command.tsx
TypeScript
8110f72fd2ee087ec901aba8e185a3a27f39c69466d9f32427c3a2e0500808c4
0
896
px bg-border/50", className)} {...props} /> ) } function CommandItem({ className, children, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) { return ( <CommandPrimitive.Item data-slot="command-item" className={cn( "group/command-item relative flex cursor-defa...
diplomarbeit-ideen
components/ui/command.tsx
TypeScript
9eb2cedf73536695d8d4208b042cac80508deccdbff156bf3d8a925e79d01e1f
1
327
"use client" import * as React from "react" import { Dialog as DialogPrimitive } from "radix-ui" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { XIcon } from "lucide-react" function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) { return <DialogP...
diplomarbeit-ideen
components/ui/dialog.tsx
TypeScript
7e07deb0973132875f67549b3acd274824c0ae94d999c356f202fd10ce3211bf
0
896
DialogPrimitive.Close> )} </div> ) } function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) { return ( <DialogPrimitive.Title data-slot="dialog-title" className={cn("text-base leading-none font-medium", className)} {...props} /> )...
diplomarbeit-ideen
components/ui/dialog.tsx
TypeScript
cf83809f95768ff504aa43f3e0ba8b3830da20b6650ae5cc2ba47880342c2dbd
1
199
"use client" import * as React from "react" import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui" import { cn } from "@/lib/utils" import { CheckIcon, ChevronRightIcon } from "lucide-react" function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) { return <DropdownM...
diplomarbeit-ideen
components/ui/dropdown-menu.tsx
TypeScript
4e2ff6762218f44b9228b6908cd5abfa67cacc25ab799c0ed95cfcd2036128bc
0
896
.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem> & { inset?: boolean }) { return ( <DropdownMenuPrimitive.CheckboxItem data-slot="dropdown-menu-checkbox-item" data-inset={inset} className={cn( "relative flex cursor-default items-center gap-2.5 rounded-xl py-2 pr-8 pl-3 text-s...
diplomarbeit-ideen
components/ui/dropdown-menu.tsx
TypeScript
3aefef12c03f322b868f97d07c9eb1b230cc57c00a0dbabff57e2b051566a836
1
896
: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) { return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} /> } function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & { inset?: boolean }) { retu...
diplomarbeit-ideen
components/ui/dropdown-menu.tsx
TypeScript
341f22410bf87323360ae40284832735834e7d9356e96001c653f81802f0d10d
2
530
"use client" import * as React from "react" import { HoverCard as HoverCardPrimitive } from "radix-ui" import { cn } from "@/lib/utils" function HoverCard({ ...props }: React.ComponentProps<typeof HoverCardPrimitive.Root>) { return <HoverCardPrimitive.Root data-slot="hover-card" {...props} /> } function HoverCa...
diplomarbeit-ideen
components/ui/hover-card.tsx
TypeScript
0157217b35d15704920b527b892ce3c6853809984b116e488fa4b52809ffcd2e
0
416
"use client" import * as React from "react" import { cva, type VariantProps } from "class-variance-authority" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Textarea } from "@/components/ui/textarea" function InputGroup({ classN...
diplomarbeit-ideen
components/ui/input-group.tsx
TypeScript
4d4114b770af612bbfdb24a0f54a8881203b265b343548f5d24d9bad24ecae28
0
896
px-3 pt-3 group-has-[>input]/input-group:pt-3 [.border-b]:pb-3", "block-end": "order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-3 [.border-t]:pt-3", }, }, defaultVariants: { align: "inline-start", }, } ) function InputGroupAddon({ className, al...
diplomarbeit-ideen
components/ui/input-group.tsx
TypeScript
1dbeba35faad9e7df4d2a35528cb04c2ae669f303e18d6c71d14546c30779f87
1
782
import * as React from "react" import { cn } from "@/lib/utils" function Input({ className, type, ...props }: React.ComponentProps<"input">) { return ( <input type={type} data-slot="input" className={cn( "h-9 w-full min-w-0 rounded-4xl border border-input bg-input/30 px-3 py-1 text-bas...
diplomarbeit-ideen
components/ui/input.tsx
TypeScript
451779f46bae615b318784dfebccdffc77861f012c9bf65643c4e545eaac920a
0
264
"use client" import * as React from "react" import { Label as LabelPrimitive } from "radix-ui" import { cn } from "@/lib/utils" function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) { return ( <LabelPrimitive.Root data-slot="label" className={cn( "fle...
diplomarbeit-ideen
components/ui/label.tsx
TypeScript
a476e41f08b9de5bd447de66a33d8bc2ad18f2fa6b96c064778bab4b6f439f4c
0
160
"use client"; import { Popover } from "radix-ui"; import { cn } from "@/lib/utils"; function PopoverRoot({ ...props }: React.ComponentProps<typeof Popover.Root>) { return <Popover.Root data-slot="popover" {...props} />; } function PopoverTrigger({ ...props }: React.ComponentProps<typeof Popover.Trigger>) { retur...
diplomarbeit-ideen
components/ui/popover.tsx
TypeScript
45cf20fa9a927ab13723a05111f83f9a92204cd4dfb28c4df057a67a3e96e8af
0
451
"use client" import * as React from "react" import { Select as SelectPrimitive } from "radix-ui" import { cn } from "@/lib/utils" import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react" function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) { return <SelectPrimitive.Roo...
diplomarbeit-ideen
components/ui/select.tsx
TypeScript
720ab34667e97f11779128fd9c8dc4f531d6ea48adff1ae91727867c9e4a12e2
0
896
slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", position ==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className...
diplomarbeit-ideen
components/ui/select.tsx
TypeScript
58fbd7285a041f18f9d9eeb5cfeb4578942ec85dfe8158cdabee31269d8275f3
1
896
<typeof SelectPrimitive.ScrollDownButton>) { return ( <SelectPrimitive.ScrollDownButton data-slot="select-scroll-down-button" className={cn( "z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className )} {...props} ...
diplomarbeit-ideen
components/ui/select.tsx
TypeScript
22546701771da8d8862b4f201027b59dc3384ad8f48bef381c7f5f574b87682a
2
120
"use client" import * as React from "react" import { Separator as SeparatorPrimitive } from "radix-ui" import { cn } from "@/lib/utils" function Separator({ className, orientation = "horizontal", decorative = true, ...props }: React.ComponentProps<typeof SeparatorPrimitive.Root>) { return ( <SeparatorP...
diplomarbeit-ideen
components/ui/separator.tsx
TypeScript
c924a82e99fda03684c17238d04eec857edc83977da2ee601795e94e52b4828f
0
151
"use client" import * as React from "react" import { Dialog as SheetPrimitive } from "radix-ui" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { XIcon } from "lucide-react" function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) { return <SheetPrimiti...
diplomarbeit-ideen
components/ui/sheet.tsx
TypeScript
ac35f766348f9eb221ec5ba9a9fd2c3dfeab76c6e2313d808cf812b5a43c6fa4
0
896
-from-top-full data-closed:animate-out data-closed:fade-out-0 data-closed:duration-300 data-closed:ease-[cubic-bezier(0.32,0.72,0,1)] data-[side=bottom]:data-closed:slide-out-to-bottom-full data-[side=left]:data-closed:slide-out-to-left-full data-[side=right]:data-closed:slide-out-to-right-full data-[side=top]:data-clo...
diplomarbeit-ideen
components/ui/sheet.tsx
TypeScript
44d52d3bbc2457ad1fde0f7f78cd2051a2034d5e80818a07a5eb508c84ead9f7
1
526
"use client" import * as React from "react" import { cva, type VariantProps } from "class-variance-authority" import { Slot } from "radix-ui" import { useIsMobile } from "@/hooks/use-mobile" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" ...
diplomarbeit-ideen
components/ui/sidebar.tsx
TypeScript
25541fc47f3e95ba2e6c4c7e8eb7ce99037912c5a97c5336c9733569de06f256
0
896
"offcanvas", className, children, dir, ...props }: React.ComponentProps<"div"> & { side?: "left" | "right" variant?: "sidebar" | "floating" | "inset" collapsible?: "offcanvas" | "icon" | "none" }) { const { isMobile, state, openMobile, setOpenMobile } = useSidebar() if (collapsible === "none") { ...
diplomarbeit-ideen
components/ui/sidebar.tsx
TypeScript
bfb61f574fc36e11a2aefaaece9db9afc0d4751ccb5a9f4a6bbedf13d6665652
1
896
-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)", className )} {...props} > <div data-sidebar="sidebar" data-slot="sidebar-inner" className="flex size-full flex-col bg-sidebar group-data-[varia...
diplomarbeit-ideen
components/ui/sidebar.tsx
TypeScript
0ef215d79740ffd228400b780ac5168047fe39c1371a6cd2f4476b3735b50a49
2
896
-slot="sidebar-input" data-sidebar="input" className={cn("h-8 w-full bg-background shadow-none", className)} {...props} /> ) } function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="sidebar-header" data-sidebar="header" cl...
diplomarbeit-ideen
components/ui/sidebar.tsx
TypeScript
e63292b8954f72a6183f4bcb168e4bb41d891404d809b94735849fed0810862f
3
896
2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", className )} {...props} /> ) } function SidebarGroupContent({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="sidebar-group-content" data-sidebar="group-content" className={cn("w-ful...
diplomarbeit-ideen
components/ui/sidebar.tsx
TypeScript
0f79575cce3c14e488562440bf1621e1d9b13a0050ccad751221618d213f1a9e
4
896
TooltipContent side="right" align="center" hidden={state !== "collapsed" || isMobile} {...tooltip} /> </Tooltip> ) } function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }: React.ComponentProps<"button"> & { asChild?: boolean sho...
diplomarbeit-ideen
components/ui/sidebar.tsx
TypeScript
8487d2da29884b8d19658e8f0effbb5e490b1f934d9d1767e5ece1005248af1c
5
896
sidebar="menu-sub" className={cn( "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden", className )} {...props} /> ) } function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<"...
diplomarbeit-ideen
components/ui/sidebar.tsx
TypeScript
e0c50165538fc0151155a9e7afb5a0685de78a29e80d23aef49afef3bf18cdb2
6
540
import { cn } from "@/lib/utils" function Skeleton({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="skeleton" className={cn("animate-pulse rounded-xl bg-muted", className)} {...props} /> ) } export { Skeleton }
diplomarbeit-ideen
components/ui/skeleton.tsx
TypeScript
4a1e9bb4ba6eccd5da12f61f604bbddc06ced618a384b2212cb6b1834e170735
0
79
import { cn } from "@/lib/utils" import { Loader2Icon } from "lucide-react" function Spinner({ className, ...props }: React.ComponentProps<"svg">) { return ( <Loader2Icon role="status" aria-label="Loading" className={cn("size-4 animate-spin", className)} {...props} /> ) } export { Spinner }
diplomarbeit-ideen
components/ui/spinner.tsx
TypeScript
1aa4cbc4272e833ecda915e3f59649ec5dfa8528d6c583a0a1b1e668496abacf
0
91
import * as React from "react" import { cn } from "@/lib/utils" function Textarea({ className, ...props }: React.ComponentProps<"textarea">) { return ( <textarea data-slot="textarea" className={cn( "flex field-sizing-content min-h-16 w-full resize-none rounded-xl border border-input bg-input...
diplomarbeit-ideen
components/ui/textarea.tsx
TypeScript
18e665f6f1a2d6a97c4447c0f83272c640bf20feef9a04c081908b5a816c757f
0
220
# Local Setup ## Required Services The v1 foundation is cloud-first: - Vercel for hosting and environment management. - Neon Postgres through `POSTGRES_URL` for template persistence. - Redis through `REDIS_URL` for resumable stream support. - Vercel Blob through `BLOB_READ_WRITE_TOKEN` for files. - Gemini API throug...
diplomarbeit-ideen
docs/local-setup.md
Markdown
7b64084f10a4224b4a51f77c14fad2cea9e0e625a1745a3172a2f1d8af91b6de
0
599
"use client"; import type { UseChatHelpers } from "@ai-sdk/react"; import { useChat } from "@ai-sdk/react"; import { DefaultChatTransport } from "ai"; import { usePathname } from "next/navigation"; import { createContext, type Dispatch, type ReactNode, type SetStateAction, useContext, useEffect, useMemo,...
diplomarbeit-ideen
hooks/use-active-chat.tsx
TypeScript
f4704a9d962d42717259647b8470daf2815b25ceae023edb648c822823b46697
0
896
ChatMessage>({ id: chatId, messages: initialMessages, generateId: generateUUID, sendAutomaticallyWhen: ({ messages: currentMessages }) => { const lastMessage = currentMessages.at(-1); return ( lastMessage?.parts?.some( (part) => "state" in part && pa...
diplomarbeit-ideen
hooks/use-active-chat.tsx
TypeScript
6a70f08694d9e0501a912ed3aa059d6c7439c3619d30303a725acecbc97d23b5
1
896
[{ type: "text", text: query }], }); } }, [sendMessage, chatId, initialModelReady]); useAutoResume({ autoResume: !isNewChat && !!chatData, initialMessages, resumeStream, setMessages, }); const isReadonly = isNewChat ? false : (chatData?.isReadonly ?? false); const { data: votes } ...
diplomarbeit-ideen
hooks/use-active-chat.tsx
TypeScript
adc0cf03370f91c90e9f255c39b2b50af172a4ef1ebdd037eeffb44c86d5a509
2
290
"use client"; import type { UseChatHelpers } from "@ai-sdk/react"; import { useEffect } from "react"; import { useDataStream } from "@/components/chat/data-stream-provider"; import type { ChatMessage } from "@/lib/types"; export type UseAutoResumeParams = { autoResume: boolean; initialMessages: ChatMessage[]; r...
diplomarbeit-ideen
hooks/use-auto-resume.ts
TypeScript
05b356810be23d35bb319069e523db15d5bdd5688688bc954d223f82bb74a847
0
279
"use client"; import { useMemo } from "react"; import useSWR, { useSWRConfig } from "swr"; import { unstable_serialize } from "swr/infinite"; import { updateChatVisibility } from "@/app/(chat)/actions"; import { type ChatHistory, getChatHistoryPaginationKey, } from "@/components/chat/sidebar-history"; import type ...
diplomarbeit-ideen
hooks/use-chat-visibility.ts
TypeScript
bb23967f4e9bc8223a6e08ea67de9f15db70118d178e0ce931d43531cd3fa800
0
307
import { useCallback, useEffect, useRef, useState } from "react"; export function useScrollToBottom() { const containerRef = useRef<HTMLDivElement>(null); const endRef = useRef<HTMLDivElement>(null); const [isAtBottom, setIsAtBottom] = useState(true); const isAtBottomRef = useRef(true); const isUserScrolling...
diplomarbeit-ideen
hooks/use-scroll-to-bottom.tsx
TypeScript
e67024e10f74a40af9f4be1b3d4eadbaa342bf12c2355d210abdfddd412adf6e
0
600
import { generateDummyPassword } from "./db/utils"; export const isProductionEnvironment = process.env.NODE_ENV === "production"; export const isDevelopmentEnvironment = process.env.NODE_ENV === "development"; export const isTestEnvironment = Boolean( process.env.PLAYWRIGHT_TEST_BASE_URL || process.env.PLAYWRIGH...
diplomarbeit-ideen
lib/constants.ts
TypeScript
6fe37da90a7870be46aa21688ceb2e6b2cc508cbab5d55a0602c7839af0dae59
0
150
import { createClient } from "redis"; import { isProductionEnvironment } from "@/lib/constants"; import { ChatbotError } from "@/lib/errors"; const MAX_MESSAGES = 10; const TTL_SECONDS = 60 * 60; let client: ReturnType<typeof createClient> | null = null; function getClient() { if (!client && process.env.REDIS_URL...
diplomarbeit-ideen
lib/ratelimit.ts
TypeScript
c76c31f3ffea2602ba5959c104b6e2343578e57c47a6c36ac4681aecd97c2697
0
275
import type { InferUITool, UIMessage } from "ai"; import { z } from "zod"; import type { ArtifactKind } from "@/components/chat/artifact"; import type { createDocument } from "./ai/tools/create-document"; import type { getWeather } from "./ai/tools/get-weather"; import type { findThesisExtensions, getThesisById, ...
diplomarbeit-ideen
lib/types.ts
TypeScript
1f269089d488ded2f8008ce559122c1ba90e440ce93166aa10b4bcbab51973cc
0
376
import type { UIMessage, UIMessagePart, } from 'ai'; import { type ClassValue, clsx } from 'clsx'; import { formatISO } from 'date-fns'; import { twMerge } from 'tailwind-merge'; import type { DBMessage, Document } from '@/lib/db/schema'; import { ChatbotError, type ErrorCode } from './errors'; import type { ChatMe...
diplomarbeit-ideen
lib/utils.ts
TypeScript
0e6f2d0373d510f6418f6d77419a5e390419382c9e22d16b0f794645934836ef
0
615
import type { UserType } from "@/app/(auth)/auth"; type Entitlements = { maxMessagesPerHour: number; }; export const entitlementsByUserType: Record<UserType, Entitlements> = { guest: { maxMessagesPerHour: 10, }, regular: { maxMessagesPerHour: 10, }, };
diplomarbeit-ideen
lib/ai/entitlements.ts
TypeScript
760c3ff5da450ab1befef001c2c9b3eb7cb7c1a965ba54c456da4b2d27edc936
0
60
import type { LanguageModel } from "ai"; const mockResponses: Record<string, string> = { default: "This is a mock response for testing.", weather: "The weather in San Francisco is sunny and 72°F.", greeting: "Hello! How can I help you today?", }; const mockUsage = { inputTokens: { total: 10, noCache: 10, cach...
diplomarbeit-ideen
lib/ai/models.mock.ts
TypeScript
f801549048655867dcb67bd52d564f1c4222346604f9d180881aad68c6f624d8
0
819
import type { LanguageModelV3GenerateResult } from "@ai-sdk/provider"; import { simulateReadableStream } from "ai"; import { MockLanguageModelV3 } from "ai/test"; import { getResponseChunksByPrompt } from "@/tests/prompts/utils"; const mockUsage = { inputTokens: { total: 10, noCache: 10, cacheRead: 0, cacheWrite: 0 ...
diplomarbeit-ideen
lib/ai/models.test.ts
TypeScript
b52f12406d0cbb1f8b1645e72d9c627e2e564c5d4cd9019dcf5a89350118a3f6
0
433
export const DIRECT_GEMINI_CHAT_MODEL = "gemini-3.5-flash"; export const GATEWAY_GEMINI_CHAT_MODEL = "google/gemini-3.5-flash"; export const GATEWAY_SONNET_CHAT_MODEL = "anthropic/claude-sonnet-5"; export const DEFAULT_CHAT_MODEL = DIRECT_GEMINI_CHAT_MODEL; export type ModelCapabilities = { tools: boolean; vision...
diplomarbeit-ideen
lib/ai/models.ts
TypeScript
baf0f283f983a56a5d17ffdff4ee3f3b73e2e6c1b95275173655a12f1b618cef
0
896
ModelCapabilities; }; export function getAllGatewayModels(): GatewayModelWithCapabilities[] { return gatewayChatModels; } export function getAllowedModelIds(env: GatewayEnv = process.env) { return new Set(getActiveModels(env).map((model) => model.id)); } export function isAllowedChatModelId( modelId: string, ...
diplomarbeit-ideen
lib/ai/models.ts
TypeScript
1a8f1bc0c582a7fc3ea26f8acdbb600202256fe9b8c3d0a656ef362ebeb22491
1
896
providerComparison || a.name.localeCompare(b.name); }), ]); } export function getCapabilitiesForModels( models: ChatModel[] ): Record<string, ModelCapabilities> { return Object.fromEntries( models.map((model) => [model.id, model.capabilities]) ); } export function isFallbackGatewayModelId(modelId: s...
diplomarbeit-ideen
lib/ai/models.ts
TypeScript
3f0e682417db88d14008d1c96b5cf0a0feb7ff7c4d97e9e839299d682378b5bc
2
86
import type { Geo } from "@vercel/functions"; import type { ArtifactKind } from "@/components/chat/artifact"; export const artifactsPrompt = ` Artifacts is a side panel that displays content alongside the conversation. It supports scripts (code), documents (text), spreadsheets, and thesis proposals. Changes appear in ...
diplomarbeit-ideen
lib/ai/prompts.ts
TypeScript
b917869fd2f224d293fa34e2e0935235f25b66797e09e469e14be0966caa3e1e
0
896
from tool evidence. Surface gaps or uncertainty when retrieval is thin. Keep responses concise and direct. When asked to write, create, or build something, do it immediately. Do not ask clarifying questions unless critical information is missing; make reasonable assumptions and proceed.`; export type RequestHints = { ...
diplomarbeit-ideen
lib/ai/prompts.ts
TypeScript
4bb1f5137031484ec11eea5380b778fd34dd8a1e90d37d6161adb65c839be8db
1
580
import { createGoogleGenerativeAI } from "@ai-sdk/google"; import { customProvider, gateway } from "ai"; import { isTestEnvironment } from "../constants"; import { isGatewayModelId, titleModel } from "./models"; export const myProvider = isTestEnvironment ? (() => { const { chatModel, titleModel } = require("....
diplomarbeit-ideen
lib/ai/providers.ts
TypeScript
5a30d12c19ff07a7ee95a46fa3da0126a0e28d052e861679dd103a38e82af3ba
0
227
import { tool, type UIMessageStreamWriter } from "ai"; import type { Session } from "next-auth"; import { z } from "zod"; import { artifactKinds, documentHandlersByArtifactKind, } from "@/lib/artifacts/server"; import type { ChatMessage } from "@/lib/types"; import { generateUUID } from "@/lib/utils"; type CreateD...
diplomarbeit-ideen
lib/ai/tools/create-document.ts
TypeScript
71310540cb7419ca6c6068e38a2a28a3598cabe89bdc320f09d68d4c60c7ff94
0
519
import { tool, type UIMessageStreamWriter } from "ai"; import type { Session } from "next-auth"; import { z } from "zod"; import { getDocumentById, saveDocument } from "@/lib/db/queries"; import type { ChatMessage } from "@/lib/types"; type EditDocumentProps = { session: Session; dataStream: UIMessageStreamWriter<...
diplomarbeit-ideen
lib/ai/tools/edit-document.ts
TypeScript
e3868c08b59182d404154d6381903ba7019df8d939261d776f5690f2fb01ce4b
0
626
import { tool } from "ai"; import { z } from "zod"; async function geocodeCity( city: string ): Promise<{ latitude: number; longitude: number } | null> { try { const response = await fetch( `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(city)}&count=1&language=en&format=json` ...
diplomarbeit-ideen
lib/ai/tools/get-weather.ts
TypeScript
6fe3bdc38c025d0056f86c21a2e8c80c78895db88e92975db2074df15c7f8495
0
514
import { tool } from "ai"; import { z } from "zod"; import { getThesisContextRecords, searchPriorWorkRecords, summarizeRetrievalResults, } from "@/lib/retrieval/service"; const documentTypeSchema = z.enum([ "thesis", "report", "planning", "proposal", "presentation", "poster", "idea", "pdf-other",...
diplomarbeit-ideen
lib/ai/tools/prior-work.ts
TypeScript
222f44afdff628215a38abc2cc077c42cc18d177c95db082dddd09cc84169d96
0
896
results), evidence: summarizeRetrievalResults(results), }; }, }); export const findThesisExtensions = tool({ description: "Find cited extension opportunities by searching future-work, risks, limitations, methodology, and related-work evidence for a selected thesis/project. Use returned excerpts and s...
diplomarbeit-ideen
lib/ai/tools/prior-work.ts
TypeScript
2395070633274b21463c855f792128ebc419c4342f503cf3f038a815059d14a8
1
298
import { Output, streamText, tool, type UIMessageStreamWriter } from "ai"; import type { Session } from "next-auth"; import { z } from "zod"; import { getDocumentById, saveSuggestions } from "@/lib/db/queries"; import type { Suggestion } from "@/lib/db/schema"; import type { ChatMessage } from "@/lib/types"; import { g...
diplomarbeit-ideen
lib/ai/tools/request-suggestions.ts
TypeScript
fd24ae169998ed666eca154c329064eae080bf35e5642944806778303785d6b0
0
718
import { tool, type UIMessageStreamWriter } from "ai"; import type { Session } from "next-auth"; import { z } from "zod"; import { documentHandlersByArtifactKind } from "@/lib/artifacts/server"; import { getDocumentById } from "@/lib/db/queries"; import type { ChatMessage } from "@/lib/types"; type UpdateDocumentProps...
diplomarbeit-ideen
lib/ai/tools/update-document.ts
TypeScript
07511d955024b81ec932fefd39014449855d2fc23d89aac4db99e7cef28c2baa
0
452
import type { UIMessageStreamWriter } from "ai"; import type { Session } from "next-auth"; import { codeDocumentHandler } from "@/artifacts/code/server"; import { sheetDocumentHandler } from "@/artifacts/sheet/server"; import { textDocumentHandler } from "@/artifacts/text/server"; import { thesisProposalDocumentHandler...
diplomarbeit-ideen
lib/artifacts/server.ts
TypeScript
2964f56d2c8fb5c9a45904c170186c313a4442aaba5c3b731f612e6137b1aedf
0
606
import { existsSync } from "node:fs"; import { config } from "dotenv"; import { drizzle } from "drizzle-orm/postgres-js"; import { migrate } from "drizzle-orm/postgres-js/migrator"; import postgres from "postgres"; config({ path: existsSync(".env.local") ? ".env.local" : ".env", }); const runMigrate = async () => {...
diplomarbeit-ideen
lib/db/migrate.ts
TypeScript
ea23f26c16238ff3d51210554156b9a505959ca51210afaeb264708929d3b548
0
274
import "server-only"; import { and, asc, count, desc, eq, gt, gte, inArray, lt, type SQL, } from "drizzle-orm"; import { drizzle } from "drizzle-orm/postgres-js"; import postgres from "postgres"; import type { ArtifactKind } from "@/components/chat/artifact"; import type { VisibilityType } from "@/...
diplomarbeit-ideen
lib/db/queries.ts
TypeScript
c5e8d7c83c1e26d0f5dd0c96ce681f6153dc6628c26b998af49e54a7269babfd
0
896
returning(); return { deletedCount: deletedChats.length }; } catch (_error) { throw new ChatbotError( "bad_request:database", "Failed to delete all chats by user id" ); } } export async function getChatsByUserId({ id, limit, startingAfter, endingBefore, }: { id: string; limit: ...
diplomarbeit-ideen
lib/db/queries.ts
TypeScript
99044dfa349238f850921cf313f9cf7720ddbaa85b2dd18eb3161acd9101c857
1
896
eq(vote.messageId, messageId), eq(vote.chatId, chatId))); } return await db.insert(vote).values({ chatId, messageId, isUpvoted: type === "up", }); } catch (_error) { throw new ChatbotError("bad_request:database", "Failed to vote message"); } } export async function getVotesByChatI...
diplomarbeit-ideen
lib/db/queries.ts
TypeScript
c3e833787b902b8f16f8ca98995648a9bdd28f4a4e614b9eae22a25fdee1237e
2
896
where(eq(suggestion.documentId, documentId)); } catch (_error) { throw new ChatbotError( "bad_request:database", "Failed to get suggestions by document id" ); } } export async function getMessageById({ id }: { id: string }) { try { return await db.select().from(message).where(eq(message.i...
diplomarbeit-ideen
lib/db/queries.ts
TypeScript
f9a6995c670744b5ef0d9555020d5bc5706a2cece5fa7d8b387272cf8e9772a9
3
818
import type { InferSelectModel } from "drizzle-orm"; import { boolean, foreignKey, json, pgTable, primaryKey, text, timestamp, uuid, varchar, } from "drizzle-orm/pg-core"; export const user = pgTable("User", { id: uuid("id").primaryKey().notNull().defaultRandom(), email: varchar("email", { length...
diplomarbeit-ideen
lib/db/schema.ts
TypeScript
37ea184e06c19ad219dee9184aedd54aa5824374d83eb2942ec6e6410fa6105f
0
896
, description: text("description"), isResolved: boolean("isResolved").notNull().default(false), userId: uuid("userId") .notNull() .references(() => user.id), createdAt: timestamp("createdAt").notNull(), }, (table) => ({ pk: primaryKey({ columns: [table.id] }), documentRef: foreig...
diplomarbeit-ideen
lib/db/schema.ts
TypeScript
2da639d9e52c04855773d108283536bd53f8d809eedbdfb90413fd960364d01c
1
251
CREATE TABLE IF NOT EXISTS "User" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "email" varchar(64) NOT NULL, "password" varchar(64), "name" text, "emailVerified" boolean NOT NULL DEFAULT false, "image" text, "isAnonymous" boolean NOT NULL DEFAULT false, "createdAt" timestamp DEFAULT now()...
diplomarbeit-ideen
lib/db/migrations/0000_initial.sql
SQL
e4fae1018fc8f510c293e7d1ea0bc9006f7d4f95f6715a7f015c121bd0051825
0
541
{ "version": "7", "dialect": "postgresql", "entries": [ { "idx": 0, "version": "7", "when": 1710000000000, "tag": "0000_initial", "breakpoints": true } ] }
diplomarbeit-ideen
lib/db/migrations/meta/_journal.json
JSON
cfb75f5254b77d9d501a4eaddcf03127505f2525c2ea55be7b8763f7f47ea1c0
0
60
"use client"; import { defaultMarkdownSerializer } from "prosemirror-markdown"; import { DOMParser, type Node } from "prosemirror-model"; import { Decoration, DecorationSet, type EditorView } from "prosemirror-view"; import { renderToString } from "react-dom/server"; import { MessageResponse } from "@/components/ai-e...
diplomarbeit-ideen
lib/editor/functions.tsx
TypeScript
d91785e69418a10947ac318ca8b21cf4ee0fcb5ff917521471b999b6c73b178f
0
297
import { createRoot } from "react-dom/client"; export function renderReactComponent( component: React.ReactElement, dom: HTMLElement ) { const root = createRoot(dom); root.render(component); return { destroy: () => root.unmount(), }; }
diplomarbeit-ideen
lib/editor/react-renderer.tsx
TypeScript
b64ff4c943c8763e118c2446689c501cac0955d7423eb828ceec9cf26e1c6aa6
0
60
import type { Node } from "prosemirror-model"; import { Plugin, PluginKey } from "prosemirror-state"; import { DecorationSet } from "prosemirror-view"; import type { Suggestion } from "@/lib/db/schema"; export interface UISuggestion extends Suggestion { selectionStart: number; selectionEnd: number; } type Positio...
diplomarbeit-ideen
lib/editor/suggestions.tsx
TypeScript
45cb4393553106a14057d9d110b1845b9339876d2366aa04f27eb32a895769b9
0
480
import { z } from "zod"; export const geminiEmbeddingModels = [ "gemini-embedding-2-preview", "gemini-embedding-001", ] as const; export const geminiChatModels = ["gemini-3.5-flash"] as const; export const gatewayChatModels = [ "anthropic/claude-sonnet-5", "google/gemini-3.5-flash", ] as const; export const...
diplomarbeit-ideen
lib/env/project.ts
TypeScript
99cf2b03837f1a23edd67e02a8e0e56ab469f479dc35bba9103fef48e53c460d
0
896
postgres://user:password@localhost:5432/thesis_ideas"; case "REDIS_URL": return "redis://localhost:6379"; case "QDRANT_URL": return "https://example.qdrant.tech"; case "QDRANT_COLLECTION": return projectEnvDefaults.QDRANT_COLLECTION; case "GEMINI_CHAT_MODEL": return projectEnvDef...
diplomarbeit-ideen
lib/env/project.ts
TypeScript
3b41d1f89f0d0b5b0465fe7b7c405157496e7528089fd5bb550579700982d12d
1
584
export type ProposalQualityItem = { id: string; label: string; passed: boolean; weight: number; detail: string; }; export type ProposalQualityReport = { score: number; passed: boolean; threshold: number; items: ProposalQualityItem[]; missingSections: string[]; citationCount: number; sourcePathC...
diplomarbeit-ideen
lib/quality/idea-quality.ts
TypeScript
8a5dddb5fd4cca627e00d8994cf07352681b586bb4a33bc0fe0a6ec5dd675ace
0
896
, detail: passed ? "Section present." : "Missing required section.", }; } ); const citations = uniqueMatches(content, citationPattern); const sourcePaths = uniqueMatches(content, sourcePathPattern); const evidenceItem: ProposalQualityItem = { id: "cited-evidence", label: "Cited evide...
diplomarbeit-ideen
lib/quality/idea-quality.ts
TypeScript
2aaac96ebae27f1c2179fcd48ab934e88bccb87f45e736ec11295e0deef77e7d
1
482
import { stableUuid } from "./ids"; import type { CorpusChunk, ExtractedCorpusDocument, ExtractedCorpusPage, } from "./types"; export type ChunkingOptions = { primaryMaxChars?: number; supportingMaxChars?: number; pageOverlap?: number; }; const primaryDocumentTypes = new Set(["thesis", "report", "planning...
diplomarbeit-ideen
lib/retrieval/chunking.ts
TypeScript
710bc936c5c2beca555413b9b7a627a495a9512eb69007351d7e32af5f63cc3b
0
896
= 0 || !currentText.trim()) { return; } const firstPage = pageNumber(currentPages[0]); const lastPageSource = currentPages.at(-1); const lastPage = lastPageSource ? pageNumber(lastPageSource) : firstPage; for (const piece of splitLongText(currentText.trim(), maxChars)) { chunks.push( ...
diplomarbeit-ideen
lib/retrieval/chunking.ts
TypeScript
8167c2c4af8cc46ac43cb50cc1a9b5121d6882ef31b57092acec62a0f6b0d9a4
1
268
import { mkdir, readFile, writeFile } from "node:fs/promises"; import path from "node:path"; import type { CorpusChunk, ExtractedCorpusDocument } from "./types"; export async function readJsonLines<T>(filePath: string): Promise<T[]> { const raw = await readFile(filePath, "utf8"); return raw .split(/\r?\n/) ...
diplomarbeit-ideen
lib/retrieval/corpus-io.ts
TypeScript
e6cc303478299d4bc306a06a46bd075709fe6b1ae774d9326e045cf6e2baea1d
0
266
import type { GeminiEmbeddingModel } from "../env/project"; import { projectEnvDefaults } from "../env/project"; import type { DenseVector } from "./types"; export type EmbeddingProvider = { embedTexts(texts: string[]): Promise<DenseVector[]>; }; export type GeminiEmbeddingProviderOptions = { apiKey: string; m...
diplomarbeit-ideen
lib/retrieval/embeddings.ts
TypeScript
57fab445f1ffc06de2e67f9af9be58eda13e9fb940ee0b5794b80e22646f48db
0
737
import { createHash } from "node:crypto"; export function stableUuid(input: string): string { const bytes = Buffer.from( createHash("sha256").update(input).digest("hex").slice(0, 32), "hex" ); bytes[6] = (bytes[6] & 0x0f) | 0x50; bytes[8] = (bytes[8] & 0x3f) | 0x80; const hex = bytes.toString("hex"...
diplomarbeit-ideen
lib/retrieval/ids.ts
TypeScript
f45c2f073baa845896a43d62360be11ff9775fb766438842dca3cdd8b3a0e68f
0
213