feat: add image block type (#709)
This commit is contained in:
parent
6c23a8a604
commit
df449a408a
13 changed files with 229 additions and 92 deletions
|
|
@ -29,13 +29,12 @@ import { sanitizeUIMessages } from '@/lib/utils';
|
|||
import {
|
||||
ArrowUpIcon,
|
||||
CodeIcon,
|
||||
FileIcon,
|
||||
LogsIcon,
|
||||
MessageIcon,
|
||||
PenIcon,
|
||||
SparklesIcon,
|
||||
StopIcon,
|
||||
SummarizeIcon,
|
||||
TerminalIcon,
|
||||
} from './icons';
|
||||
import { BlockKind } from './block';
|
||||
|
||||
|
|
@ -327,6 +326,7 @@ const toolsByBlockKind: Record<
|
|||
icon: <LogsIcon />,
|
||||
},
|
||||
],
|
||||
image: [],
|
||||
};
|
||||
|
||||
export const Tools = ({
|
||||
|
|
@ -347,7 +347,7 @@ export const Tools = ({
|
|||
) => Promise<string | null | undefined>;
|
||||
isAnimating: boolean;
|
||||
setIsToolbarVisible: Dispatch<SetStateAction<boolean>>;
|
||||
blockKind: 'text' | 'code';
|
||||
blockKind: BlockKind;
|
||||
}) => {
|
||||
const [primaryTool, ...secondaryTools] = toolsByBlockKind[blockKind];
|
||||
|
||||
|
|
@ -407,7 +407,7 @@ const PureToolbar = ({
|
|||
) => Promise<string | null | undefined>;
|
||||
stop: () => void;
|
||||
setMessages: Dispatch<SetStateAction<Message[]>>;
|
||||
blockKind: 'text' | 'code';
|
||||
blockKind: BlockKind;
|
||||
}) => {
|
||||
const toolbarRef = useRef<HTMLDivElement>(null);
|
||||
const timeoutRef = useRef<ReturnType<typeof setTimeout>>();
|
||||
|
|
@ -451,6 +451,10 @@ const PureToolbar = ({
|
|||
}
|
||||
}, [isLoading, setIsToolbarVisible]);
|
||||
|
||||
if (toolsByBlockKind[blockKind].length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<TooltipProvider delayDuration={0}>
|
||||
<motion.div
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue