Spaces:
Sleeping
Sleeping
File size: 2,592 Bytes
38448fc d0a1b70 38448fc 76fdff4 fcd4478 38448fc 76fdff4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
'use client';
import ImageSelector from '@/components/chat/ImageSelector';
import { ChatEntity, MessageBase } from '@/lib/types';
import { fetcher } from '@/lib/utils';
import Image from 'next/image';
import { useRouter } from 'next/navigation';
type Example = {
url: string;
initMessages: MessageBase[];
};
const examples: Example[] = [
{
url: 'https://landing-lens-support.s3.us-east-2.amazonaws.com/vision-agent-examples/cereal-example.jpg',
initMessages: [
{
role: 'user',
content: 'how many cereals are there in the image?',
id: 'fake-id-1',
},
],
},
// 'https://landing-lens-support.s3.us-east-2.amazonaws.com/vision-agent-examples/people-example.jpeg',
// 'https://landing-lens-support.s3.us-east-2.amazonaws.com/vision-agent-examples/house-exmaple.jpg',
// 'https://landing-lens-support.s3.us-east-2.amazonaws.com/vision-agent-examples/safari-example.png',
];
export default function Page() {
const router = useRouter();
return (
<div className="mx-auto max-w-2xl px-4 mt-8">
<div className="rounded-lg border bg-background p-8">
<h1 className="mb-2 text-lg font-semibold">Welcome to Vision Agent</h1>
<p>
Vision Agent is a library that helps you utilize agent frameworks for
your vision tasks. Vision Agent aims to provide an in-seconds
experience by allowing users to describe their problem in text and
utilizing agent frameworks to solve the task for them. Check out our
discord for updates and roadmap!
</p>
<ImageSelector />
<p className="mt-4 mb-2">
You can also choose from below examples we provided
</p>
<div className="flex">
{examples.map(({ url, initMessages }, index) => (
<Image
src={url}
key={index}
width={120}
height={120}
alt="example images"
className="object-cover rounded mr-3 shadow-md hover:scale-105 cursor-pointer transition-transform"
onClick={async () => {
const resp = await fetcher<ChatEntity>('/api/upload', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ url, initMessages }),
});
if (resp) {
router.push(`/chat/${resp.id}`);
}
}}
/>
))}
</div>
</div>
</div>
);
}
|