Skip to content

Commit

Permalink
fix: tweak styles (vercel#645)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyphilemon authored Dec 20, 2024
1 parent 8d6eb09 commit 50fbc0d
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 31 deletions.
5 changes: 3 additions & 2 deletions app/(chat)/api/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ export async function POST(request: Request) {
},
},
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({
title: z.string(),
kind: z.enum(['text', 'code']),
Expand Down Expand Up @@ -226,7 +227,7 @@ export async function POST(request: Request) {
},
},
updateDocument: {
description: 'Update a document with the given description',
description: 'Update a document with the given description.',
parameters: z.object({
id: z.string().describe('The ID of the document to update'),
description: z
Expand Down
18 changes: 11 additions & 7 deletions app/(chat)/chat/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Chat } from '@/components/chat';
import { DEFAULT_MODEL_NAME, models } from '@/lib/ai/models';
import { getChatById, getMessagesByChatId } from '@/lib/db/queries';
import { convertToUIMessages } from '@/lib/utils';
import { DataStreamHandler } from '@/components/data-stream-handler';

export default async function Page(props: { params: Promise<{ id: string }> }) {
const params = await props.params;
Expand Down Expand Up @@ -39,12 +40,15 @@ export default async function Page(props: { params: Promise<{ id: string }> }) {
DEFAULT_MODEL_NAME;

return (
<Chat
id={chat.id}
initialMessages={convertToUIMessages(messagesFromDb)}
selectedModelId={selectedModelId}
selectedVisibilityType={chat.visibility}
isReadonly={session?.user?.id !== chat.userId}
/>
<>
<Chat
id={chat.id}
initialMessages={convertToUIMessages(messagesFromDb)}
selectedModelId={selectedModelId}
selectedVisibilityType={chat.visibility}
isReadonly={session?.user?.id !== chat.userId}
/>
<DataStreamHandler id={id} />
</>
);
}
2 changes: 0 additions & 2 deletions components/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarGroup,
SidebarGroupContent,
SidebarHeader,
SidebarMenu,
useSidebar,
Expand Down
12 changes: 8 additions & 4 deletions components/document-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,13 @@ const PureHitboxLayer = ({
onClick={handleClick}
role="presentation"
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>
);
};

Expand Down Expand Up @@ -196,9 +202,7 @@ const PureDocumentHeader = ({
</div>
<div className="-translate-y-1 sm:translate-y-0 font-medium">{title}</div>
</div>
<div>
<FullscreenIcon />
</div>
<div className="w-8" />
</div>
);

Expand Down
4 changes: 3 additions & 1 deletion components/message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ const PurePreviewMessage = ({
>
{message.role === 'assistant' && (
<div className="size-8 flex items-center rounded-full justify-center ring-1 shrink-0 ring-border bg-background">
<SparklesIcon size={14} />
<div className="translate-y-px">
<SparklesIcon size={14} />
</div>
</div>
)}

Expand Down
6 changes: 3 additions & 3 deletions components/multimodal-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { useLocalStorage, useWindowSize } from 'usehooks-ts';

import { sanitizeUIMessages } from '@/lib/utils';

import { ArrowUpIcon, ImageIcon, PaperclipIcon, StopIcon } from './icons';
import { ArrowUpIcon, PaperclipIcon, StopIcon } from './icons';
import { PreviewAttachment } from './preview-attachment';
import { Button } from './ui/button';
import { Textarea } from './ui/textarea';
Expand Down Expand Up @@ -293,7 +293,7 @@ function PureAttachmentsButton({
disabled={isLoading}
variant="ghost"
>
<ImageIcon size={14} />
<PaperclipIcon size={14} />
</Button>
);
}
Expand Down Expand Up @@ -349,6 +349,6 @@ function PureSendButton({
const SendButton = memo(PureSendButton, (prevProps, nextProps) => {
if (prevProps.uploadQueue.length !== nextProps.uploadQueue.length)
return false;
if (!prevProps.input !== !nextProps.input) return false;
if (prevProps.input !== nextProps.input) return false;
return true;
});
10 changes: 4 additions & 6 deletions components/sidebar-history.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ export function SidebarHistory({ user }: { user: User | undefined }) {
return (
<SidebarGroup>
<SidebarGroupContent>
<div className="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>
<div className="px-2 text-zinc-500 w-full flex flex-row justify-center items-center text-sm gap-2">
Login to save and revisit previous chats!
</div>
</SidebarGroupContent>
</SidebarGroup>
Expand Down Expand Up @@ -238,10 +238,8 @@ export function SidebarHistory({ user }: { user: User | undefined }) {
return (
<SidebarGroup>
<SidebarGroupContent>
<div className="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!
</div>
<div className="px-2 text-zinc-500 w-full flex flex-row justify-center items-center text-sm gap-2">
Your conversations will appear here once you start chatting!
</div>
</SidebarGroupContent>
</SidebarGroup>
Expand Down
8 changes: 4 additions & 4 deletions components/suggested-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ function PureSuggestedActions({ chatId, append }: SuggestedActionsProps) {
},
{
title: 'Write code that',
label: `demonstrates djikstra's algorithm!`,
action: `Write code that demonstrates djikstra's algorithm!`,
label: `demonstrates djikstra's algorithm`,
action: `Write code that demonstrates djikstra's algorithm`,
},
{
title: 'Help me write an essay',
label: `about silicon valley!`,
action: `Help me write an essay about silicon valley!`,
label: `about silicon valley`,
action: `Help me write an essay about silicon valley`,
},
{
title: 'What is the weather',
Expand Down
4 changes: 2 additions & 2 deletions components/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ export const Tools = ({

return (
<motion.div
className="flex flex-col"
className="flex flex-col gap-1.5"
initial={{ opacity: 0, scale: 0.95 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.95 }}
Expand Down Expand Up @@ -469,7 +469,7 @@ const PureToolbar = ({
: {
opacity: 1,
y: 0,
height: toolsByBlockKind[blockKind].length * 47,
height: toolsByBlockKind[blockKind].length * 50,
transition: { delay: 0 },
scale: 1,
}
Expand Down
5 changes: 5 additions & 0 deletions lib/ai/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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.
**When to use \`createDocument\`:**
Expand All @@ -21,6 +23,9 @@ This is a guide for using blocks tools: \`createDocument\` and \`updateDocument\
- Use targeted updates only for specific, isolated changes
- 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.
`;

Expand Down

0 comments on commit 50fbc0d

Please sign in to comment.