Upgrade linter and formatter to Ultracite (#1224)

This commit is contained in:
Hayden Bleasel 2025-09-20 12:47:10 -07:00 committed by GitHub
parent b1d254283b
commit 0e320b391d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
177 changed files with 6951 additions and 8342 deletions

View file

@ -1,42 +1,42 @@
import { tool, type UIMessageStreamWriter } from 'ai';
import type { Session } from 'next-auth';
import { z } from 'zod';
import { getDocumentById } from '@/lib/db/queries';
import { documentHandlersByArtifactKind } from '@/lib/artifacts/server';
import type { ChatMessage } from '@/lib/types';
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";
interface UpdateDocumentProps {
type UpdateDocumentProps = {
session: Session;
dataStream: UIMessageStreamWriter<ChatMessage>;
}
};
export const updateDocument = ({ session, dataStream }: UpdateDocumentProps) =>
tool({
description: 'Update a document with the given description.',
description: "Update a document with the given description.",
inputSchema: z.object({
id: z.string().describe('The ID of the document to update'),
id: z.string().describe("The ID of the document to update"),
description: z
.string()
.describe('The description of changes that need to be made'),
.describe("The description of changes that need to be made"),
}),
execute: async ({ id, description }) => {
const document = await getDocumentById({ id });
if (!document) {
return {
error: 'Document not found',
error: "Document not found",
};
}
dataStream.write({
type: 'data-clear',
type: "data-clear",
data: null,
transient: true,
});
const documentHandler = documentHandlersByArtifactKind.find(
(documentHandlerByArtifactKind) =>
documentHandlerByArtifactKind.kind === document.kind,
documentHandlerByArtifactKind.kind === document.kind
);
if (!documentHandler) {
@ -50,13 +50,13 @@ export const updateDocument = ({ session, dataStream }: UpdateDocumentProps) =>
session,
});
dataStream.write({ type: 'data-finish', data: null, transient: true });
dataStream.write({ type: "data-finish", data: null, transient: true });
return {
id,
title: document.title,
kind: document.kind,
content: 'The document has been updated successfully.',
content: "The document has been updated successfully.",
};
},
});