Skip to content

Commit

Permalink
feat: additional desc in req
Browse files Browse the repository at this point in the history
  • Loading branch information
BastinJafari committed Sep 23, 2021
1 parent 14349dd commit fde49ea
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/showcases/src/pages/e-commerce.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,10 @@ function useJina(url?: BaseURL) {
}, [url]);

async function search(...documents: RawDocumentData[]) {
console.log("docs in search", documents)
setError("")
setResults([])
if (!jina) return;
if (!documents.every(doc => doc instanceof File)) {
setError("Please provide an image!")
return;
}
setSearching(true);
const {results, queries} = await jina.search(...documents);
setSearching(false);
Expand Down Expand Up @@ -281,10 +278,12 @@ export default function Home() {
const [originalDocuments, setOriginalDocuments] = useState<RawDocumentData[]>(
[]
);
const [addDesc, setAddDesc] = useState("")
const {results, searching, search, searchWithParameters, queries, error} =
useJina(url);
const urlInputRef = useRef<HTMLInputElement>(null);


const handleSearch = (...documents: RawDocumentData[]) => {
setOriginalDocuments(documents);
if (filters) searchWithParameters(documents, {conditions: filters});
Expand All @@ -310,8 +309,8 @@ export default function Home() {
<div className="mt-6">
<p className="text-sm text-gray-500 mb-2">Search fashion products with an image+description</p>
<Dropzone onDrop={acceptedFiles => {
console.log(acceptedFiles)
search(...acceptedFiles)
console.log(acceptedFiles, addDesc)
search(addDesc,...acceptedFiles)
}}>
{({getRootProps, getInputProps}) => (
<div {...getRootProps()}
Expand All @@ -333,6 +332,7 @@ export default function Home() {
)}
</Dropzone>
<input
onChange={(event) => setAddDesc(event.target.value)}
className="textInput appearance-none block w-full text-gray-700 border border-primary-500 rounded-b py-3 px-4 mb-3 leading-tight focus:outline-none focus:bg-white"
id="grid-first-name" type="text" placeholder="Add additional description"/>
<style jsx>
Expand Down

0 comments on commit fde49ea

Please sign in to comment.