diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index 38337eb..8841a4d 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -1,9 +1,5 @@ import { openai } from "@ai-sdk/openai"; -import { - streamText, - convertToModelMessages, - type UIMessage, -} from "ai"; +import { streamText, convertToModelMessages, type UIMessage } from "ai"; export async function POST(req: Request) { const { messages }: { messages: UIMessage[] } = await req.json(); diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..f68ba80 --- /dev/null +++ b/biome.json @@ -0,0 +1,153 @@ +{ + "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true + }, + "formatter": { + "enabled": true, + "formatWithErrors": false, + "indentStyle": "space", + "indentWidth": 2, + "lineWidth": 80, + "lineEnding": "lf" + }, + "assist": { + "enabled": false + }, + "linter": { + "enabled": true, + "domains": { + "react": "all", + "next": "all" + }, + "rules": { + "recommended": true, + "suspicious": { + "noExplicitAny": "off", + "noArrayIndexKey": "off", + "noEmptyInterface": "off", + "useIterableCallbackReturn": "off", + "noThenProperty": "off", + "noConfusingVoidType": "off", + "noImplicitAnyLet": "off", + "noAssignInExpressions": "off", + "noRedeclare": "off", + "noConfusingLabels": { + "level": "error", + "options": { + "allowedLabels": ["DEV"] + } + }, + "noDoubleEquals": "off", + "noPrototypeBuiltins": "off", + "noDocumentCookie": "off" + }, + "style": { + "noNamespace": "off", + "useImportType": "off", + "noNonNullAssertion": "off", + "useComponentExportOnlyModules": "off" + }, + "correctness": { + "noUnusedVariables": { + "level": "warn", + "options": { + "ignoreRestSiblings": true + } + }, + "useExhaustiveDependencies": "off", + "useHookAtTopLevel": "off", + "noSwitchDeclarations": "off", + "noUnsafeOptionalChaining": "off", + "useUniqueElementIds": "off" + }, + "complexity": { + "noForEach": "off", + "noBannedTypes": "off", + "noUselessConstructor": "off", + "noStaticOnlyClass": "off", + "useArrowFunction": "off", + "noThisInStatic": "off", + "useFlatMap": "off", + "useLiteralKeys": "off" + }, + "a11y": { + "useKeyWithClickEvents": "off", + "noSvgWithoutTitle": "off", + "noStaticElementInteractions": "off", + "useFocusableInteractive": "off", + "useButtonType": "off", + "useSemanticElements": "off" + }, + "security": { + "noDangerouslySetInnerHtml": "off" + }, + "performance": { + "noImgElement": "off" + }, + "nursery": { + "useSortedClasses": { + "fix": "safe", + "level": "error", + "options": { + "attributes": ["className"], + "functions": ["clsx", "cva", "tw", "twMerge", "cn", "twJoin", "tv"] + } + } + } + } + }, + "javascript": { + "formatter": { + "enabled": true, + "quoteStyle": "double", + "jsxQuoteStyle": "double", + "quoteProperties": "asNeeded", + "trailingCommas": "all", + "semicolons": "always", + "arrowParentheses": "always", + "bracketSpacing": true, + "bracketSameLine": false, + "attributePosition": "auto" + }, + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + }, + "json": { + "formatter": { + "enabled": true, + "trailingCommas": "none" + }, + "parser": { + "allowComments": true, + "allowTrailingCommas": false + } + }, + "css": { + "parser": { + "cssModules": false, + "tailwindDirectives": true + }, + "formatter": { + "enabled": false + }, + "linter": { + "enabled": false + } + }, + "files": { + "includes": [ + "**", + "!**/dist", + "!**/node_modules", + "!**/.next", + "!**/.vercel", + "!**/out", + "!**/.source", + "!**/next-env.d.ts" + ] + } +} diff --git a/components/assistant-ui/attachment.tsx b/components/assistant-ui/attachment.tsx index 4f513e4..7bf0b37 100644 --- a/components/assistant-ui/attachment.tsx +++ b/components/assistant-ui/attachment.tsx @@ -97,7 +97,7 @@ const AttachmentPreviewDialog: FC = ({ children }) => { > {children} - + Image Attachment Preview @@ -190,7 +190,7 @@ const AttachmentRemove: FC = () => { @@ -225,7 +225,7 @@ export const ComposerAddAttachment: FC = () => { side="bottom" variant="ghost" size="icon" - className="aui-composer-add-attachment size-[34px] rounded-full p-1 text-xs font-semibold hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30" + className="aui-composer-add-attachment size-[34px] rounded-full p-1 font-semibold text-xs hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30" aria-label="Add Attachment" > diff --git a/components/assistant-ui/markdown-text.tsx b/components/assistant-ui/markdown-text.tsx index 5f3ee56..676f3d0 100644 --- a/components/assistant-ui/markdown-text.tsx +++ b/components/assistant-ui/markdown-text.tsx @@ -35,7 +35,7 @@ const CodeHeader: FC = ({ language, code }) => { }; return ( -
+
{language} @@ -70,7 +70,7 @@ const defaultComponents = memoizeMarkdownComponents({ h1: ({ className, ...props }) => (

(

(

(

(

(
 = ({ className }) => (
     className={cn(
       "aui-reasoning-fade pointer-events-none absolute inset-x-0 bottom-0 z-10 h-16",
       "bg-[linear-gradient(to_top,var(--color-background),transparent)]",
-      "animate-in fade-in-0",
+      "fade-in-0 animate-in",
       "group-data-[state=open]/collapsible-content:animate-out",
       "group-data-[state=open]/collapsible-content:fade-out-0",
       "group-data-[state=open]/collapsible-content:delay-[calc(var(--animation-duration)*0.75)]", // calc for timing the delay
@@ -102,7 +102,7 @@ const ReasoningTrigger: FC<{ active: boolean; className?: string }> = ({
 }) => (
   
@@ -147,7 +147,7 @@ const ReasoningContent: FC<
 > = ({ className, children, "aria-busy": ariaBusy }) => (
    {
 
 const ThreadListItem: FC = () => {
   return (
-    
+    
       
         
       
diff --git a/components/assistant-ui/thread.tsx b/components/assistant-ui/thread.tsx
index 18843cd..09ea3cc 100644
--- a/components/assistant-ui/thread.tsx
+++ b/components/assistant-ui/thread.tsx
@@ -77,7 +77,7 @@ const ThreadScrollToBottom: FC = () => {
       
         
       
@@ -94,7 +94,7 @@ const ThreadWelcome: FC = () => {
             initial={{ opacity: 0, y: 10 }}
             animate={{ opacity: 1, y: 0 }}
             exit={{ opacity: 0, y: 10 }}
-            className="aui-thread-welcome-message-motion-1 text-2xl font-semibold"
+            className="aui-thread-welcome-message-motion-1 font-semibold text-2xl"
           >
             Hello there!
           
@@ -116,7 +116,7 @@ const ThreadWelcome: FC = () => {
 
 const ThreadSuggestions: FC = () => {
   return (
-    
+
{[ { title: "What's the weather", @@ -145,7 +145,7 @@ const ThreadSuggestions: FC = () => { exit={{ opacity: 0, y: 20 }} transition={{ delay: 0.05 * index }} key={`suggested-action-${suggestedAction.title}-${index}`} - className="aui-thread-welcome-suggestion-display [&:nth-child(n+3)]:hidden @md:[&:nth-child(n+3)]:block" + className="aui-thread-welcome-suggestion-display @md:[&:nth-child(n+3)]:block [&:nth-child(n+3)]:hidden" > { >