Skip to content

Commit b864aab

Browse files
committed
fix: lint errors and formatting
1 parent 7ec9943 commit b864aab

25 files changed

+123
-75
lines changed

app/(chat)/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { generateText, type UIMessage } from "ai";
44
import { cookies } from "next/headers";
55
import { auth } from "@/app/(auth)/auth";
66
import type { VisibilityType } from "@/components/chat/visibility-selector";
7-
import { titlePrompt } from "@/lib/ai/prompts";
87
import { titleModel } from "@/lib/ai/models";
8+
import { titlePrompt } from "@/lib/ai/prompts";
99
import { getTitleModel } from "@/lib/ai/providers";
1010
import {
1111
deleteMessagesByChatIdAfterTimestamp,

app/(chat)/api/chat/route.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,9 @@ export async function POST(request: Request) {
316316
() => sseStream
317317
);
318318
}
319-
} catch {}
319+
} catch (_) {
320+
/* non-critical */
321+
}
320322
},
321323
});
322324
} catch (error) {

app/(chat)/api/history/route.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import { ChatbotError } from "@/lib/errors";
66
export async function GET(request: NextRequest) {
77
const { searchParams } = request.nextUrl;
88

9-
const limit = Math.min(Math.max(Number.parseInt(searchParams.get("limit") || "10", 10), 1), 50);
9+
const limit = Math.min(
10+
Math.max(Number.parseInt(searchParams.get("limit") || "10", 10), 1),
11+
50
12+
);
1013
const startingAfter = searchParams.get("starting_after");
1114
const endingBefore = searchParams.get("ending_before");
1215

app/(chat)/api/models/route.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
getAllGatewayModels,
3-
getCapabilities,
4-
isDemo,
5-
} from "@/lib/ai/models";
1+
import { getAllGatewayModels, getCapabilities, isDemo } from "@/lib/ai/models";
62

73
export async function GET() {
84
const headers = {

app/globals.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,6 @@ textarea:focus-visible {
495495
}
496496
}
497497

498-
499498
[data-testid="artifact"] {
500499
isolation: isolate;
501500
}

artifacts/text/client.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,7 @@ export const textArtifact = new Artifact<"text", TextArtifactMetadata>({
7777

7878
return (
7979
<div className="flex flex-row px-4 py-8 md:px-16 md:py-12 lg:px-20">
80-
<DiffView
81-
newContent={selectedContent}
82-
oldContent={prevContent}
83-
/>
80+
<DiffView newContent={selectedContent} oldContent={prevContent} />
8481
</div>
8582
);
8683
}

components/chat/artifact.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,15 @@ function PureArtifact({
114114
userScrolledArtifact.current = false;
115115
return;
116116
}
117-
if (userScrolledArtifact.current) return;
117+
if (userScrolledArtifact.current) {
118+
return;
119+
}
118120
const el = artifactContentRef.current;
119-
if (!el) return;
121+
if (!el) {
122+
return;
123+
}
120124
el.scrollTo({ top: el.scrollHeight });
121-
}, [artifact.status, artifact.content]);
125+
}, [artifact.status]);
122126

123127
useEffect(() => {
124128
if (documents && documents.length > 0) {
@@ -344,13 +348,16 @@ function PureArtifact({
344348
<div
345349
className="relative flex-1 overflow-y-auto bg-background"
346350
data-slot="artifact-content"
347-
ref={artifactContentRef}
348351
onScroll={() => {
349352
const el = artifactContentRef.current;
350-
if (!el) return;
351-
const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 40;
353+
if (!el) {
354+
return;
355+
}
356+
const atBottom =
357+
el.scrollHeight - el.scrollTop - el.clientHeight < 40;
352358
userScrolledArtifact.current = !atBottom;
353359
}}
360+
ref={artifactContentRef}
354361
>
355362
<artifactDefinition.content
356363
content={

components/chat/code-editor.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,13 @@ function PureCodeEditor({ content, onSaveContent, status }: EditorProps) {
6060

6161
const scrollListener = EditorView.domEventHandlers({
6262
scroll() {
63-
if (status !== "streaming") return;
63+
if (status !== "streaming") {
64+
return;
65+
}
6466
const dom = editorRef.current?.scrollDOM;
65-
if (!dom) return;
67+
if (!dom) {
68+
return;
69+
}
6670
const atBottom =
6771
dom.scrollHeight - dom.scrollTop - dom.clientHeight < 40;
6872
userScrolledRef.current = !atBottom;

components/chat/document-preview.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ import { cn, fetcher } from "@/lib/utils";
1616
import type { ArtifactKind, UIArtifact } from "./artifact";
1717
import { CodeEditor } from "./code-editor";
1818
import { InlineDocumentSkeleton } from "./document-skeleton";
19-
import { CodeIcon, FileIcon, FullscreenIcon, ImageIcon, LoaderIcon } from "./icons";
19+
import {
20+
CodeIcon,
21+
FileIcon,
22+
FullscreenIcon,
23+
ImageIcon,
24+
LoaderIcon,
25+
} from "./icons";
2026
import { ImageEditor } from "./image-editor";
2127
import { SpreadsheetEditor } from "./sheet-editor";
2228
import { Editor } from "./text-editor";

components/chat/multimodal-input.tsx

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
import type { UseChatHelpers } from "@ai-sdk/react";
44
import type { UIMessage } from "ai";
55
import equal from "fast-deep-equal";
6-
import { ArrowUpIcon, BrainIcon, EyeIcon, LockIcon, WrenchIcon } from "lucide-react";
6+
import {
7+
ArrowUpIcon,
8+
BrainIcon,
9+
EyeIcon,
10+
LockIcon,
11+
WrenchIcon,
12+
} from "lucide-react";
713
import {
814
type ChangeEvent,
915
type Dispatch,
@@ -28,11 +34,6 @@ import {
2834
ModelSelectorName,
2935
ModelSelectorTrigger,
3036
} from "@/components/ai-elements/model-selector";
31-
import {
32-
Tooltip,
33-
TooltipContent,
34-
TooltipTrigger,
35-
} from "@/components/ui/tooltip";
3637
import {
3738
type ChatModel,
3839
chatModels,
@@ -547,16 +548,27 @@ function PureModelSelectorCompact({
547548
]
548549
: chatModels;
549550

550-
const grouped: Record<string, { model: ChatModel; curated: boolean }[]> = {};
551+
const grouped: Record<
552+
string,
553+
{ model: ChatModel; curated: boolean }[]
554+
> = {};
551555
for (const model of allModels) {
552-
const key = curatedIds.has(model.id) ? "_available" : model.provider;
553-
if (!grouped[key]) grouped[key] = [];
556+
const key = curatedIds.has(model.id)
557+
? "_available"
558+
: model.provider;
559+
if (!grouped[key]) {
560+
grouped[key] = [];
561+
}
554562
grouped[key].push({ model, curated: curatedIds.has(model.id) });
555563
}
556564

557565
const sortedKeys = Object.keys(grouped).sort((a, b) => {
558-
if (a === "_available") return -1;
559-
if (b === "_available") return 1;
566+
if (a === "_available") {
567+
return -1;
568+
}
569+
if (b === "_available") {
570+
return 1;
571+
}
560572
return a.localeCompare(b);
561573
});
562574

@@ -587,7 +599,11 @@ function PureModelSelectorCompact({
587599

588600
return sortedKeys.map((key) => (
589601
<ModelSelectorGroup
590-
heading={key === "_available" ? "Available" : (providerNames[key] ?? key)}
602+
heading={
603+
key === "_available"
604+
? "Available"
605+
: (providerNames[key] ?? key)
606+
}
591607
key={key}
592608
>
593609
{grouped[key].map(({ model, curated }) => {
@@ -602,7 +618,9 @@ function PureModelSelectorCompact({
602618
)}
603619
key={model.id}
604620
onSelect={() => {
605-
if (!curated) return;
621+
if (!curated) {
622+
return;
623+
}
606624
onModelChange?.(model.id);
607625
setCookie("chat-model", model.id);
608626
setOpen(false);

0 commit comments

Comments
 (0)