Skip to content

Commit

Permalink
fix: clean up code formatting and remove unnecessary comments
Browse files Browse the repository at this point in the history
  • Loading branch information
athrael-soju committed Jan 8, 2025
1 parent ff56602 commit cafa07a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion components/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -564,4 +564,4 @@ export const Block = memo(PureBlock, (prevProps, nextProps) => {
if (!equal(prevProps.messages, nextProps.messages.length)) return false;

return true;
});
});
2 changes: 1 addition & 1 deletion components/code-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function PureCodeEditor({ content, saveContent, status }: EditorProps) {
const updateListener = EditorView.updateListener.of((update) => {
if (update.docChanged) {
const transaction = update.transactions.find(
(tr) => !tr.annotation(Transaction.remote),
(tr) => !tr.annotation(Transaction.remote)
);

if (transaction) {
Expand Down
18 changes: 10 additions & 8 deletions components/multimodal-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ function PureMultimodalInput({
setMessages: Dispatch<SetStateAction<Array<Message>>>;
append: (
message: Message | CreateMessage,
chatRequestOptions?: ChatRequestOptions,
chatRequestOptions?: ChatRequestOptions
) => Promise<string | null | undefined>;
handleSubmit: (
event?: {
preventDefault?: () => void;
},
chatRequestOptions?: ChatRequestOptions,
chatRequestOptions?: ChatRequestOptions
) => void;
className?: string;
}) {
Expand All @@ -77,7 +77,9 @@ function PureMultimodalInput({
const adjustHeight = () => {
if (textareaRef.current) {
textareaRef.current.style.height = 'auto';
textareaRef.current.style.height = `${textareaRef.current.scrollHeight + 2}px`;
textareaRef.current.style.height = `${
textareaRef.current.scrollHeight + 2
}px`;
}
};

Expand All @@ -90,7 +92,7 @@ function PureMultimodalInput({

const [localStorageInput, setLocalStorageInput] = useLocalStorage(
'input',
'',
''
);

useEffect(() => {
Expand Down Expand Up @@ -177,7 +179,7 @@ function PureMultimodalInput({
const uploadPromises = files.map((file) => uploadFile(file));
const uploadedAttachments = await Promise.all(uploadPromises);
const successfullyUploadedAttachments = uploadedAttachments.filter(
(attachment) => attachment !== undefined,
(attachment) => attachment !== undefined
);

setAttachments((currentAttachments) => [
Expand All @@ -190,7 +192,7 @@ function PureMultimodalInput({
setUploadQueue([]);
}
},
[setAttachments],
[setAttachments]
);

return (
Expand Down Expand Up @@ -237,7 +239,7 @@ function PureMultimodalInput({
onChange={handleInput}
className={cx(
'min-h-[24px] max-h-[calc(75dvh)] overflow-hidden resize-none rounded-2xl !text-base bg-muted pb-10 dark:border-zinc-700',
className,
className
)}
rows={2}
autoFocus
Expand Down Expand Up @@ -281,7 +283,7 @@ export const MultimodalInput = memo(
if (!equal(prevProps.attachments, nextProps.attachments)) return false;

return true;
},
}
);

function PureAttachmentsButton({
Expand Down
7 changes: 3 additions & 4 deletions lib/ai/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ This is a guide for using blocks tools: \`createDocument\` and \`updateDocument\
Do not update document right after creating it. Wait for user feedback or request to update it.
`;

// TODO: Prompt can be adjusted.
export const regularPrompt =
'You are a friendly assistant! Keep your responses concise and helpful.';

Expand Down Expand Up @@ -67,7 +66,7 @@ print(f"Factorial of 5 is: {factorial(5)}")

export const updateDocumentPrompt = (
currentContent: string | null,
type: BlockKind,
type: BlockKind
) =>
type === 'text'
? `\
Expand All @@ -76,9 +75,9 @@ Improve the following contents of the document based on the given prompt.
${currentContent}
`
: type === 'code'
? `\
? `\
Improve the following code snippet based on the given prompt.
${currentContent}
`
: '';
: '';

0 comments on commit cafa07a

Please sign in to comment.