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,31 +1,31 @@
import { smoothStream, streamText } from 'ai';
import { myProvider } from '@/lib/ai/providers';
import { createDocumentHandler } from '@/lib/artifacts/server';
import { updateDocumentPrompt } from '@/lib/ai/prompts';
import { smoothStream, streamText } from "ai";
import { updateDocumentPrompt } from "@/lib/ai/prompts";
import { myProvider } from "@/lib/ai/providers";
import { createDocumentHandler } from "@/lib/artifacts/server";
export const textDocumentHandler = createDocumentHandler<'text'>({
kind: 'text',
export const textDocumentHandler = createDocumentHandler<"text">({
kind: "text",
onCreateDocument: async ({ title, dataStream }) => {
let draftContent = '';
let draftContent = "";
const { fullStream } = streamText({
model: myProvider.languageModel('artifact-model'),
model: myProvider.languageModel("artifact-model"),
system:
'Write about the given topic. Markdown is supported. Use headings wherever appropriate.',
experimental_transform: smoothStream({ chunking: 'word' }),
"Write about the given topic. Markdown is supported. Use headings wherever appropriate.",
experimental_transform: smoothStream({ chunking: "word" }),
prompt: title,
});
for await (const delta of fullStream) {
const { type } = delta;
if (type === 'text-delta') {
if (type === "text-delta") {
const { text } = delta;
draftContent += text;
dataStream.write({
type: 'data-textDelta',
type: "data-textDelta",
data: text,
transient: true,
});
@ -35,17 +35,17 @@ export const textDocumentHandler = createDocumentHandler<'text'>({
return draftContent;
},
onUpdateDocument: async ({ document, description, dataStream }) => {
let draftContent = '';
let draftContent = "";
const { fullStream } = streamText({
model: myProvider.languageModel('artifact-model'),
system: updateDocumentPrompt(document.content, 'text'),
experimental_transform: smoothStream({ chunking: 'word' }),
model: myProvider.languageModel("artifact-model"),
system: updateDocumentPrompt(document.content, "text"),
experimental_transform: smoothStream({ chunking: "word" }),
prompt: description,
providerOptions: {
openai: {
prediction: {
type: 'content',
type: "content",
content: document.content,
},
},
@ -55,13 +55,13 @@ export const textDocumentHandler = createDocumentHandler<'text'>({
for await (const delta of fullStream) {
const { type } = delta;
if (type === 'text-delta') {
if (type === "text-delta") {
const { text } = delta;
draftContent += text;
dataStream.write({
type: 'data-textDelta',
type: "data-textDelta",
data: text,
transient: true,
});