Restore Ultracite + fix sidebar (#1233)

This commit is contained in:
Hayden Bleasel 2025-09-21 11:02:31 -07:00 committed by GitHub
parent 8fbfc253fa
commit 947ed094a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
177 changed files with 6908 additions and 8306 deletions

View file

@ -1,22 +1,22 @@
import { generateUUID } from '@/lib/utils';
import { tool, type UIMessageStreamWriter } from 'ai';
import { z } from 'zod';
import type { Session } from 'next-auth';
import { tool, type UIMessageStreamWriter } from "ai";
import type { Session } from "next-auth";
import { z } from "zod";
import {
artifactKinds,
documentHandlersByArtifactKind,
} from '@/lib/artifacts/server';
import type { ChatMessage } from '@/lib/types';
} from "@/lib/artifacts/server";
import type { ChatMessage } from "@/lib/types";
import { generateUUID } from "@/lib/utils";
interface CreateDocumentProps {
type CreateDocumentProps = {
session: Session;
dataStream: UIMessageStreamWriter<ChatMessage>;
}
};
export const createDocument = ({ session, dataStream }: CreateDocumentProps) =>
tool({
description:
'Create a document for a writing or content creation activities. This tool will call other functions that will generate the contents of the document based on the title and kind.',
"Create a document for a writing or content creation activities. This tool will call other functions that will generate the contents of the document based on the title and kind.",
inputSchema: z.object({
title: z.string(),
kind: z.enum(artifactKinds),
@ -25,32 +25,32 @@ export const createDocument = ({ session, dataStream }: CreateDocumentProps) =>
const id = generateUUID();
dataStream.write({
type: 'data-kind',
type: "data-kind",
data: kind,
transient: true,
});
dataStream.write({
type: 'data-id',
type: "data-id",
data: id,
transient: true,
});
dataStream.write({
type: 'data-title',
type: "data-title",
data: title,
transient: true,
});
dataStream.write({
type: 'data-clear',
type: "data-clear",
data: null,
transient: true,
});
const documentHandler = documentHandlersByArtifactKind.find(
(documentHandlerByArtifactKind) =>
documentHandlerByArtifactKind.kind === kind,
documentHandlerByArtifactKind.kind === kind
);
if (!documentHandler) {
@ -64,13 +64,13 @@ export const createDocument = ({ session, dataStream }: CreateDocumentProps) =>
session,
});
dataStream.write({ type: 'data-finish', data: null, transient: true });
dataStream.write({ type: "data-finish", data: null, transient: true });
return {
id,
title,
kind,
content: 'A document was created and is now visible to the user.',
content: "A document was created and is now visible to the user.",
};
},
});