chore: rename blocks to artifacts (#793)
This commit is contained in:
parent
01f589b603
commit
81f909ac3a
41 changed files with 473 additions and 473 deletions
|
|
@ -2,7 +2,10 @@ import { generateUUID } from '@/lib/utils';
|
|||
import { DataStreamWriter, tool } from 'ai';
|
||||
import { z } from 'zod';
|
||||
import { Session } from 'next-auth';
|
||||
import { blockKinds, documentHandlersByBlockKind } from '@/lib/blocks/server';
|
||||
import {
|
||||
artifactKinds,
|
||||
documentHandlersByArtifactKind,
|
||||
} from '@/lib/artifacts/server';
|
||||
|
||||
interface CreateDocumentProps {
|
||||
session: Session;
|
||||
|
|
@ -15,7 +18,7 @@ export const createDocument = ({ session, dataStream }: CreateDocumentProps) =>
|
|||
'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.',
|
||||
parameters: z.object({
|
||||
title: z.string(),
|
||||
kind: z.enum(blockKinds),
|
||||
kind: z.enum(artifactKinds),
|
||||
}),
|
||||
execute: async ({ title, kind }) => {
|
||||
const id = generateUUID();
|
||||
|
|
@ -40,9 +43,9 @@ export const createDocument = ({ session, dataStream }: CreateDocumentProps) =>
|
|||
content: '',
|
||||
});
|
||||
|
||||
const documentHandler = documentHandlersByBlockKind.find(
|
||||
(documentHandlerByBlockKind) =>
|
||||
documentHandlerByBlockKind.kind === kind,
|
||||
const documentHandler = documentHandlersByArtifactKind.find(
|
||||
(documentHandlerByArtifactKind) =>
|
||||
documentHandlerByArtifactKind.kind === kind,
|
||||
);
|
||||
|
||||
if (!documentHandler) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export const requestSuggestions = ({
|
|||
> = [];
|
||||
|
||||
const { elementStream } = streamObject({
|
||||
model: myProvider.languageModel('block-model'),
|
||||
model: myProvider.languageModel('artifact-model'),
|
||||
system:
|
||||
'You are a help writing assistant. Given a piece of writing, please offer suggestions to improve the piece of writing and describe the change. It is very important for the edits to contain full sentences instead of just words. Max 5 suggestions.',
|
||||
prompt: document.content,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { DataStreamWriter, tool } from 'ai';
|
|||
import { Session } from 'next-auth';
|
||||
import { z } from 'zod';
|
||||
import { getDocumentById, saveDocument } from '@/lib/db/queries';
|
||||
import { documentHandlersByBlockKind } from '@/lib/blocks/server';
|
||||
import { documentHandlersByArtifactKind } from '@/lib/artifacts/server';
|
||||
|
||||
interface UpdateDocumentProps {
|
||||
session: Session;
|
||||
|
|
@ -32,9 +32,9 @@ export const updateDocument = ({ session, dataStream }: UpdateDocumentProps) =>
|
|||
content: document.title,
|
||||
});
|
||||
|
||||
const documentHandler = documentHandlersByBlockKind.find(
|
||||
(documentHandlerByBlockKind) =>
|
||||
documentHandlerByBlockKind.kind === document.kind,
|
||||
const documentHandler = documentHandlersByArtifactKind.find(
|
||||
(documentHandlerByArtifactKind) =>
|
||||
documentHandlerByArtifactKind.kind === document.kind,
|
||||
);
|
||||
|
||||
if (!documentHandler) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue