chore: rename blocks to artifacts (#793)

This commit is contained in:
Jeremy 2025-02-13 08:25:57 -08:00 committed by GitHub
parent 01f589b603
commit 81f909ac3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 473 additions and 473 deletions

View file

@ -1,9 +1,9 @@
import { memo } from 'react';
import type { BlockKind } from './block';
import type { ArtifactKind } from './artifact';
import { FileIcon, LoaderIcon, MessageIcon, PencilEditIcon } from './icons';
import { toast } from 'sonner';
import { useBlock } from '@/hooks/use-block';
import { useArtifact } from '@/hooks/use-artifact';
const getActionText = (
type: 'create' | 'update' | 'request-suggestions',
@ -25,7 +25,7 @@ const getActionText = (
interface DocumentToolResultProps {
type: 'create' | 'update' | 'request-suggestions';
result: { id: string; title: string; kind: BlockKind };
result: { id: string; title: string; kind: ArtifactKind };
isReadonly: boolean;
}
@ -34,7 +34,7 @@ function PureDocumentToolResult({
result,
isReadonly,
}: DocumentToolResultProps) {
const { setBlock } = useBlock();
const { setArtifact } = useArtifact();
return (
<button
@ -57,7 +57,7 @@ function PureDocumentToolResult({
height: rect.height,
};
setBlock({
setArtifact({
documentId: result.id,
kind: result.kind,
content: '',
@ -97,7 +97,7 @@ function PureDocumentToolCall({
args,
isReadonly,
}: DocumentToolCallProps) {
const { setBlock } = useBlock();
const { setArtifact } = useArtifact();
return (
<button
@ -120,8 +120,8 @@ function PureDocumentToolCall({
height: rect.height,
};
setBlock((currentBlock) => ({
...currentBlock,
setArtifact((currentArtifact) => ({
...currentArtifact,
isVisible: true,
boundingBox,
}));