diff --git a/agent/src/__tests__/client-type-identification.test.ts b/agent/src/__tests__/client-type-identification.test.ts index 831d25433a..436fba4411 100644 --- a/agent/src/__tests__/client-type-identification.test.ts +++ b/agent/src/__tests__/client-type-identification.test.ts @@ -4,8 +4,8 @@ import { describe, it, expect } from "@jest/globals"; // Helper function to identify client types function determineClientType(client: Client): string { // Check if client has a direct type identifier - if ("type" in client) { - return (client as any).type; + if ("type" in client && typeof client.type === "string") { + return client.type; } // Check constructor name diff --git a/client/src/components/app-sidebar.tsx b/client/src/components/app-sidebar.tsx index 9edfce84d2..b307655e7e 100644 --- a/client/src/components/app-sidebar.tsx +++ b/client/src/components/app-sidebar.tsx @@ -37,6 +37,7 @@ export function AppSidebar() { elizaos-icon {Array.from({ length: 5 }).map( - (_, index) => ( - + (_, _index) => ( + ) diff --git a/client/src/components/array-input.tsx b/client/src/components/array-input.tsx index f979f2182e..8b476528e4 100644 --- a/client/src/components/array-input.tsx +++ b/client/src/components/array-input.tsx @@ -13,8 +13,8 @@ export default function ArrayInput({
- {data?.map((b: string, idx: number) => ( - + {data?.map((b: string, _idx: number) => ( + ))}
diff --git a/client/src/components/audio-recorder.tsx b/client/src/components/audio-recorder.tsx index 673dc5dc30..31c36a6d6d 100644 --- a/client/src/components/audio-recorder.tsx +++ b/client/src/components/audio-recorder.tsx @@ -43,8 +43,7 @@ export const AudioRecorder = ({ const { toast } = useToast(); // States const [isRecording, setIsRecording] = useState(false); - // @ts-expect-error - isRecordingFinished is unused, but would break the 2D array if removed - const [isRecordingFinished, setIsRecordingFinished] = + const [_, setIsRecordingFinished] = useState(false); const [timer, setTimer] = useState(0); const [currentRecord, setCurrentRecord] = useState({ @@ -96,7 +95,7 @@ export const AudioRecorder = ({ }); function startRecording() { - if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { + if (navigator.mediaDevices?.getUserMedia) { navigator.mediaDevices .getUserMedia({ audio: true, @@ -182,7 +181,9 @@ export const AudioRecorder = ({ analyser.disconnect(); } if (stream) { - stream.getTracks().forEach((track) => track.stop()); + for (const track of stream.getTracks()) { + track.stop(); + } } if (audioContext) { audioContext.close(); diff --git a/client/src/components/chat.tsx b/client/src/components/chat.tsx index 4c4be22999..f7748b5b71 100644 --- a/client/src/components/chat.tsx +++ b/client/src/components/chat.tsx @@ -8,7 +8,7 @@ import { ChatInput } from "@/components/ui/chat/chat-input"; import { ChatMessageList } from "@/components/ui/chat/chat-message-list"; import { useTransition, animated, type AnimatedProps } from "@react-spring/web"; import { Paperclip, Send, X } from "lucide-react"; -import { useEffect, useRef, useState } from "react"; +import { useEffect, useRef, useState, useCallback } from "react"; import type { Content, UUID } from "@elizaos/core"; import { useMutation, useQueryClient } from "@tanstack/react-query"; import { apiClient } from "@/lib/api"; @@ -49,12 +49,13 @@ export default function Page({ agentId }: { agentId: UUID }) { const getMessageVariant = (role: string) => role !== "user" ? "received" : "sent"; - const scrollToBottom = () => { + const scrollToBottom = useCallback(() => { if (messagesContainerRef.current) { messagesContainerRef.current.scrollTop = messagesContainerRef.current.scrollHeight; } - }; + }, []); + useEffect(() => { scrollToBottom(); }, [queryClient.getQueryData(["messages", agentId])]); @@ -153,7 +154,7 @@ export default function Page({ agentId }: { agentId: UUID }) { const handleFileChange = (e: React.ChangeEvent) => { const file = e.target.files?.[0]; - if (file && file.type.startsWith("image/")) { + if (file?.type.startsWith("image/")) { setSelectedFile(file); } }; @@ -176,12 +177,12 @@ export default function Page({ agentId }: { agentId: UUID }) {
- {transitions((styles, message) => { + {transitions((style, message: ContentWithUser) => { const variant = getMessageVariant(message?.user); return ( {message?.attachments?.map( - (attachment, idx) => ( + (attachment: IAttachment) => (
attachment
- - + +
) @@ -298,6 +298,7 @@ export default function Page({ agentId }: { agentId: UUID }) { Selected file { +const CopyButton = ({ text }: { text: string }) => { const [copied, setCopied] = useState(false); const handleCopy = () => { diff --git a/client/src/components/ui/breadcrumb.tsx b/client/src/components/ui/breadcrumb.tsx index e232f1e063..c88436ab61 100644 --- a/client/src/components/ui/breadcrumb.tsx +++ b/client/src/components/ui/breadcrumb.tsx @@ -62,6 +62,7 @@ const BreadcrumbPage = React.forwardRef< React.ComponentPropsWithoutRef<"span"> >(({ className, ...props }, ref) => ( {audioBlob ? ( -