11/** biome-ignore-all lint/correctness/useUniqueElementIds: it's alright */
22import { useEffect , useState , useRef , useCallback , use } from "react" ;
33import { useAgent } from "agents/react" ;
4- import { isToolUIPart } from "ai" ;
4+ import { isStaticToolUIPart } from "ai" ;
55import { useAgentChat } from "agents/ai-react" ;
66import type { UIMessage } from "@ai-sdk/react" ;
77import type { tools } from "./tools" ;
@@ -122,7 +122,7 @@ export default function Chat() {
122122 const pendingToolCallConfirmation = agentMessages . some ( ( m : UIMessage ) =>
123123 m . parts ?. some (
124124 ( part ) =>
125- isToolUIPart ( part ) &&
125+ isStaticToolUIPart ( part ) &&
126126 part . state === "input-available" &&
127127 // Manual check inside the component
128128 toolsRequiringConfirmation . includes (
@@ -136,7 +136,7 @@ export default function Chat() {
136136 } ;
137137
138138 return (
139- < div className = "h-[100vh] w-full p-4 flex justify-center items-center bg-fixed overflow-hidden" >
139+ < div className = "h-screen w-full p-4 flex justify-center items-center bg-fixed overflow-hidden" >
140140 < HasOpenAIKey />
141141 < div className = "h-[calc(100vh-2rem)] w-full mx-auto max-w-lg flex flex-col shadow-xl rounded-md overflow-hidden relative border border-neutral-300 dark:border-neutral-800" >
142142 < div className = "px-4 py-3 border-b border-neutral-300 dark:border-neutral-800 flex items-center gap-3 sticky top-0 z-10" >
@@ -242,7 +242,7 @@ export default function Chat() {
242242 } `}
243243 >
244244 { showAvatar && ! isUser ? (
245- < Avatar username = { "AI" } className = "flex- shrink-0" />
245+ < Avatar username = { "AI" } className = "shrink-0" />
246246 ) : (
247247 ! isUser && < div className = "w-8" />
248248 ) }
@@ -295,7 +295,10 @@ export default function Chat() {
295295 ) ;
296296 }
297297
298- if ( isToolUIPart ( part ) && m . role === "assistant" ) {
298+ if (
299+ isStaticToolUIPart ( part ) &&
300+ m . role === "assistant"
301+ ) {
299302 const toolCallId = part . toolCallId ;
300303 const toolName = part . type . replace ( "tool-" , "" ) ;
301304 const needsConfirmation =
@@ -361,7 +364,7 @@ export default function Chat() {
361364 ? "Please respond to the tool confirmation above..."
362365 : "Send a message..."
363366 }
364- className = "flex w-full border border-neutral-200 dark:border-neutral-700 px-3 py-2 ring-offset-background placeholder:text-neutral-500 dark:placeholder:text-neutral-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-300 dark:focus-visible:ring-neutral-700 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-neutral-900 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm min-h-[24px] max-h-[calc(75dvh)] overflow-hidden resize-none rounded-2xl ! text-base pb-10 dark:bg-neutral-900"
367+ className = "flex w-full border border-neutral-200 dark:border-neutral-700 px-3 py-2 ring-offset-background placeholder:text-neutral-500 dark:placeholder:text-neutral-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-300 dark:focus-visible:ring-neutral-700 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-neutral-900 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm min-h-[24px] max-h-[calc(75dvh)] overflow-hidden resize-none rounded-2xl text-base! pb-10 dark:bg-neutral-900"
365368 value = { agentInput }
366369 onChange = { ( e ) => {
367370 handleAgentInputChange ( e ) ;
0 commit comments