Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/search/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VECTOR_STORE_ID=
MXBAI_API_KEY=
41 changes: 41 additions & 0 deletions packages/search/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
36 changes: 36 additions & 0 deletions packages/search/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
21 changes: 21 additions & 0 deletions packages/search/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "",
"css": "src/app/globals.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}
7 changes: 7 additions & 0 deletions packages/search/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
};

export default nextConfig;
44 changes: 44 additions & 0 deletions packages/search/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "search",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "biome lint --write .",
"format": "biome format --write .",
"check-types": "tsc --noEmit"
},
"dependencies": {
"@mixedbread/sdk": "^0.24.0",
"@radix-ui/react-dialog": "^1.1.14",
"@radix-ui/react-scroll-area": "^1.2.9",
"@radix-ui/react-slot": "^1.2.3",
"@radix-ui/react-tabs": "^1.1.12",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^0.514.0",
"motion": "^12.17.3",
"next": "15.3.3",
"next-themes": "^0.4.6",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-markdown": "^10.1.0",
"react-shiki": "^0.7.1",
"rehype-katex": "^7.0.1",
"remark-gfm": "^4.0.1",
"remark-math": "^6.0.0",
"tailwind-merge": "^3.3.1",
"zod": "^3.25.63"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"tailwindcss": "^4",
"tw-animate-css": "^1.3.4",
"typescript": "^5"
}
}
5 changes: 5 additions & 0 deletions packages/search/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const config = {
plugins: ["@tailwindcss/postcss"],
};

export default config;
1 change: 1 addition & 0 deletions packages/search/public/file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/search/public/globe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/search/public/next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/search/public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/search/public/window.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions packages/search/src/app/api/search/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { adapters } from "@/search/adapters";

interface SearchMetadata {
title?: string;
url?: string;
tag?: string;
}

export const GET = adapters.nextAppHandler({
transform: (results) => {
return results.map((result) => {
const metadata = result.chunks?.[0].generated_metadata as SearchMetadata;

return {
id: result.id,
url: metadata.url || "#",
title: metadata.title || "Untitled",
tag: metadata.tag || "",
breadcrumb: [],
};
});
},
});
76 changes: 76 additions & 0 deletions packages/search/src/app/chat/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"use client";

import { useChatDemo } from "@/search/hooks/use-chat-demo";
import {
Composer,
ComposerFooter,
ComposerForm,
ComposerInput,
ComposerSubmit,
ComposerSuggestionItem,
ComposerSuggestions,
} from "@/search/ui/composer";
import {
Thread,
ThreadIf,
ThreadMessages,
ThreadScrollToBottom,
ThreadViewport,
} from "@/search/ui/thread";

export default function ChatDemoPage() {
const { thread, sendMessage, isLoading } = useChatDemo();

return (
<div className="flex h-full items-center justify-center bg-background">
<div className="w-full max-w-2xl rounded-lg border bg-background shadow-sm">
<Thread thread={thread} isLoading={isLoading} sendMessage={sendMessage}>
<ThreadViewport className="h-[60svh] min-h-[600px]">
<ThreadMessages />

<ThreadScrollToBottom />

<ThreadIf empty>
<ComposerSuggestions>
<ComposerSuggestionItem value="How do I implement semantic search?">
<span className="line-clamp-1">
How do I implement semantic search?
</span>
</ComposerSuggestionItem>

<ComposerSuggestionItem value="What are the benefits of vector databases?">
<span className="line-clamp-1">
What are the benefits of vector databases?
</span>
</ComposerSuggestionItem>

<ComposerSuggestionItem value="Explain RAG architecture patterns">
<span className="line-clamp-1">
Explain RAG architecture patterns
</span>
</ComposerSuggestionItem>

<ComposerSuggestionItem value="Show me TypeScript best practices">
<span className="line-clamp-1">
Show me TypeScript best practices
</span>
</ComposerSuggestionItem>
</ComposerSuggestions>
</ThreadIf>
</ThreadViewport>

<div className="border-t p-4">
<Composer onSubmit={sendMessage}>
<ComposerForm>
<ComposerInput />
<ComposerFooter className="justify-end">
<ComposerSubmit />
</ComposerFooter>
</ComposerForm>
</Composer>
</div>
</Thread>
</div>
</div>
);
}
Binary file added packages/search/src/app/favicon.ico
Binary file not shown.
Loading