diff --git a/app/ui/app/src/components/ChatForm.tsx b/app/ui/app/src/components/ChatForm.tsx index b0ae1af74..bc205c359 100644 --- a/app/ui/app/src/components/ChatForm.tsx +++ b/app/ui/app/src/components/ChatForm.tsx @@ -102,9 +102,9 @@ function ChatForm({ const fileInputRef = useRef(null); const textareaRef = useRef(null); const thinkButtonRef = useRef(null); - const thinkingLevelButtonRef = useRef(null); + const thinkingLevelButtonRef = useRef void }>(null); const webSearchButtonRef = useRef(null); - const modelPickerRef = useRef(null); + const modelPickerRef = useRef void }>(null); const submitButtonRef = useRef(null); const { mutate: sendMessageMutation } = useSendMessage(chatId); @@ -126,9 +126,9 @@ function ChatForm({ if ( isOpen && modelPickerRef.current && - (modelPickerRef.current as any).closeDropdown + modelPickerRef.current.closeDropdown ) { - (modelPickerRef.current as any).closeDropdown(); + modelPickerRef.current.closeDropdown(); } }; @@ -136,9 +136,9 @@ function ChatForm({ if ( isOpen && thinkingLevelButtonRef.current && - (thinkingLevelButtonRef.current as any).closeDropdown + thinkingLevelButtonRef.current.closeDropdown ) { - (thinkingLevelButtonRef.current as any).closeDropdown(); + thinkingLevelButtonRef.current.closeDropdown(); } }; diff --git a/app/ui/app/src/components/MessageList.tsx b/app/ui/app/src/components/MessageList.tsx index 63c87b5d0..b9e39e324 100644 --- a/app/ui/app/src/components/MessageList.tsx +++ b/app/ui/app/src/components/MessageList.tsx @@ -23,7 +23,7 @@ export default function MessageList({ onEditMessage?: (content: string, index: number) => void | Promise; editingMessageIndex?: number; error?: ErrorEvent | null; - browserToolResult?: any; + browserToolResult?: { page_stack: string[] }; }) { const [showDots, setShowDots] = React.useState(false); const isDownloadingModel = downloadProgress && !downloadProgress.done; @@ -54,9 +54,9 @@ export default function MessageList({ const queries: (string | undefined)[] = []; let lastQuery: string | undefined = undefined; for (let i = 0; i < messages.length; i++) { - const m: any = messages[i] as any; - const toolCalls: any[] | undefined = Array.isArray(m?.tool_calls) - ? (m.tool_calls as any[]) + const m = messages[i]; + const toolCalls = Array.isArray(m?.tool_calls) + ? m.tool_calls : m?.tool_call ? [m.tool_call] : undefined; diff --git a/app/ui/app/src/components/ModelPicker.tsx b/app/ui/app/src/components/ModelPicker.tsx index 2dba77d8c..648186a6b 100644 --- a/app/ui/app/src/components/ModelPicker.tsx +++ b/app/ui/app/src/components/ModelPicker.tsx @@ -89,7 +89,8 @@ export const ModelPicker = forwardRef< useEffect(() => { if (ref && typeof ref === "object" && ref.current) { - (ref.current as any).closeDropdown = () => setIsOpen(false); + const mutableRef = ref as React.MutableRefObject void }>; + mutableRef.current.closeDropdown = () => setIsOpen(false); } }, [ref, setIsOpen]); diff --git a/app/ui/app/src/components/ThinkButton.tsx b/app/ui/app/src/components/ThinkButton.tsx index ff940267d..2d05f0222 100644 --- a/app/ui/app/src/components/ThinkButton.tsx +++ b/app/ui/app/src/components/ThinkButton.tsx @@ -46,7 +46,8 @@ export const ThinkButton = forwardRef( ref.current && mode === "thinkingLevel" ) { - (ref.current as any).closeDropdown = () => setIsDropdownOpen(false); + const mutableRef = ref as React.MutableRefObject void }>; + mutableRef.current.closeDropdown = () => setIsDropdownOpen(false); } }, [ref, mode]); diff --git a/app/ui/app/src/hooks/useChats.ts b/app/ui/app/src/hooks/useChats.ts index 5aac35285..c9431f3cd 100644 --- a/app/ui/app/src/hooks/useChats.ts +++ b/app/ui/app/src/hooks/useChats.ts @@ -1,6 +1,6 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { getChats, getChat, sendMessage, type ChatEventUnion } from "../api"; -import { Chat, ErrorEvent, Model } from "@/gotypes"; +import { Chat, ChatEvent, ErrorEvent, Model } from "@/gotypes"; import { Message } from "@/gotypes"; import { useSelectedModel } from "./useSelectedModel"; import { createQueryBatcher } from "./useQueryBatcher"; @@ -568,9 +568,9 @@ export const useSendMessage = (chatId: string) => { thinkingTimeEnd: event.thinkingTimeEnd, }), { - tool_result: (event as any).toolResultData, - ...((event as any).toolName - ? { tool_name: (event as any).toolName } + tool_result: (event as ChatEvent).toolResultData, + ...((event as ChatEvent).toolName + ? { tool_name: (event as ChatEvent).toolName } : {}), }, ),