Skip to content

Commit d1c74c8

Browse files
committed
Initial commit
0 parents  commit d1c74c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+4568
-0
lines changed

.assets/perplexica-preview.gif

15.7 MB
Loading

.assets/perplexica-screenshot.png

151 KB
Loading

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
PORT=3001
2+
OPENAI_API_KEY=
3+
SIMILARITY_MEASURE=cosine # cosine or dot
4+
SEARXNG_API_URL= # no need to fill this if using docker

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Node.js
2+
node_modules/
3+
npm-debug.log
4+
yarn-error.log
5+
6+
# Build output
7+
/.next/
8+
/out/
9+
10+
# IDE/Editor specific
11+
.vscode/
12+
.idea/
13+
*.iml
14+
15+
# Dependency lock files
16+
package-lock.json
17+
yarn.lock
18+
19+
# Environment variables
20+
.env
21+
.env.local
22+
.env.development.local
23+
.env.test.local
24+
.env.production.local
25+
26+
# Log files
27+
logs/
28+
*.log
29+
30+
# Testing
31+
/coverage/
32+
33+
# Miscellaneous
34+
.DS_Store
35+
Thumbs.db

.prettierrc.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/** @type {import("prettier").Config} */
2+
3+
const config = {
4+
printWidth: 80,
5+
trailingComma: 'all',
6+
endOfLine: 'auto',
7+
singleQuote: true,
8+
tabWidth: 2,
9+
semi: true,
10+
};
11+
12+
module.exports = config;

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# 🚀 Perplexica - An AI-powered search engine 🔎
2+
3+
![preview](.assets/perplexica-screenshot.png)
4+
5+
## Overview
6+
7+
Perplexica is an open-source AI-powered searching tool or an AI-powered search engine that goes deep into the internet to find answers. Inspired by Perplexity AI, it's an open-source option that not just searches the web but understands your questions. It uses advanced machine learning algorithms like similarity searching and embeddings to refine results and provides clear answers with sources cited.
8+
9+
## Preview
10+
![video-preview](.assets/perplexica-preview.gif)
11+
12+
## Features
13+
14+
- **Two Main Modes:**
15+
- **Copilot Mode:** (In development) Boosts search by generating different queries to find more relevant internet sources. Like normal search instead of just using the context by SearxNG, it visits the top matches and tries to find relevant sources to the user's query directly from the page.
16+
- **Normal Mode:** Processes your query and performs a web search.
17+
- **Focus Modes:** (In development) special modes to better answer specific types of questions.
18+
- **Current Information:** Some search tools might give you outdated info because they use data from crawling bots and convert them into embeddings and store them in a index (its like converting the web into embeddings which is quite expensive.). Unlike them, Perplexica uses SearxNG, a metasearch engine to get the results and rerank and get the most relevent source out of it, ensuring you always get the latest information without the overhead of daily data updates.
19+
20+
It has many more features like image and video search. Some of the planned features are mentioned in [upcoming features](#upcoming-features).
21+
22+
## Installation
23+
24+
There are mainly 2 ways of installing Perplexica - With Docker, Without Docker. Using Docker is highly recommended.
25+
26+
### Getting Started with Docker (Recommended)
27+
28+
1. Make sure Docker is installed and running on your system.
29+
2. Clone the Perplexica repository:
30+
31+
```bash
32+
git clone https://github.com/ItzCrazyKns/Perplexica.git
33+
```
34+
35+
3. After cloning, rename the `.env.example` file to `.env` in the root directory. For Docker setups, you only need to fill these fields:
36+
37+
- `OPENAI_API_KEY`
38+
- `SIMILARITY_MEASURE` (Its filled by default, you can leave it if you do not know about it.)
39+
40+
4. Navigate to the directory containing `docker-compose.yaml` and execute:
41+
42+
```bash
43+
docker compose up
44+
```
45+
46+
5. Wait a few minutes for the setup to complete. Access Perplexica at `http://localhost:3001` in your web browser.
47+
48+
### Non-Docker Installation
49+
50+
For setups without Docker:
51+
52+
1. Follow the initial steps to clone the repository and rename the `.env.example` file to `.env` in the root directory. You will need to fill in all the fields in this file.
53+
2. Additionally, rename the `.env.example` file to `.env` in the `ui` folder and complete all fields.
54+
3. The non-Docker setup requires manual configuration of both the backend and frontend.
55+
56+
**Note**: Using Docker is recommended as it simplifies the setup process, especially for managing environment variables and dependencies.
57+
58+
## Upcoming Features
59+
60+
- Finalizing Copilot Mode
61+
- Adding support for multiple local LLMs and LLM providers such as Anthropic, Google, etc.
62+
- Adding Discover and History Saving features
63+
- Introducing various Focus Modes
64+
- Continuous bug fixing
65+
66+
## Contribution
67+
68+
Perplexica is built on the idea that AI and large language models should be easy for everyone to use. If you find bugs or have ideas, please share them in via GitHub Issues. Details on how to contribute will be shared soon.
69+
70+
## Acknowledgements
71+
72+
Inspired by Perplexity AI, Perplexica aims to provide a similar service but always up-to-date and fully open source, thanks to SearxNG.
73+
74+
If you have any queries you can reach me via my Discord - `itzcrazykns`. Thanks for checking out Perplexica.

app.dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:alpine
2+
3+
ARG NEXT_PUBLIC_WS_URL
4+
ARG NEXT_PUBLIC_API_URL
5+
ENV NEXT_PUBLIC_WS_URL=${NEXT_PUBLIC_WS_URL}
6+
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
7+
8+
WORKDIR /home/perplexica
9+
10+
COPY ui /home/perplexica/
11+
12+
RUN yarn install
13+
RUN yarn build
14+
15+
CMD ["yarn", "start"]

backend.dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM node:alpine
2+
3+
ARG SEARXNG_API_URL
4+
ENV SEARXNG_API_URL=${SEARXNG_API_URL}
5+
6+
WORKDIR /home/perplexica
7+
8+
COPY src /home/perplexica/src
9+
COPY tsconfig.json /home/perplexica/
10+
COPY .env /home/perplexica/
11+
COPY package.json /home/perplexica/
12+
COPY yarn.lock /home/perplexica/
13+
14+
RUN yarn install
15+
RUN yarn build
16+
17+
CMD ["yarn", "start"]

docker-compose.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
services:
2+
searxng:
3+
build:
4+
context: .
5+
dockerfile: searxng.dockerfile
6+
expose:
7+
- 4000
8+
ports:
9+
- 4000:8080
10+
networks:
11+
- perplexica-network
12+
perplexica-backend:
13+
build:
14+
context: .
15+
dockerfile: backend.dockerfile
16+
args:
17+
- SEARXNG_API_URL=http://searxng:8080
18+
depends_on:
19+
- searxng
20+
expose:
21+
- 3001
22+
ports:
23+
- 3001:3001
24+
networks:
25+
- perplexica-network
26+
27+
perplexica-frontend:
28+
build:
29+
context: .
30+
dockerfile: app.dockerfile
31+
args:
32+
- NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api
33+
- NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001
34+
depends_on:
35+
- perplexica-backend
36+
expose:
37+
- 3000
38+
ports:
39+
- 3000:3000
40+
networks:
41+
- perplexica-network
42+
43+
networks:
44+
perplexica-network:

package.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "perplexica-backend",
3+
"version": "1.0.0",
4+
"license": "MIT",
5+
"author": "ItzCrazyKns",
6+
"scripts": {
7+
"start": "node --env-file=.env dist/app.js",
8+
"build": "tsc",
9+
"dev": "nodemon --env-file=.env src/app.ts",
10+
"format": "prettier . --check",
11+
"format:write": "prettier . --write"
12+
},
13+
"devDependencies": {
14+
"@types/cors": "^2.8.17",
15+
"@types/express": "^4.17.21",
16+
"@types/readable-stream": "^4.0.11",
17+
"prettier": "^3.2.5",
18+
"ts-node": "^10.9.2",
19+
"typescript": "^5.4.3"
20+
},
21+
"dependencies": {
22+
"@langchain/openai": "^0.0.25",
23+
"axios": "^1.6.8",
24+
"compute-cosine-similarity": "^1.1.0",
25+
"compute-dot": "^1.1.0",
26+
"cors": "^2.8.5",
27+
"express": "^4.19.2",
28+
"langchain": "^0.1.30",
29+
"ws": "^8.16.0",
30+
"zod": "^3.22.4"
31+
}
32+
}

0 commit comments

Comments
 (0)