fix: lint workflow (#1167)
This commit is contained in:
parent
256b4e0b89
commit
431eb919b5
15 changed files with 28 additions and 22 deletions
1
.github/workflows/lint.yml
vendored
1
.github/workflows/lint.yml
vendored
|
|
@ -23,4 +23,3 @@ jobs:
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
- name: Run lint
|
- name: Run lint
|
||||||
run: pnpm lint
|
run: pnpm lint
|
||||||
1
|
|
||||||
|
|
@ -42,7 +42,7 @@ export default function Page() {
|
||||||
updateSession();
|
updateSession();
|
||||||
router.refresh();
|
router.refresh();
|
||||||
}
|
}
|
||||||
}, [state.status]);
|
}, [state.status, router, updateSession]);
|
||||||
|
|
||||||
const handleSubmit = (formData: FormData) => {
|
const handleSubmit = (formData: FormData) => {
|
||||||
setEmail(formData.get('email') as string);
|
setEmail(formData.get('email') as string);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ export default function Page() {
|
||||||
updateSession();
|
updateSession();
|
||||||
router.refresh();
|
router.refresh();
|
||||||
}
|
}
|
||||||
}, [state]);
|
}, [state, router, updateSession]);
|
||||||
|
|
||||||
const handleSubmit = (formData: FormData) => {
|
const handleSubmit = (formData: FormData) => {
|
||||||
setEmail(formData.get('email') as string);
|
setEmail(formData.get('email') as string);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import {
|
||||||
convertToModelMessages,
|
convertToModelMessages,
|
||||||
createUIMessageStream,
|
createUIMessageStream,
|
||||||
JsonToSseTransformStream,
|
JsonToSseTransformStream,
|
||||||
LanguageModelUsage,
|
type LanguageModelUsage,
|
||||||
smoothStream,
|
smoothStream,
|
||||||
stepCountIs,
|
stepCountIs,
|
||||||
streamText,
|
streamText,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { DefaultChatTransport, LanguageModelUsage } from 'ai';
|
import { DefaultChatTransport, type LanguageModelUsage } from 'ai';
|
||||||
import { useChat } from '@ai-sdk/react';
|
import { useChat } from '@ai-sdk/react';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import useSWR, { useSWRConfig } from 'swr';
|
import useSWR, { useSWRConfig } from 'swr';
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { cn } from '@/lib/utils';
|
||||||
import type { UIMessage } from 'ai';
|
import type { UIMessage } from 'ai';
|
||||||
import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
|
import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
|
||||||
import type { ComponentProps, HTMLAttributes, ReactElement } from 'react';
|
import type { ComponentProps, HTMLAttributes, ReactElement } from 'react';
|
||||||
import { createContext, useContext, useEffect, useState } from 'react';
|
import { createContext, useContext, useEffect, useState, useMemo } from 'react';
|
||||||
|
|
||||||
type BranchContextType = {
|
type BranchContextType = {
|
||||||
currentBranch: number;
|
currentBranch: number;
|
||||||
|
|
@ -82,7 +82,10 @@ export type BranchMessagesProps = HTMLAttributes<HTMLDivElement>;
|
||||||
|
|
||||||
export const BranchMessages = ({ children, ...props }: BranchMessagesProps) => {
|
export const BranchMessages = ({ children, ...props }: BranchMessagesProps) => {
|
||||||
const { currentBranch, setBranches, branches } = useBranch();
|
const { currentBranch, setBranches, branches } = useBranch();
|
||||||
const childrenArray = Array.isArray(children) ? children : [children];
|
const childrenArray = useMemo(() =>
|
||||||
|
Array.isArray(children) ? children : [children],
|
||||||
|
[children]
|
||||||
|
);
|
||||||
|
|
||||||
// Use useEffect to update branches when they change
|
// Use useEffect to update branches when they change
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ export const Image = ({
|
||||||
mediaType,
|
mediaType,
|
||||||
...props
|
...props
|
||||||
}: ImageProps) => (
|
}: ImageProps) => (
|
||||||
|
// eslint-disable-next-line @next/next/no-img-element
|
||||||
<img
|
<img
|
||||||
{...props}
|
{...props}
|
||||||
alt={props.alt}
|
alt={props.alt}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ export const MessageAvatar = ({
|
||||||
...props
|
...props
|
||||||
}: MessageAvatarProps) => (
|
}: MessageAvatarProps) => (
|
||||||
<Avatar className={cn('size-8 ring-1 ring-border', className)} {...props}>
|
<Avatar className={cn('size-8 ring-1 ring-border', className)} {...props}>
|
||||||
<AvatarImage alt="" className="mt-0 mb-0" src={src} />
|
<AvatarImage alt="" className="my-0" src={src} />
|
||||||
<AvatarFallback>{name?.slice(0, 2) || 'ME'}</AvatarFallback>
|
<AvatarFallback>{name?.slice(0, 2) || 'ME'}</AvatarFallback>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ export const SourcesTrigger = ({
|
||||||
{children ?? (
|
{children ?? (
|
||||||
<>
|
<>
|
||||||
<p className="font-medium">Used {count} sources</p>
|
<p className="font-medium">Used {count} sources</p>
|
||||||
<ChevronDownIcon className="h-4 w-4" />
|
<ChevronDownIcon className="size-4" />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</CollapsibleTrigger>
|
</CollapsibleTrigger>
|
||||||
|
|
@ -66,7 +66,7 @@ export const Source = ({ href, title, children, ...props }: SourceProps) => (
|
||||||
>
|
>
|
||||||
{children ?? (
|
{children ?? (
|
||||||
<>
|
<>
|
||||||
<BookIcon className="h-4 w-4" />
|
<BookIcon className="size-4" />
|
||||||
<span className="block font-medium">{title}</span>
|
<span className="block font-medium">{title}</span>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ export const WebPreviewNavigationButton = ({
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
className="h-8 w-8 p-0 hover:text-foreground"
|
className="size-8 p-0 hover:text-foreground"
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|
|
||||||
|
|
@ -317,7 +317,7 @@ export const ThinkingMessage = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-col gap-2 w-full md:gap-4">
|
<div className="flex flex-col gap-2 w-full md:gap-4">
|
||||||
<div className="px-0 py-0 text-sm text-muted-foreground">
|
<div className="p-0 text-sm text-muted-foreground">
|
||||||
<LoadingText>Thinking...</LoadingText>
|
<LoadingText>Thinking...</LoadingText>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ function PureMessages({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [status]);
|
}, [status, messagesContainerRef]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
@ -66,7 +66,7 @@ function PureMessages({
|
||||||
className="overflow-y-scroll flex-1 touch-pan-y overscroll-behavior-contain -webkit-overflow-scrolling-touch"
|
className="overflow-y-scroll flex-1 touch-pan-y overscroll-behavior-contain -webkit-overflow-scrolling-touch"
|
||||||
style={{ overflowAnchor: 'none' }}
|
style={{ overflowAnchor: 'none' }}
|
||||||
>
|
>
|
||||||
<Conversation className="flex flex-col gap-4 px-2 pt-4 pb-4 mx-auto min-w-0 max-w-4xl md:gap-6 md:px-4">
|
<Conversation className="flex flex-col gap-4 px-2 py-4 mx-auto min-w-0 max-w-4xl md:gap-6 md:px-4">
|
||||||
<ConversationContent className="flex flex-col gap-4 md:gap-6">
|
<ConversationContent className="flex flex-col gap-4 md:gap-6">
|
||||||
{messages.length === 0 && <Greeting />}
|
{messages.length === 0 && <Greeting />}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import {
|
||||||
PromptInputModelSelectTrigger,
|
PromptInputModelSelectTrigger,
|
||||||
PromptInputModelSelectContent,
|
PromptInputModelSelectContent,
|
||||||
} from './elements/prompt-input';
|
} from './elements/prompt-input';
|
||||||
import { SelectItem, SelectValue } from '@/components/ui/select';
|
import { SelectItem, } from '@/components/ui/select';
|
||||||
import equal from 'fast-deep-equal';
|
import equal from 'fast-deep-equal';
|
||||||
import type { UseChatHelpers } from '@ai-sdk/react';
|
import type { UseChatHelpers } from '@ai-sdk/react';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'framer-motion';
|
||||||
|
|
@ -353,7 +353,7 @@ function PureMultimodalInput({
|
||||||
minHeight={44}
|
minHeight={44}
|
||||||
maxHeight={200}
|
maxHeight={200}
|
||||||
disableAutoResize={true}
|
disableAutoResize={true}
|
||||||
className="text-sm resize-none py-3 px-3 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] bg-transparent !border-0 !border-none outline-none ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:outline-none placeholder:text-muted-foreground"
|
className="text-sm resize-none p-3 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] bg-transparent !border-0 !border-none outline-none ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:outline-none placeholder:text-muted-foreground"
|
||||||
rows={1}
|
rows={1}
|
||||||
autoFocus
|
autoFocus
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import type { Attachment } from '@/lib/types';
|
||||||
import { Loader } from './elements/loader';
|
import { Loader } from './elements/loader';
|
||||||
import { CrossSmallIcon, } from './icons';
|
import { CrossSmallIcon, } from './icons';
|
||||||
import { Button } from './ui/button';
|
import { Button } from './ui/button';
|
||||||
|
import Image from 'next/image';
|
||||||
|
|
||||||
export const PreviewAttachment = ({
|
export const PreviewAttachment = ({
|
||||||
attachment,
|
attachment,
|
||||||
|
|
@ -17,15 +18,17 @@ export const PreviewAttachment = ({
|
||||||
const { name, url, contentType } = attachment;
|
const { name, url, contentType } = attachment;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div data-testid="input-attachment-preview" className="group relative w-16 h-16 rounded-lg overflow-hidden bg-muted border">
|
<div data-testid="input-attachment-preview" className="group relative size-16 rounded-lg overflow-hidden bg-muted border">
|
||||||
{contentType?.startsWith('image') ? (
|
{contentType?.startsWith('image') ? (
|
||||||
<img
|
<Image
|
||||||
src={url}
|
src={url}
|
||||||
alt={name ?? 'An image attachment'}
|
alt={name ?? 'An image attachment'}
|
||||||
className="w-full h-full object-cover"
|
className="size-full object-cover"
|
||||||
|
width={64}
|
||||||
|
height={64}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="w-full h-full flex items-center justify-center text-xs text-muted-foreground">
|
<div className="size-full flex items-center justify-center text-xs text-muted-foreground">
|
||||||
File
|
File
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
@ -47,7 +50,7 @@ export const PreviewAttachment = ({
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent text-white text-[10px] px-1 py-0.5 truncate">
|
<div className="absolute bottom-0 inset-x-0 bg-gradient-to-t from-black/80 to-transparent text-white text-[10px] px-1 py-0.5 truncate">
|
||||||
{name}
|
{name}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { type LanguageModel } from 'ai';
|
import type { LanguageModel } from 'ai';
|
||||||
|
|
||||||
const createMockModel = (): LanguageModel => {
|
const createMockModel = (): LanguageModel => {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue