tool-input-streaming.tsx 683 B

123456789101112131415161718192021222324252627282930
  1. "use client";
  2. import { Tool, ToolContent, ToolHeader, ToolInput } from "@/components/ai-elements/tool";
  3. import { nanoid } from "nanoid";
  4. const toolCall = {
  5. errorText: undefined,
  6. input: {
  7. include_snippets: true,
  8. max_results: 10,
  9. query: "latest AI market trends 2024",
  10. },
  11. output: undefined,
  12. state: "input-streaming" as const,
  13. toolCallId: nanoid(),
  14. type: "tool-web_search" as const,
  15. };
  16. const Example = () => (
  17. <div style={{ height: "500px" }}>
  18. <Tool>
  19. <ToolHeader state={toolCall.state} type={toolCall.type} />
  20. <ToolContent>
  21. <ToolInput input={toolCall.input} />
  22. </ToolContent>
  23. </Tool>
  24. </div>
  25. );
  26. export default Example;