diff --git a/docs/docs.trychroma.com/app/api/search/route.ts b/docs/docs.trychroma.com/app/api/search/route.ts index eb7556fa3d4..2952dda82a1 100644 --- a/docs/docs.trychroma.com/app/api/search/route.ts +++ b/docs/docs.trychroma.com/app/api/search/route.ts @@ -3,6 +3,21 @@ import { ChromaClient } from "chromadb"; // @ts-ignore import { Collection } from "chromadb/src/Collection"; +const chromaClient = new ChromaClient({ + path: "https://api.trychroma.com:8000", + auth: { + provider: "token", + credentials: process.env.CHROMA_CLOUD_API_KEY, + tokenHeaderType: "X_CHROMA_TOKEN", + }, + tenant: process.env.CHROMA_CLOUD_TENANT, + database: "docs", +}); + +const collection: Collection = await chromaClient.getOrCreateCollection({ + name: "docs-content", +}); + export async function GET(request: Request) { try { const { searchParams } = new URL(request.url); @@ -15,21 +30,6 @@ export async function GET(request: Request) { ); } - const chromaClient = new ChromaClient({ - path: "https://api.trychroma.com:8000", - auth: { - provider: "token", - credentials: process.env.CHROMA_CLOUD_API_KEY, - tokenHeaderType: "X_CHROMA_TOKEN", - }, - tenant: process.env.CHROMA_CLOUD_TENANT, - database: "docs", - }); - - const collection: Collection = await chromaClient.getOrCreateCollection({ - name: "docs-content", - }); - let results: { distance: number; title: string; diff --git a/docs/docs.trychroma.com/components/header/search-docs.tsx b/docs/docs.trychroma.com/components/header/search-docs.tsx index 527e675d282..605e58fc1d7 100644 --- a/docs/docs.trychroma.com/components/header/search-docs.tsx +++ b/docs/docs.trychroma.com/components/header/search-docs.tsx @@ -57,7 +57,13 @@ const SearchDocs: React.FC = () => { }, [query]); return ( - + { + if (!open) { + setQuery(""); + } + }} + > @@ -132,10 +138,16 @@ const SearchDocs: React.FC = () => { )}
-
- -

Powered by Chroma Cloud

-
+ +
+ +

Powered by Chroma Cloud

+
+