Revert "Upgrade linter and formatter to Ultracite" (#1226)
This commit is contained in:
parent
0e320b391d
commit
1aff7d9868
177 changed files with 8334 additions and 6943 deletions
|
|
@ -1,49 +1,53 @@
|
|||
"use client";
|
||||
'use client';
|
||||
|
||||
import type { UseChatHelpers } from "@ai-sdk/react";
|
||||
import { motion } from "framer-motion";
|
||||
import { memo } from "react";
|
||||
import type { ChatMessage } from "@/lib/types";
|
||||
import { Suggestion } from "./elements/suggestion";
|
||||
import type { VisibilityType } from "./visibility-selector";
|
||||
import { motion } from 'framer-motion';
|
||||
import { memo } from 'react';
|
||||
import type { UseChatHelpers } from '@ai-sdk/react';
|
||||
import type { VisibilityType } from './visibility-selector';
|
||||
import type { ChatMessage } from '@/lib/types';
|
||||
import { Suggestion } from './elements/suggestion';
|
||||
|
||||
type SuggestedActionsProps = {
|
||||
interface SuggestedActionsProps {
|
||||
chatId: string;
|
||||
sendMessage: UseChatHelpers<ChatMessage>["sendMessage"];
|
||||
sendMessage: UseChatHelpers<ChatMessage>['sendMessage'];
|
||||
selectedVisibilityType: VisibilityType;
|
||||
};
|
||||
}
|
||||
|
||||
function PureSuggestedActions({ chatId, sendMessage }: SuggestedActionsProps) {
|
||||
function PureSuggestedActions({
|
||||
chatId,
|
||||
sendMessage,
|
||||
selectedVisibilityType,
|
||||
}: SuggestedActionsProps) {
|
||||
const suggestedActions = [
|
||||
"What are the advantages of using Next.js?",
|
||||
'What are the advantages of using Next.js?',
|
||||
"Write code to demonstrate Dijkstra's algorithm",
|
||||
"Help me write an essay about Silicon Valley",
|
||||
"What is the weather in San Francisco?",
|
||||
'Help me write an essay about Silicon Valley',
|
||||
'What is the weather in San Francisco?',
|
||||
];
|
||||
|
||||
return (
|
||||
<div
|
||||
className="grid w-full gap-2 sm:grid-cols-2"
|
||||
data-testid="suggested-actions"
|
||||
className="grid w-full gap-2 sm:grid-cols-2"
|
||||
>
|
||||
{suggestedActions.map((suggestedAction, index) => (
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
exit={{ opacity: 0, y: 20 }}
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
key={suggestedAction}
|
||||
transition={{ delay: 0.05 * index }}
|
||||
key={suggestedAction}
|
||||
>
|
||||
<Suggestion
|
||||
className="h-auto w-full whitespace-normal p-3 text-left"
|
||||
suggestion={suggestedAction}
|
||||
onClick={(suggestion) => {
|
||||
window.history.replaceState({}, "", `/chat/${chatId}`);
|
||||
window.history.replaceState({}, '', `/chat/${chatId}`);
|
||||
sendMessage({
|
||||
role: "user",
|
||||
parts: [{ type: "text", text: suggestion }],
|
||||
role: 'user',
|
||||
parts: [{ type: 'text', text: suggestion }],
|
||||
});
|
||||
}}
|
||||
suggestion={suggestedAction}
|
||||
className="h-auto w-full whitespace-normal p-3 text-left"
|
||||
>
|
||||
{suggestedAction}
|
||||
</Suggestion>
|
||||
|
|
@ -56,13 +60,10 @@ function PureSuggestedActions({ chatId, sendMessage }: SuggestedActionsProps) {
|
|||
export const SuggestedActions = memo(
|
||||
PureSuggestedActions,
|
||||
(prevProps, nextProps) => {
|
||||
if (prevProps.chatId !== nextProps.chatId) {
|
||||
if (prevProps.chatId !== nextProps.chatId) return false;
|
||||
if (prevProps.selectedVisibilityType !== nextProps.selectedVisibilityType)
|
||||
return false;
|
||||
}
|
||||
if (prevProps.selectedVisibilityType !== nextProps.selectedVisibilityType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue