feat(image-search): handle chat history

This commit is contained in:
ItzCrazyKns 2024-04-28 11:15:28 +05:30
parent f14050840b
commit 5df3c5ad8c
No known key found for this signature in database
GPG key ID: 8162927C7CCE3065
4 changed files with 24 additions and 5 deletions

View file

@ -3,6 +3,7 @@ import { ImagesIcon, PlusIcon } from 'lucide-react';
import { useState } from 'react';
import Lightbox from 'yet-another-react-lightbox';
import 'yet-another-react-lightbox/styles.css';
import { Message } from './ChatWindow';
type Image = {
url: string;
@ -10,7 +11,13 @@ type Image = {
title: string;
};
const SearchImages = ({ query }: { query: string }) => {
const SearchImages = ({
query,
chat_history,
}: {
query: string;
chat_history: Message[];
}) => {
const [images, setImages] = useState<Image[] | null>(null);
const [loading, setLoading] = useState(false);
const [open, setOpen] = useState(false);
@ -31,7 +38,7 @@ const SearchImages = ({ query }: { query: string }) => {
},
body: JSON.stringify({
query: query,
chat_history: [],
chat_history: chat_history,
}),
},
);