'use client'; import { generateInputImageMarkdown } from '@/lib/messageUtils'; import { useRouter } from 'next/navigation'; import { MessageRaw } from '@/lib/db/types'; import { useRef, useState } from 'react'; import Composer, { ComposerRef } from '@/components/chat/Composer'; import { dbPostCreateChat } from '@/lib/db/functions'; import { nanoid } from '@/lib/utils'; import Chip from '@/components/ui/Chip'; import { IconArrowUpRight, IconImage } from '@/components/ui/Icons'; const EXAMPLES = [ { title: 'Counting flowers', mediaUrl: 'https://vision-agent-dev.s3.us-east-2.amazonaws.com/examples/flower.png', prompt: 'Count the number of flowers in this image.', }, // { // heading: 'Detecting', // url: 'https://landing-lens-support.s3.us-east-2.amazonaws.com/vision-agent-examples/cereal-example.jpg', // subheading: 'number of cereals in an image', // message: `How many cereals are there in the image?`, // }, ]; export default function Page() { const router = useRouter(); const composerRef = useRef(null); return (

Vision Agent BETA

Generate code to solve your vision problem with simple prompts.

{ const newId = nanoid(); const resp = await dbPostCreateChat({ id: newId, mediaUrl: mediaUrl, title: `conversation-${newId}`, initMessages: [ { role: 'user', content: input + (mediaUrl ? '\n\n' + generateInputImageMarkdown(mediaUrl) : ''), result: null, }, ], }); if (resp) { router.push(`/chat/${newId}`); } }} />
<> {EXAMPLES.map((example, index) => { return ( { composerRef.current?.setInput(example.prompt); composerRef.current?.setMediaUrl(example.mediaUrl); }} >

{example.title}

); })}
); }