Skip to content

Commit ae579c2

Browse files
committed
fix lint formatting on demo rename pr
1 parent 1ac0653 commit ae579c2

File tree

8 files changed

+73
-39
lines changed

8 files changed

+73
-39
lines changed

components/app-sidebar.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ export function AppSidebar({ user }: { user: User | undefined }) {
4141
const [showDeleteAllDialog, setShowDeleteAllDialog] = useState(false);
4242

4343
const handleDeleteAll = () => {
44-
const deletePromise = fetch(`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/history`, {
45-
method: "DELETE",
46-
});
44+
const deletePromise = fetch(
45+
`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/history`,
46+
{
47+
method: "DELETE",
48+
}
49+
);
4750

4851
toast.promise(deletePromise, {
4952
loading: "Deleting all chats...",

components/artifact.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,17 @@ function PureArtifact({
149149
}
150150

151151
if (currentDocument.content !== updatedContent) {
152-
await fetch(`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/document?id=${artifact.documentId}`, {
153-
method: "POST",
154-
body: JSON.stringify({
155-
title: artifact.title,
156-
content: updatedContent,
157-
kind: artifact.kind,
158-
}),
159-
});
152+
await fetch(
153+
`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/document?id=${artifact.documentId}`,
154+
{
155+
method: "POST",
156+
body: JSON.stringify({
157+
title: artifact.title,
158+
content: updatedContent,
159+
kind: artifact.kind,
160+
}),
161+
}
162+
);
160163

161164
setIsContentDirty(false);
162165

components/chat.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,18 @@ export function Chat({
166166
});
167167

168168
setHasAppendedQuery(true);
169-
window.history.replaceState({}, "", `${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/chat/${id}`);
169+
window.history.replaceState(
170+
{},
171+
"",
172+
`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/chat/${id}`
173+
);
170174
}
171175
}, [query, sendMessage, hasAppendedQuery, id]);
172176

173177
const { data: votes } = useSWR<Vote[]>(
174-
messages.length >= 2 ? `${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/vote?chatId=${id}` : null,
178+
messages.length >= 2
179+
? `${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/vote?chatId=${id}`
180+
: null,
175181
fetcher
176182
);
177183

components/message-actions.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,17 @@ export function PureMessageActions({
7777
data-testid="message-upvote"
7878
disabled={vote?.isUpvoted}
7979
onClick={() => {
80-
const upvote = fetch(`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/vote`, {
81-
method: "PATCH",
82-
body: JSON.stringify({
83-
chatId,
84-
messageId: message.id,
85-
type: "up",
86-
}),
87-
});
80+
const upvote = fetch(
81+
`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/vote`,
82+
{
83+
method: "PATCH",
84+
body: JSON.stringify({
85+
chatId,
86+
messageId: message.id,
87+
type: "up",
88+
}),
89+
}
90+
);
8891

8992
toast.promise(upvote, {
9093
loading: "Upvoting Response...",
@@ -126,14 +129,17 @@ export function PureMessageActions({
126129
data-testid="message-downvote"
127130
disabled={vote && !vote.isUpvoted}
128131
onClick={() => {
129-
const downvote = fetch(`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/vote`, {
130-
method: "PATCH",
131-
body: JSON.stringify({
132-
chatId,
133-
messageId: message.id,
134-
type: "down",
135-
}),
136-
});
132+
const downvote = fetch(
133+
`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/vote`,
134+
{
135+
method: "PATCH",
136+
body: JSON.stringify({
137+
chatId,
138+
messageId: message.id,
139+
type: "down",
140+
}),
141+
}
142+
);
137143

138144
toast.promise(downvote, {
139145
loading: "Downvoting Response...",

components/multimodal-input.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ function PureMultimodalInput({
145145
const [uploadQueue, setUploadQueue] = useState<string[]>([]);
146146

147147
const submitForm = useCallback(() => {
148-
window.history.pushState({}, "", `${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/chat/${chatId}`);
148+
window.history.pushState(
149+
{},
150+
"",
151+
`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/chat/${chatId}`
152+
);
149153

150154
sendMessage({
151155
role: "user",
@@ -188,10 +192,13 @@ function PureMultimodalInput({
188192
formData.append("file", file);
189193

190194
try {
191-
const response = await fetch(`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/files/upload`, {
192-
method: "POST",
193-
body: formData,
194-
});
195+
const response = await fetch(
196+
`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/files/upload`,
197+
{
198+
method: "POST",
199+
body: formData,
200+
}
201+
);
195202

196203
if (response.ok) {
197204
const data = await response.json();

components/sidebar-history.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,12 @@ export function SidebarHistory({ user }: { user: User | undefined }) {
130130

131131
setShowDeleteDialog(false);
132132

133-
const deletePromise = fetch(`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/chat?id=${chatToDelete}`, {
134-
method: "DELETE",
135-
});
133+
const deletePromise = fetch(
134+
`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/chat?id=${chatToDelete}`,
135+
{
136+
method: "DELETE",
137+
}
138+
);
136139

137140
toast.promise(deletePromise, {
138141
loading: "Deleting chat...",

components/suggested-actions.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ function PureSuggestedActions({ chatId, sendMessage }: SuggestedActionsProps) {
3737
<Suggestion
3838
className="h-auto w-full whitespace-normal p-3 text-left"
3939
onClick={(suggestion) => {
40-
window.history.pushState({}, "", `${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/chat/${chatId}`);
40+
window.history.pushState(
41+
{},
42+
"",
43+
`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/chat/${chatId}`
44+
);
4145
sendMessage({
4246
role: "user",
4347
parts: [{ type: "text", text: suggestion }],

hooks/use-chat-visibility.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export function useChatVisibility({
1818
initialVisibilityType: VisibilityType;
1919
}) {
2020
const { mutate, cache } = useSWRConfig();
21-
const history: ChatHistory = cache.get(`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/history`)?.data;
21+
const history: ChatHistory = cache.get(
22+
`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/history`
23+
)?.data;
2224

2325
const { data: localVisibility, mutate: setLocalVisibility } = useSWR(
2426
`${chatId}-visibility`,

0 commit comments

Comments
 (0)