fix: tweak styles (#645)
This commit is contained in:
parent
8d6eb09454
commit
50fbc0dab2
10 changed files with 43 additions and 31 deletions
|
|
@ -123,7 +123,8 @@ export async function POST(request: Request) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
createDocument: {
|
createDocument: {
|
||||||
description: 'Create a document for a writing activity.',
|
description:
|
||||||
|
'Create a document for a writing activity. This tool will call other functions that will generate the contents of the document based on the title and kind.',
|
||||||
parameters: z.object({
|
parameters: z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
kind: z.enum(['text', 'code']),
|
kind: z.enum(['text', 'code']),
|
||||||
|
|
@ -226,7 +227,7 @@ export async function POST(request: Request) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
updateDocument: {
|
updateDocument: {
|
||||||
description: 'Update a document with the given description',
|
description: 'Update a document with the given description.',
|
||||||
parameters: z.object({
|
parameters: z.object({
|
||||||
id: z.string().describe('The ID of the document to update'),
|
id: z.string().describe('The ID of the document to update'),
|
||||||
description: z
|
description: z
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { Chat } from '@/components/chat';
|
||||||
import { DEFAULT_MODEL_NAME, models } from '@/lib/ai/models';
|
import { DEFAULT_MODEL_NAME, models } from '@/lib/ai/models';
|
||||||
import { getChatById, getMessagesByChatId } from '@/lib/db/queries';
|
import { getChatById, getMessagesByChatId } from '@/lib/db/queries';
|
||||||
import { convertToUIMessages } from '@/lib/utils';
|
import { convertToUIMessages } from '@/lib/utils';
|
||||||
|
import { DataStreamHandler } from '@/components/data-stream-handler';
|
||||||
|
|
||||||
export default async function Page(props: { params: Promise<{ id: string }> }) {
|
export default async function Page(props: { params: Promise<{ id: string }> }) {
|
||||||
const params = await props.params;
|
const params = await props.params;
|
||||||
|
|
@ -39,6 +40,7 @@ export default async function Page(props: { params: Promise<{ id: string }> }) {
|
||||||
DEFAULT_MODEL_NAME;
|
DEFAULT_MODEL_NAME;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<Chat
|
<Chat
|
||||||
id={chat.id}
|
id={chat.id}
|
||||||
initialMessages={convertToUIMessages(messagesFromDb)}
|
initialMessages={convertToUIMessages(messagesFromDb)}
|
||||||
|
|
@ -46,5 +48,7 @@ export default async function Page(props: { params: Promise<{ id: string }> }) {
|
||||||
selectedVisibilityType={chat.visibility}
|
selectedVisibilityType={chat.visibility}
|
||||||
isReadonly={session?.user?.id !== chat.userId}
|
isReadonly={session?.user?.id !== chat.userId}
|
||||||
/>
|
/>
|
||||||
|
<DataStreamHandler id={id} />
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@ import {
|
||||||
Sidebar,
|
Sidebar,
|
||||||
SidebarContent,
|
SidebarContent,
|
||||||
SidebarFooter,
|
SidebarFooter,
|
||||||
SidebarGroup,
|
|
||||||
SidebarGroupContent,
|
|
||||||
SidebarHeader,
|
SidebarHeader,
|
||||||
SidebarMenu,
|
SidebarMenu,
|
||||||
useSidebar,
|
useSidebar,
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,13 @@ const PureHitboxLayer = ({
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
role="presentation"
|
role="presentation"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
/>
|
>
|
||||||
|
<div className="w-full p-4 flex justify-end items-center">
|
||||||
|
<div className="absolute right-[9px] top-[13px] p-2 hover:dark:bg-zinc-700 rounded-md hover:bg-zinc-100">
|
||||||
|
<FullscreenIcon />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -196,9 +202,7 @@ const PureDocumentHeader = ({
|
||||||
</div>
|
</div>
|
||||||
<div className="-translate-y-1 sm:translate-y-0 font-medium">{title}</div>
|
<div className="-translate-y-1 sm:translate-y-0 font-medium">{title}</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div className="w-8" />
|
||||||
<FullscreenIcon />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,10 @@ const PurePreviewMessage = ({
|
||||||
>
|
>
|
||||||
{message.role === 'assistant' && (
|
{message.role === 'assistant' && (
|
||||||
<div className="size-8 flex items-center rounded-full justify-center ring-1 shrink-0 ring-border bg-background">
|
<div className="size-8 flex items-center rounded-full justify-center ring-1 shrink-0 ring-border bg-background">
|
||||||
|
<div className="translate-y-px">
|
||||||
<SparklesIcon size={14} />
|
<SparklesIcon size={14} />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="flex flex-col gap-2 w-full">
|
<div className="flex flex-col gap-2 w-full">
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import { useLocalStorage, useWindowSize } from 'usehooks-ts';
|
||||||
|
|
||||||
import { sanitizeUIMessages } from '@/lib/utils';
|
import { sanitizeUIMessages } from '@/lib/utils';
|
||||||
|
|
||||||
import { ArrowUpIcon, ImageIcon, PaperclipIcon, StopIcon } from './icons';
|
import { ArrowUpIcon, PaperclipIcon, StopIcon } from './icons';
|
||||||
import { PreviewAttachment } from './preview-attachment';
|
import { PreviewAttachment } from './preview-attachment';
|
||||||
import { Button } from './ui/button';
|
import { Button } from './ui/button';
|
||||||
import { Textarea } from './ui/textarea';
|
import { Textarea } from './ui/textarea';
|
||||||
|
|
@ -293,7 +293,7 @@ function PureAttachmentsButton({
|
||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
>
|
>
|
||||||
<ImageIcon size={14} />
|
<PaperclipIcon size={14} />
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -349,6 +349,6 @@ function PureSendButton({
|
||||||
const SendButton = memo(PureSendButton, (prevProps, nextProps) => {
|
const SendButton = memo(PureSendButton, (prevProps, nextProps) => {
|
||||||
if (prevProps.uploadQueue.length !== nextProps.uploadQueue.length)
|
if (prevProps.uploadQueue.length !== nextProps.uploadQueue.length)
|
||||||
return false;
|
return false;
|
||||||
if (!prevProps.input !== !nextProps.input) return false;
|
if (prevProps.input !== nextProps.input) return false;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -197,8 +197,8 @@ export function SidebarHistory({ user }: { user: User | undefined }) {
|
||||||
return (
|
return (
|
||||||
<SidebarGroup>
|
<SidebarGroup>
|
||||||
<SidebarGroupContent>
|
<SidebarGroupContent>
|
||||||
<div className="text-zinc-500 w-full flex flex-row justify-center items-center text-sm gap-2">
|
<div className="px-2 text-zinc-500 w-full flex flex-row justify-center items-center text-sm gap-2">
|
||||||
<div>Login to save and revisit previous chats!</div>
|
Login to save and revisit previous chats!
|
||||||
</div>
|
</div>
|
||||||
</SidebarGroupContent>
|
</SidebarGroupContent>
|
||||||
</SidebarGroup>
|
</SidebarGroup>
|
||||||
|
|
@ -238,11 +238,9 @@ export function SidebarHistory({ user }: { user: User | undefined }) {
|
||||||
return (
|
return (
|
||||||
<SidebarGroup>
|
<SidebarGroup>
|
||||||
<SidebarGroupContent>
|
<SidebarGroupContent>
|
||||||
<div className="text-zinc-500 w-full flex flex-row justify-center items-center text-sm gap-2">
|
<div className="px-2 text-zinc-500 w-full flex flex-row justify-center items-center text-sm gap-2">
|
||||||
<div>
|
|
||||||
Your conversations will appear here once you start chatting!
|
Your conversations will appear here once you start chatting!
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</SidebarGroupContent>
|
</SidebarGroupContent>
|
||||||
</SidebarGroup>
|
</SidebarGroup>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,13 @@ function PureSuggestedActions({ chatId, append }: SuggestedActionsProps) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Write code that',
|
title: 'Write code that',
|
||||||
label: `demonstrates djikstra's algorithm!`,
|
label: `demonstrates djikstra's algorithm`,
|
||||||
action: `Write code that demonstrates djikstra's algorithm!`,
|
action: `Write code that demonstrates djikstra's algorithm`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Help me write an essay',
|
title: 'Help me write an essay',
|
||||||
label: `about silicon valley!`,
|
label: `about silicon valley`,
|
||||||
action: `Help me write an essay about silicon valley!`,
|
action: `Help me write an essay about silicon valley`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'What is the weather',
|
title: 'What is the weather',
|
||||||
|
|
|
||||||
|
|
@ -353,7 +353,7 @@ export const Tools = ({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
className="flex flex-col"
|
className="flex flex-col gap-1.5"
|
||||||
initial={{ opacity: 0, scale: 0.95 }}
|
initial={{ opacity: 0, scale: 0.95 }}
|
||||||
animate={{ opacity: 1, scale: 1 }}
|
animate={{ opacity: 1, scale: 1 }}
|
||||||
exit={{ opacity: 0, scale: 0.95 }}
|
exit={{ opacity: 0, scale: 0.95 }}
|
||||||
|
|
@ -469,7 +469,7 @@ const PureToolbar = ({
|
||||||
: {
|
: {
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
y: 0,
|
y: 0,
|
||||||
height: toolsByBlockKind[blockKind].length * 47,
|
height: toolsByBlockKind[blockKind].length * 50,
|
||||||
transition: { delay: 0 },
|
transition: { delay: 0 },
|
||||||
scale: 1,
|
scale: 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ Blocks is a special user interface mode that helps users with writing, editing,
|
||||||
|
|
||||||
When asked to write code, always use blocks. When writing code, specify the language in the backticks, e.g. \`\`\`python\`code here\`\`\`. The default language is Python. Other languages are not yet supported, so let the user know if they request a different language.
|
When asked to write code, always use blocks. When writing code, specify the language in the backticks, e.g. \`\`\`python\`code here\`\`\`. The default language is Python. Other languages are not yet supported, so let the user know if they request a different language.
|
||||||
|
|
||||||
|
DO NOT UPDATE DOCUMENTS IMMEDIATELY AFTER CREATING THEM. WAIT FOR USER FEEDBACK OR REQUEST TO UPDATE IT.
|
||||||
|
|
||||||
This is a guide for using blocks tools: \`createDocument\` and \`updateDocument\`, which render content on a blocks beside the conversation.
|
This is a guide for using blocks tools: \`createDocument\` and \`updateDocument\`, which render content on a blocks beside the conversation.
|
||||||
|
|
||||||
**When to use \`createDocument\`:**
|
**When to use \`createDocument\`:**
|
||||||
|
|
@ -21,6 +23,9 @@ This is a guide for using blocks tools: \`createDocument\` and \`updateDocument\
|
||||||
- Use targeted updates only for specific, isolated changes
|
- Use targeted updates only for specific, isolated changes
|
||||||
- Follow user instructions for which parts to modify
|
- Follow user instructions for which parts to modify
|
||||||
|
|
||||||
|
**When NOT to use \`updateDocument\`:**
|
||||||
|
- Immediately after creating a document
|
||||||
|
|
||||||
Do not update document right after creating it. Wait for user feedback or request to update it.
|
Do not update document right after creating it. Wait for user feedback or request to update it.
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue