Revert "Upgrade linter and formatter to Ultracite" (#1226)
This commit is contained in:
parent
0e320b391d
commit
1aff7d9868
177 changed files with 8334 additions and 6943 deletions
|
|
@ -1,31 +1,31 @@
|
|||
import { smoothStream, streamText } from "ai";
|
||||
import { updateDocumentPrompt } from "@/lib/ai/prompts";
|
||||
import { myProvider } from "@/lib/ai/providers";
|
||||
import { createDocumentHandler } from "@/lib/artifacts/server";
|
||||
import { smoothStream, streamText } from 'ai';
|
||||
import { myProvider } from '@/lib/ai/providers';
|
||||
import { createDocumentHandler } from '@/lib/artifacts/server';
|
||||
import { updateDocumentPrompt } from '@/lib/ai/prompts';
|
||||
|
||||
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,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue