From 637a8eef62738148db94c1fa60a5ae06bbf660a1 Mon Sep 17 00:00:00 2001 From: Chulki Lee Date: Mon, 3 Feb 2025 11:06:04 -0800 Subject: [PATCH 1/2] fix lint script - fail on biome lint error --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 67d93e486..5fac0e9f5 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "dev": "next dev --turbo", "build": "tsx lib/db/migrate && next build", "start": "next start", - "lint": "next lint && biome lint --write --unsafe", + "lint": "next lint && biome lint --unsafe", "lint:fix": "next lint --fix && biome lint --write --unsafe", "format": "biome format --write", "db:generate": "drizzle-kit generate", From 2cadc9447eb532db22238a1e7d425537cb83b9c5 Mon Sep 17 00:00:00 2001 From: Chulki Lee Date: Wed, 5 Feb 2025 14:48:45 -0800 Subject: [PATCH 2/2] lint:fix --- app/(chat)/actions.ts | 4 ++-- app/(chat)/api/document/route.ts | 2 +- blocks/code/client.tsx | 4 ++-- blocks/text/client.tsx | 5 ++--- components/block-actions.tsx | 6 ++--- components/block-messages.tsx | 6 ++--- components/chat-header.tsx | 2 +- components/chat.tsx | 2 +- components/code-block.tsx | 6 +---- components/code-editor.tsx | 2 +- components/console.tsx | 4 ++-- components/create-block.tsx | 10 ++++----- components/data-stream-handler.tsx | 4 ++-- components/document-preview.tsx | 6 ++--- components/document-skeleton.tsx | 2 +- components/icons.tsx | 34 ++++++++++++++--------------- components/message-editor.tsx | 5 ++--- components/message.tsx | 4 +--- components/messages.tsx | 4 ++-- components/sidebar-history.tsx | 1 - components/suggested-actions.tsx | 2 +- components/suggestion.tsx | 2 +- components/toolbar.tsx | 13 ++++------- components/ui/sidebar.tsx | 2 +- components/version-footer.tsx | 2 -- components/visibility-selector.tsx | 2 +- hooks/use-block.ts | 2 +- hooks/use-chat-visibility.ts | 4 ++-- lib/ai/prompts.ts | 2 +- lib/ai/tools/create-document.ts | 4 ++-- lib/ai/tools/request-suggestions.ts | 6 ++--- lib/ai/tools/update-document.ts | 6 ++--- lib/blocks/server.ts | 8 +++---- lib/db/queries.ts | 2 +- lib/editor/suggestions.tsx | 2 +- lib/utils.ts | 2 -- 36 files changed, 78 insertions(+), 96 deletions(-) diff --git a/app/(chat)/actions.ts b/app/(chat)/actions.ts index c5599343d..3b85607da 100644 --- a/app/(chat)/actions.ts +++ b/app/(chat)/actions.ts @@ -1,6 +1,6 @@ 'use server'; -import { generateText, Message } from 'ai'; +import { generateText, type Message } from 'ai'; import { cookies } from 'next/headers'; import { @@ -8,7 +8,7 @@ import { getMessageById, updateChatVisiblityById, } from '@/lib/db/queries'; -import { VisibilityType } from '@/components/visibility-selector'; +import type { VisibilityType } from '@/components/visibility-selector'; import { myProvider } from '@/lib/ai/models'; export async function saveChatModelAsCookie(model: string) { diff --git a/app/(chat)/api/document/route.ts b/app/(chat)/api/document/route.ts index 5c8431201..86f9c304c 100644 --- a/app/(chat)/api/document/route.ts +++ b/app/(chat)/api/document/route.ts @@ -1,5 +1,5 @@ import { auth } from '@/app/(auth)/auth'; -import { BlockKind } from '@/components/block'; +import type { BlockKind } from '@/components/block'; import { deleteDocumentsByIdAfterTimestamp, getDocumentsById, diff --git a/blocks/code/client.tsx b/blocks/code/client.tsx index ca285c15d..efdfe07e0 100644 --- a/blocks/code/client.tsx +++ b/blocks/code/client.tsx @@ -12,8 +12,8 @@ import { toast } from 'sonner'; import { generateUUID } from '@/lib/utils'; import { Console, - ConsoleOutput, - ConsoleOutputContent, + type ConsoleOutput, + type ConsoleOutputContent, } from '@/components/console'; const OUTPUT_HANDLERS = { diff --git a/blocks/text/client.tsx b/blocks/text/client.tsx index 360bb5160..713e4b87e 100644 --- a/blocks/text/client.tsx +++ b/blocks/text/client.tsx @@ -10,7 +10,7 @@ import { RedoIcon, UndoIcon, } from '@/components/icons'; -import { Suggestion } from '@/lib/db/schema'; +import type { Suggestion } from '@/lib/db/schema'; import { toast } from 'sonner'; import { getSuggestions } from '../actions'; @@ -90,8 +90,7 @@ export const textBlock = new Block<'text', TextBlockMetadata>({ onSaveContent={onSaveContent} /> - {metadata && - metadata.suggestions && + {metadata?.suggestions && metadata.suggestions.length > 0 ? (
) : null} diff --git a/components/block-actions.tsx b/components/block-actions.tsx index 47bf1c377..7854945f8 100644 --- a/components/block-actions.tsx +++ b/components/block-actions.tsx @@ -1,8 +1,8 @@ import { Button } from './ui/button'; import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'; -import { blockDefinitions, UIBlock } from './block'; -import { Dispatch, memo, SetStateAction, useState } from 'react'; -import { BlockActionContext } from './create-block'; +import { blockDefinitions, type UIBlock } from './block'; +import { type Dispatch, memo, type SetStateAction, useState } from 'react'; +import type { BlockActionContext } from './create-block'; import { cn } from '@/lib/utils'; import { toast } from 'sonner'; diff --git a/components/block-messages.tsx b/components/block-messages.tsx index 1e8687928..1b34a19ae 100644 --- a/components/block-messages.tsx +++ b/components/block-messages.tsx @@ -1,10 +1,10 @@ import { PreviewMessage } from './message'; import { useScrollToBottom } from './use-scroll-to-bottom'; -import { Vote } from '@/lib/db/schema'; -import { ChatRequestOptions, Message } from 'ai'; +import type { Vote } from '@/lib/db/schema'; +import type { ChatRequestOptions, Message } from 'ai'; import { memo } from 'react'; import equal from 'fast-deep-equal'; -import { UIBlock } from './block'; +import type { UIBlock } from './block'; interface BlockMessagesProps { chatId: string; diff --git a/components/chat-header.tsx b/components/chat-header.tsx index 8a4d69e98..429222bf9 100644 --- a/components/chat-header.tsx +++ b/components/chat-header.tsx @@ -11,7 +11,7 @@ import { PlusIcon, VercelIcon } from './icons'; import { useSidebar } from './ui/sidebar'; import { memo } from 'react'; import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'; -import { VisibilityType, VisibilitySelector } from './visibility-selector'; +import { type VisibilityType, VisibilitySelector } from './visibility-selector'; function PureChatHeader({ chatId, diff --git a/components/chat.tsx b/components/chat.tsx index 6911e66b3..8eb3ba16c 100644 --- a/components/chat.tsx +++ b/components/chat.tsx @@ -12,7 +12,7 @@ import { fetcher, generateUUID } from '@/lib/utils'; import { Block } from './block'; import { MultimodalInput } from './multimodal-input'; import { Messages } from './messages'; -import { VisibilityType } from './visibility-selector'; +import type { VisibilityType } from './visibility-selector'; import { useBlockSelector } from '@/hooks/use-block'; import { toast } from 'sonner'; diff --git a/components/code-block.tsx b/components/code-block.tsx index d627da25d..70a3d20de 100644 --- a/components/code-block.tsx +++ b/components/code-block.tsx @@ -1,10 +1,6 @@ 'use client'; -import { useCallback, useState } from 'react'; -import { CodeIcon, LoaderIcon, PlayIcon, PythonIcon } from './icons'; -import { Button } from './ui/button'; -import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'; -import { cn } from '@/lib/utils'; +import { useState } from 'react'; interface CodeBlockProps { node: any; diff --git a/components/code-editor.tsx b/components/code-editor.tsx index ab81e1390..325e5db05 100644 --- a/components/code-editor.tsx +++ b/components/code-editor.tsx @@ -6,7 +6,7 @@ import { python } from '@codemirror/lang-python'; import { oneDark } from '@codemirror/theme-one-dark'; import { basicSetup } from 'codemirror'; import React, { memo, useEffect, useRef } from 'react'; -import { Suggestion } from '@/lib/db/schema'; +import type { Suggestion } from '@/lib/db/schema'; type EditorProps = { content: string; diff --git a/components/console.tsx b/components/console.tsx index 64f9baf15..be0e96dea 100644 --- a/components/console.tsx +++ b/components/console.tsx @@ -1,8 +1,8 @@ import { TerminalWindowIcon, LoaderIcon, CrossSmallIcon } from './icons'; import { Button } from './ui/button'; import { - Dispatch, - SetStateAction, + type Dispatch, + type SetStateAction, useCallback, useEffect, useRef, diff --git a/components/create-block.tsx b/components/create-block.tsx index b0e7d79c7..f6ed513b5 100644 --- a/components/create-block.tsx +++ b/components/create-block.tsx @@ -1,8 +1,8 @@ -import { Suggestion } from '@/lib/db/schema'; -import { UseChatHelpers } from 'ai/react'; -import { ComponentType, Dispatch, ReactNode, SetStateAction } from 'react'; -import { DataStreamDelta } from './data-stream-handler'; -import { UIBlock } from './block'; +import type { Suggestion } from '@/lib/db/schema'; +import type { UseChatHelpers } from 'ai/react'; +import type { ComponentType, Dispatch, ReactNode, SetStateAction } from 'react'; +import type { DataStreamDelta } from './data-stream-handler'; +import type { UIBlock } from './block'; export type BlockActionContext = { content: string; diff --git a/components/data-stream-handler.tsx b/components/data-stream-handler.tsx index d46c84d3a..77c460723 100644 --- a/components/data-stream-handler.tsx +++ b/components/data-stream-handler.tsx @@ -2,8 +2,8 @@ import { useChat } from 'ai/react'; import { useEffect, useRef } from 'react'; -import { blockDefinitions, BlockKind } from './block'; -import { Suggestion } from '@/lib/db/schema'; +import { blockDefinitions, type BlockKind } from './block'; +import type { Suggestion } from '@/lib/db/schema'; import { initialBlockData, useBlock } from '@/hooks/use-block'; export type DataStreamDelta = { diff --git a/components/document-preview.tsx b/components/document-preview.tsx index cc9501294..9c168f5a9 100644 --- a/components/document-preview.tsx +++ b/components/document-preview.tsx @@ -2,16 +2,16 @@ import { memo, - MouseEvent, + type MouseEvent, useCallback, useEffect, useMemo, useRef, } from 'react'; -import { BlockKind, UIBlock } from './block'; +import type { BlockKind, UIBlock } from './block'; import { FileIcon, FullscreenIcon, ImageIcon, LoaderIcon } from './icons'; import { cn, fetcher } from '@/lib/utils'; -import { Document } from '@/lib/db/schema'; +import type { Document } from '@/lib/db/schema'; import { InlineDocumentSkeleton } from './document-skeleton'; import useSWR from 'swr'; import { Editor } from './editor'; diff --git a/components/document-skeleton.tsx b/components/document-skeleton.tsx index ae8ace917..a8bd7683a 100644 --- a/components/document-skeleton.tsx +++ b/components/document-skeleton.tsx @@ -1,6 +1,6 @@ 'use client'; -import { BlockKind } from './block'; +import type { BlockKind } from './block'; export const DocumentSkeleton = ({ blockKind }: { blockKind: BlockKind }) => { return blockKind === 'image' ? ( diff --git a/components/icons.tsx b/components/icons.tsx index 17aac083e..319f3d140 100644 --- a/components/icons.tsx +++ b/components/icons.tsx @@ -640,7 +640,7 @@ export const CrossSmallIcon = ({ size = 16 }: { size?: number }) => ( clipRule="evenodd" d="M9.96966 11.0303L10.5 11.5607L11.5607 10.5L11.0303 9.96966L9.06065 7.99999L11.0303 6.03032L11.5607 5.49999L10.5 4.43933L9.96966 4.96966L7.99999 6.93933L6.03032 4.96966L5.49999 4.43933L4.43933 5.49999L4.96966 6.03032L6.93933 7.99999L4.96966 9.96966L4.43933 10.5L5.49999 11.5607L6.03032 11.0303L7.99999 9.06065L9.96966 11.0303Z" fill="currentColor" - > + /> ); @@ -887,7 +887,7 @@ export const GlobeIcon = ({ size = 16 }: { size?: number }) => { clipRule="evenodd" d="M10.268 14.0934C11.9051 13.4838 13.2303 12.2333 13.9384 10.6469C13.1192 10.7941 12.2138 10.9111 11.2469 10.9925C11.0336 12.2005 10.695 13.2621 10.268 14.0934ZM8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16ZM8.48347 14.4823C8.32384 14.494 8.16262 14.5 8 14.5C7.83738 14.5 7.67616 14.494 7.51654 14.4823C7.5132 14.4791 7.50984 14.4759 7.50647 14.4726C7.2415 14.2165 6.94578 13.7854 6.67032 13.1558C6.41594 12.5744 6.19979 11.8714 6.04101 11.0778C6.67605 11.1088 7.33104 11.125 8 11.125C8.66896 11.125 9.32395 11.1088 9.95899 11.0778C9.80021 11.8714 9.58406 12.5744 9.32968 13.1558C9.05422 13.7854 8.7585 14.2165 8.49353 14.4726C8.49016 14.4759 8.4868 14.4791 8.48347 14.4823ZM11.4187 9.72246C12.5137 9.62096 13.5116 9.47245 14.3724 9.28806C14.4561 8.87172 14.5 8.44099 14.5 8C14.5 7.55901 14.4561 7.12828 14.3724 6.71194C13.5116 6.52755 12.5137 6.37904 11.4187 6.27753C11.4719 6.83232 11.5 7.40867 11.5 8C11.5 8.59133 11.4719 9.16768 11.4187 9.72246ZM10.1525 6.18401C10.2157 6.75982 10.25 7.36805 10.25 8C10.25 8.63195 10.2157 9.24018 10.1525 9.81598C9.46123 9.85455 8.7409 9.875 8 9.875C7.25909 9.875 6.53877 9.85455 5.84749 9.81598C5.7843 9.24018 5.75 8.63195 5.75 8C5.75 7.36805 5.7843 6.75982 5.84749 6.18401C6.53877 6.14545 7.25909 6.125 8 6.125C8.74091 6.125 9.46123 6.14545 10.1525 6.18401ZM11.2469 5.00748C12.2138 5.08891 13.1191 5.20593 13.9384 5.35306C13.2303 3.7667 11.9051 2.51622 10.268 1.90662C10.695 2.73788 11.0336 3.79953 11.2469 5.00748ZM8.48347 1.51771C8.4868 1.52089 8.49016 1.52411 8.49353 1.52737C8.7585 1.78353 9.05422 2.21456 9.32968 2.84417C9.58406 3.42562 9.80021 4.12856 9.95899 4.92219C9.32395 4.89118 8.66896 4.875 8 4.875C7.33104 4.875 6.67605 4.89118 6.04101 4.92219C6.19978 4.12856 6.41594 3.42562 6.67032 2.84417C6.94578 2.21456 7.2415 1.78353 7.50647 1.52737C7.50984 1.52411 7.51319 1.52089 7.51653 1.51771C7.67615 1.50597 7.83738 1.5 8 1.5C8.16262 1.5 8.32384 1.50597 8.48347 1.51771ZM5.73202 1.90663C4.0949 2.51622 2.76975 3.7667 2.06159 5.35306C2.88085 5.20593 3.78617 5.08891 4.75309 5.00748C4.96639 3.79953 5.30497 2.73788 5.73202 1.90663ZM4.58133 6.27753C3.48633 6.37904 2.48837 6.52755 1.62761 6.71194C1.54392 7.12828 1.5 7.55901 1.5 8C1.5 8.44099 1.54392 8.87172 1.62761 9.28806C2.48837 9.47245 3.48633 9.62096 4.58133 9.72246C4.52807 9.16768 4.5 8.59133 4.5 8C4.5 7.40867 4.52807 6.83232 4.58133 6.27753ZM4.75309 10.9925C3.78617 10.9111 2.88085 10.7941 2.06159 10.6469C2.76975 12.2333 4.0949 13.4838 5.73202 14.0934C5.30497 13.2621 4.96639 12.2005 4.75309 10.9925Z" fill="currentColor" - > + /> ); }; @@ -906,7 +906,7 @@ export const LockIcon = ({ size = 16 }: { size?: number }) => { clipRule="evenodd" d="M10 4.5V6H6V4.5C6 3.39543 6.89543 2.5 8 2.5C9.10457 2.5 10 3.39543 10 4.5ZM4.5 6V4.5C4.5 2.567 6.067 1 8 1C9.933 1 11.5 2.567 11.5 4.5V6H12.5H14V7.5V12.5C14 13.8807 12.8807 15 11.5 15H4.5C3.11929 15 2 13.8807 2 12.5V7.5V6H3.5H4.5ZM11.5 7.5H10H6H4.5H3.5V12.5C3.5 13.0523 3.94772 13.5 4.5 13.5H11.5C12.0523 13.5 12.5 13.0523 12.5 12.5V7.5H11.5Z" fill="currentColor" - > + /> ); }; @@ -925,7 +925,7 @@ export const EyeIcon = ({ size = 16 }: { size?: number }) => { clipRule="evenodd" d="M4.02168 4.76932C6.11619 2.33698 9.88374 2.33698 11.9783 4.76932L14.7602 7.99999L11.9783 11.2307C9.88374 13.663 6.1162 13.663 4.02168 11.2307L1.23971 7.99999L4.02168 4.76932ZM13.1149 3.79054C10.422 0.663244 5.57797 0.663247 2.88503 3.79054L-0.318359 7.5106V8.48938L2.88503 12.2094C5.57797 15.3367 10.422 15.3367 13.1149 12.2094L16.3183 8.48938V7.5106L13.1149 3.79054ZM6.49997 7.99999C6.49997 7.17157 7.17154 6.49999 7.99997 6.49999C8.82839 6.49999 9.49997 7.17157 9.49997 7.99999C9.49997 8.82842 8.82839 9.49999 7.99997 9.49999C7.17154 9.49999 6.49997 8.82842 6.49997 7.99999ZM7.99997 4.99999C6.34311 4.99999 4.99997 6.34314 4.99997 7.99999C4.99997 9.65685 6.34311 11 7.99997 11C9.65682 11 11 9.65685 11 7.99999C11 6.34314 9.65682 4.99999 7.99997 4.99999Z" fill="currentColor" - > + /> ); }; @@ -944,7 +944,7 @@ export const ShareIcon = ({ size = 16 }: { size?: number }) => { clipRule="evenodd" d="M15 11.25V10.5H13.5V11.25V12.75C13.5 13.1642 13.1642 13.5 12.75 13.5H3.25C2.83579 13.5 2.5 13.1642 2.5 12.75L2.5 3.25C2.5 2.83579 2.83579 2.5 3.25 2.5H5.75H6.5V1H5.75H3.25C2.00736 1 1 2.00736 1 3.25V12.75C1 13.9926 2.00736 15 3.25 15H12.75C13.9926 15 15 13.9926 15 12.75V11.25ZM15 5.5L10.5 1V4C7.46243 4 5 6.46243 5 9.5V10L5.05855 9.91218C6.27146 8.09281 8.31339 7 10.5 7V10L15 5.5Z" fill="currentColor" - > + /> ); }; @@ -963,7 +963,7 @@ export const CodeIcon = ({ size = 16 }: { size?: number }) => { clipRule="evenodd" d="M4.21969 12.5303L4.75002 13.0607L5.81068 12L5.28035 11.4697L1.81068 7.99999L5.28035 4.53032L5.81068 3.99999L4.75002 2.93933L4.21969 3.46966L0.39647 7.29289C0.00594562 7.68341 0.00594562 8.31658 0.39647 8.7071L4.21969 12.5303ZM11.7804 12.5303L11.25 13.0607L10.1894 12L10.7197 11.4697L14.1894 7.99999L10.7197 4.53032L10.1894 3.99999L11.25 2.93933L11.7804 3.46966L15.6036 7.29289C15.9941 7.68341 15.9941 8.31658 15.6036 8.7071L11.7804 12.5303Z" fill="currentColor" - > + /> ); }; @@ -982,7 +982,7 @@ export const PlayIcon = ({ size = 16 }: { size?: number }) => { clipRule="evenodd" d="M13.4549 7.22745L13.3229 7.16146L2.5 1.74999L2.4583 1.72914L1.80902 1.4045L1.3618 1.18089C1.19558 1.09778 1 1.21865 1 1.4045L1 1.9045L1 2.63041L1 2.67704L1 13.3229L1 13.3696L1 14.0955L1 14.5955C1 14.7813 1.19558 14.9022 1.3618 14.8191L1.80902 14.5955L2.4583 14.2708L2.5 14.25L13.3229 8.83852L13.4549 8.77253L14.2546 8.37267L14.5528 8.2236C14.737 8.13147 14.737 7.86851 14.5528 7.77638L14.2546 7.62731L13.4549 7.22745ZM11.6459 7.99999L2.5 3.42704L2.5 12.5729L11.6459 7.99999Z" fill="currentColor" - > + /> ); }; @@ -999,11 +999,11 @@ export const PythonIcon = ({ size = 16 }: { size?: number }) => { + /> + /> ); }; @@ -1022,7 +1022,7 @@ export const TerminalWindowIcon = ({ size = 16 }: { size?: number }) => { clipRule="evenodd" d="M1.5 2.5H14.5V12.5C14.5 13.0523 14.0523 13.5 13.5 13.5H2.5C1.94772 13.5 1.5 13.0523 1.5 12.5V2.5ZM0 1H1.5H14.5H16V2.5V12.5C16 13.8807 14.8807 15 13.5 15H2.5C1.11929 15 0 13.8807 0 12.5V2.5V1ZM4 11.1339L4.44194 10.6919L6.51516 8.61872C6.85687 8.27701 6.85687 7.72299 6.51517 7.38128L4.44194 5.30806L4 4.86612L3.11612 5.75L3.55806 6.19194L5.36612 8L3.55806 9.80806L3.11612 10.25L4 11.1339ZM8 9.75494H8.6225H11.75H12.3725V10.9999H11.75H8.6225H8V9.75494Z" fill="currentColor" - > + /> ); }; @@ -1041,7 +1041,7 @@ export const TerminalIcon = ({ size = 16 }: { size?: number }) => { clipRule="evenodd" d="M1.53035 12.7804L1.00002 13.3108L-0.0606384 12.2501L0.469692 11.7198L4.18936 8.00011L0.469692 4.28044L-0.0606384 3.75011L1.00002 2.68945L1.53035 3.21978L5.60358 7.29301C5.9941 7.68353 5.9941 8.3167 5.60357 8.70722L1.53035 12.7804ZM8.75002 12.5001H8.00002V14.0001H8.75002H15.25H16V12.5001H15.25H8.75002Z" fill="currentColor" - > + /> ); }; @@ -1060,7 +1060,7 @@ export const ClockRewind = ({ size = 16 }: { size?: number }) => { clipRule="evenodd" d="M7.96452 2.5C11.0257 2.5 13.5 4.96643 13.5 8C13.5 11.0336 11.0257 13.5 7.96452 13.5C6.12055 13.5 4.48831 12.6051 3.48161 11.2273L3.03915 10.6217L1.828 11.5066L2.27046 12.1122C3.54872 13.8617 5.62368 15 7.96452 15C11.8461 15 15 11.87 15 8C15 4.13001 11.8461 1 7.96452 1C5.06835 1 2.57851 2.74164 1.5 5.23347V3.75V3H0V3.75V7.25C0 7.66421 0.335786 8 0.75 8H3.75H4.5V6.5H3.75H2.63724C3.29365 4.19393 5.42843 2.5 7.96452 2.5ZM8.75 5.25V4.5H7.25V5.25V7.8662C7.25 8.20056 7.4171 8.51279 7.6953 8.69825L9.08397 9.62404L9.70801 10.0401L10.5401 8.79199L9.91603 8.37596L8.75 7.59861V5.25Z" fill="currentColor" - > + /> ); }; @@ -1079,7 +1079,7 @@ export const LogsIcon = ({ size = 16 }: { size?: number }) => { clipRule="evenodd" d="M9 2H9.75H14.25H15V3.5H14.25H9.75H9V2ZM9 12.5H9.75H14.25H15V14H14.25H9.75H9V12.5ZM9.75 7.25H9V8.75H9.75H14.25H15V7.25H14.25H9.75ZM1 12.5H1.75H2.25H3V14H2.25H1.75H1V12.5ZM1.75 2H1V3.5H1.75H2.25H3V2H2.25H1.75ZM1 7.25H1.75H2.25H3V8.75H2.25H1.75H1V7.25ZM5.75 12.5H5V14H5.75H6.25H7V12.5H6.25H5.75ZM5 2H5.75H6.25H7V3.5H6.25H5.75H5V2ZM5.75 7.25H5V8.75H5.75H6.25H7V7.25H6.25H5.75Z" fill="currentColor" - > + /> ); }; @@ -1098,7 +1098,7 @@ export const ImageIcon = ({ size = 16 }: { size?: number }) => { clipRule="evenodd" d="M14.5 2.5H1.5V9.18933L2.96966 7.71967L3.18933 7.5H3.49999H6.63001H6.93933L6.96966 7.46967L10.4697 3.96967L11.5303 3.96967L14.5 6.93934V2.5ZM8.00066 8.55999L9.53034 10.0897L10.0607 10.62L9.00001 11.6807L8.46968 11.1503L6.31935 9H3.81065L1.53032 11.2803L1.5 11.3106V12.5C1.5 13.0523 1.94772 13.5 2.5 13.5H13.5C14.0523 13.5 14.5 13.0523 14.5 12.5V9.06066L11 5.56066L8.03032 8.53033L8.00066 8.55999ZM4.05312e-06 10.8107V12.5C4.05312e-06 13.8807 1.11929 15 2.5 15H13.5C14.8807 15 16 13.8807 16 12.5V9.56066L16.5607 9L16.0303 8.46967L16 8.43934V2.5V1H14.5H1.5H4.05312e-06V2.5V10.6893L-0.0606689 10.75L4.05312e-06 10.8107Z" fill="currentColor" - > + /> ); }; @@ -1116,7 +1116,7 @@ export const FullscreenIcon = ({ size = 16 }: { size?: number }) => ( clipRule="evenodd" d="M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z" fill="currentColor" - > + /> ); @@ -1133,7 +1133,7 @@ export const DownloadIcon = ({ size = 16 }: { size?: number }) => ( clipRule="evenodd" d="M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z" fill="currentColor" - > + /> ); @@ -1150,6 +1150,6 @@ export const LineChartIcon = ({ size = 16 }: { size?: number }) => ( fillRule="evenodd" d="M1 1v11.75A2.25 2.25 0 0 0 3.25 15H15v-1.5H3.25a.75.75 0 0 1-.75-.75V1H1Zm13.297 5.013.513-.547-1.094-1.026-.513.547-3.22 3.434-2.276-2.275a1 1 0 0 0-1.414 0L4.22 8.22l-.53.53 1.06 1.06.53-.53L7 7.56l2.287 2.287a1 1 0 0 0 1.437-.023l3.573-3.811Z" clipRule="evenodd" - > + /> ); diff --git a/components/message-editor.tsx b/components/message-editor.tsx index 9e845d6e3..1f075e605 100644 --- a/components/message-editor.tsx +++ b/components/message-editor.tsx @@ -1,11 +1,10 @@ 'use client'; -import { ChatRequestOptions, Message } from 'ai'; +import type { ChatRequestOptions, Message } from 'ai'; import { Button } from './ui/button'; -import { Dispatch, SetStateAction, useEffect, useRef, useState } from 'react'; +import { type Dispatch, type SetStateAction, useEffect, useRef, useState } from 'react'; import { Textarea } from './ui/textarea'; import { deleteTrailingMessages } from '@/app/(chat)/actions'; -import { toast } from 'sonner'; export type MessageEditorProps = { message: Message; diff --git a/components/message.tsx b/components/message.tsx index d43b31be9..22f9d9504 100644 --- a/components/message.tsx +++ b/components/message.tsx @@ -3,14 +3,12 @@ import type { ChatRequestOptions, Message } from 'ai'; import cx from 'classnames'; import { AnimatePresence, motion } from 'framer-motion'; -import { memo, useMemo, useState } from 'react'; +import { memo, useState } from 'react'; import type { Vote } from '@/lib/db/schema'; import { DocumentToolCall, DocumentToolResult } from './document'; import { - ChevronDownIcon, - LoaderIcon, PencilEditIcon, SparklesIcon, } from './icons'; diff --git a/components/messages.tsx b/components/messages.tsx index 1c14b2f7c..531e8b44f 100644 --- a/components/messages.tsx +++ b/components/messages.tsx @@ -1,9 +1,9 @@ -import { ChatRequestOptions, Message } from 'ai'; +import type { ChatRequestOptions, Message } from 'ai'; import { PreviewMessage, ThinkingMessage } from './message'; import { useScrollToBottom } from './use-scroll-to-bottom'; import { Overview } from './overview'; import { memo } from 'react'; -import { Vote } from '@/lib/db/schema'; +import type { Vote } from '@/lib/db/schema'; import equal from 'fast-deep-equal'; interface MessagesProps { diff --git a/components/sidebar-history.tsx b/components/sidebar-history.tsx index 6aa18c03f..1f910f0ba 100644 --- a/components/sidebar-history.tsx +++ b/components/sidebar-history.tsx @@ -31,7 +31,6 @@ import { DropdownMenuContent, DropdownMenuItem, DropdownMenuPortal, - DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, diff --git a/components/suggested-actions.tsx b/components/suggested-actions.tsx index b2d14d63d..ff8777b00 100644 --- a/components/suggested-actions.tsx +++ b/components/suggested-actions.tsx @@ -2,7 +2,7 @@ import { motion } from 'framer-motion'; import { Button } from './ui/button'; -import { ChatRequestOptions, CreateMessage, Message } from 'ai'; +import type { ChatRequestOptions, CreateMessage, Message } from 'ai'; import { memo } from 'react'; interface SuggestedActionsProps { diff --git a/components/suggestion.tsx b/components/suggestion.tsx index e0374a56c..3e6fdbfc3 100644 --- a/components/suggestion.tsx +++ b/components/suggestion.tsx @@ -9,7 +9,7 @@ import type { UISuggestion } from '@/lib/editor/suggestions'; import { CrossIcon, MessageIcon } from './icons'; import { Button } from './ui/button'; import { cn } from '@/lib/utils'; -import { BlockKind } from './block'; +import type { BlockKind } from './block'; export const Suggestion = ({ suggestion, diff --git a/components/toolbar.tsx b/components/toolbar.tsx index ee08ad2fa..90e403891 100644 --- a/components/toolbar.tsx +++ b/components/toolbar.tsx @@ -11,7 +11,7 @@ import { import { type Dispatch, memo, - ReactNode, + type ReactNode, type SetStateAction, useEffect, useRef, @@ -29,17 +29,12 @@ import { sanitizeUIMessages } from '@/lib/utils'; import { ArrowUpIcon, - CodeIcon, - LogsIcon, - MessageIcon, - PenIcon, - SparklesIcon, StopIcon, SummarizeIcon, } from './icons'; -import { blockDefinitions, BlockKind } from './block'; -import { BlockToolbarItem } from './create-block'; -import { UseChatHelpers } from 'ai/react'; +import { blockDefinitions, type BlockKind } from './block'; +import type { BlockToolbarItem } from './create-block'; +import type { UseChatHelpers } from 'ai/react'; type ToolProps = { description: string; diff --git a/components/ui/sidebar.tsx b/components/ui/sidebar.tsx index 16e1437d6..dd0d59c08 100644 --- a/components/ui/sidebar.tsx +++ b/components/ui/sidebar.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { Slot } from '@radix-ui/react-slot'; -import { VariantProps, cva } from 'class-variance-authority'; +import { type VariantProps, cva } from 'class-variance-authority'; import { PanelLeft } from 'lucide-react'; import { useIsMobile } from '@/hooks/use-mobile'; diff --git a/components/version-footer.tsx b/components/version-footer.tsx index 0c0878647..870da00ad 100644 --- a/components/version-footer.tsx +++ b/components/version-footer.tsx @@ -8,8 +8,6 @@ import { useWindowSize } from 'usehooks-ts'; import type { Document } from '@/lib/db/schema'; import { getDocumentTimestampByIndex } from '@/lib/utils'; - -import type { UIBlock } from './block'; import { LoaderIcon } from './icons'; import { Button } from './ui/button'; import { useBlock } from '@/hooks/use-block'; diff --git a/components/visibility-selector.tsx b/components/visibility-selector.tsx index 7fd405906..aa3ce5440 100644 --- a/components/visibility-selector.tsx +++ b/components/visibility-selector.tsx @@ -1,6 +1,6 @@ 'use client'; -import { ReactNode, useMemo, useState } from 'react'; +import { type ReactNode, useMemo, useState } from 'react'; import { Button } from '@/components/ui/button'; import { DropdownMenu, diff --git a/hooks/use-block.ts b/hooks/use-block.ts index 9e6d491b2..c47f39982 100644 --- a/hooks/use-block.ts +++ b/hooks/use-block.ts @@ -1,7 +1,7 @@ 'use client'; import useSWR from 'swr'; -import { UIBlock } from '@/components/block'; +import type { UIBlock } from '@/components/block'; import { useCallback, useMemo } from 'react'; export const initialBlockData: UIBlock = { diff --git a/hooks/use-chat-visibility.ts b/hooks/use-chat-visibility.ts index d920785f8..07e8383b2 100644 --- a/hooks/use-chat-visibility.ts +++ b/hooks/use-chat-visibility.ts @@ -1,8 +1,8 @@ 'use client'; import { updateChatVisibility } from '@/app/(chat)/actions'; -import { VisibilityType } from '@/components/visibility-selector'; -import { Chat } from '@/lib/db/schema'; +import type { VisibilityType } from '@/components/visibility-selector'; +import type { Chat } from '@/lib/db/schema'; import { useMemo } from 'react'; import useSWR, { useSWRConfig } from 'swr'; diff --git a/lib/ai/prompts.ts b/lib/ai/prompts.ts index fa3e546c2..2b81bb1b9 100644 --- a/lib/ai/prompts.ts +++ b/lib/ai/prompts.ts @@ -1,4 +1,4 @@ -import { BlockKind } from '@/components/block'; +import type { BlockKind } from '@/components/block'; export const blocksPrompt = ` Blocks is a special user interface mode that helps users with writing, editing, and other content creation tasks. When block is open, it is on the right side of the screen, while the conversation is on the left side. When creating or updating documents, changes are reflected in real-time on the blocks and visible to the user. diff --git a/lib/ai/tools/create-document.ts b/lib/ai/tools/create-document.ts index 46c5434c1..a8f6d25de 100644 --- a/lib/ai/tools/create-document.ts +++ b/lib/ai/tools/create-document.ts @@ -1,7 +1,7 @@ import { generateUUID } from '@/lib/utils'; -import { DataStreamWriter, tool } from 'ai'; +import { type DataStreamWriter, tool } from 'ai'; import { z } from 'zod'; -import { Session } from 'next-auth'; +import type { Session } from 'next-auth'; import { blockKinds, documentHandlersByBlockKind } from '@/lib/blocks/server'; interface CreateDocumentProps { diff --git a/lib/ai/tools/request-suggestions.ts b/lib/ai/tools/request-suggestions.ts index 2cf9ba44b..9bb6f0eb2 100644 --- a/lib/ai/tools/request-suggestions.ts +++ b/lib/ai/tools/request-suggestions.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { Session } from 'next-auth'; -import { DataStreamWriter, streamObject, tool } from 'ai'; +import type { Session } from 'next-auth'; +import { type DataStreamWriter, streamObject, tool } from 'ai'; import { getDocumentById, saveSuggestions } from '@/lib/db/queries'; -import { Suggestion } from '@/lib/db/schema'; +import type { Suggestion } from '@/lib/db/schema'; import { generateUUID } from '@/lib/utils'; import { myProvider } from '../models'; diff --git a/lib/ai/tools/update-document.ts b/lib/ai/tools/update-document.ts index 2ba4abd45..3793664c4 100644 --- a/lib/ai/tools/update-document.ts +++ b/lib/ai/tools/update-document.ts @@ -1,7 +1,7 @@ -import { DataStreamWriter, tool } from 'ai'; -import { Session } from 'next-auth'; +import { type DataStreamWriter, tool } from 'ai'; +import type { Session } from 'next-auth'; import { z } from 'zod'; -import { getDocumentById, saveDocument } from '@/lib/db/queries'; +import { getDocumentById, } from '@/lib/db/queries'; import { documentHandlersByBlockKind } from '@/lib/blocks/server'; interface UpdateDocumentProps { diff --git a/lib/blocks/server.ts b/lib/blocks/server.ts index 98b037b4a..df449347e 100644 --- a/lib/blocks/server.ts +++ b/lib/blocks/server.ts @@ -2,11 +2,11 @@ import { codeDocumentHandler } from '@/blocks/code/server'; import { imageDocumentHandler } from '@/blocks/image/server'; import { sheetDocumentHandler } from '@/blocks/sheet/server'; import { textDocumentHandler } from '@/blocks/text/server'; -import { BlockKind } from '@/components/block'; -import { DataStreamWriter } from 'ai'; -import { Document } from '../db/schema'; +import type { BlockKind } from '@/components/block'; +import type { DataStreamWriter } from 'ai'; +import type { Document } from '../db/schema'; import { saveDocument } from '../db/queries'; -import { Session } from 'next-auth'; +import type { Session } from 'next-auth'; export interface SaveDocumentProps { id: string; diff --git a/lib/db/queries.ts b/lib/db/queries.ts index 3eb5949d4..96eb0fe25 100644 --- a/lib/db/queries.ts +++ b/lib/db/queries.ts @@ -16,7 +16,7 @@ import { message, vote, } from './schema'; -import { BlockKind } from '@/components/block'; +import type { BlockKind } from '@/components/block'; // Optionally, if not using email/pass login, you can // use the Drizzle adapter for Auth.js / NextAuth diff --git a/lib/editor/suggestions.tsx b/lib/editor/suggestions.tsx index 37885e747..bf6e621ff 100644 --- a/lib/editor/suggestions.tsx +++ b/lib/editor/suggestions.tsx @@ -9,7 +9,7 @@ import { createRoot } from 'react-dom/client'; import { Suggestion as PreviewSuggestion } from '@/components/suggestion'; import type { Suggestion } from '@/lib/db/schema'; -import { BlockKind } from '@/components/block'; +import type { BlockKind } from '@/components/block'; export interface UISuggestion extends Suggestion { selectionStart: number; diff --git a/lib/utils.ts b/lib/utils.ts index 685988b6c..ff510e355 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -2,9 +2,7 @@ import type { CoreAssistantMessage, CoreToolMessage, Message, - TextStreamPart, ToolInvocation, - ToolSet, } from 'ai'; import { type ClassValue, clsx } from 'clsx'; import { twMerge } from 'tailwind-merge';