ai-sdk-next-openai/component/anthropic-web-fetch-view.tsx
2025-09-26 15:46:29 +00:00

32 lines
943 B
TypeScript

import { anthropic } from '@ai-sdk/anthropic';
import { UIToolInvocation } from 'ai';
export default function AnthropicWebFetchView({
invocation,
}: {
invocation: UIToolInvocation<
ReturnType<typeof anthropic.tools.webFetch_20250910>
>;
}) {
switch (invocation.state) {
case 'input-streaming':
case 'input-available':
return (
<div className="mb-2 bg-gray-900 rounded-xl border border-gray-600 shadow-lg">
Analyzing the following URL: {invocation.input?.url}
</div>
);
case 'output-available':
return (
<>
<div className="mb-2 bg-gray-900 rounded-xl border border-gray-600 shadow-lg">
Analyzing the following URL: {invocation.input.url}
</div>
<div className="mb-2 bg-gray-900 rounded-xl border border-gray-600 shadow-lg">
{JSON.stringify(invocation.output, null, 2)}
</div>
</>
);
}
}