这是indexloc提供的服务,不要输入任何密码
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: 1 addition & 1 deletion .github/workflows/dev-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ concurrency:

on:
push:
branches: ['2237-auto-stt-submit-preference'] # put your current branch to create a build. Core team only.
branches: ['873-pgvector-support'] # put your current branch to create a build. Core team only.
paths-ignore:
- '**.md'
- 'cloud-deployments/*'
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ AnythingLLM divides your documents into objects called `workspaces`. A Workspace
**Vector Databases:**

- [LanceDB](https://github.com/lancedb/lancedb) (default)
- [PGVector](https://github.com/pgvector/pgvector)
- [Astra DB](https://www.datastax.com/products/datastax-astra)
- [Pinecone](https://pinecone.io)
- [Chroma](https://trychroma.com)
Expand Down
11 changes: 8 additions & 3 deletions docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ GID='1000'
###########################################
######## Vector Database Selection ########
###########################################
# Enable all below if you are using vector database: LanceDB.
# VECTOR_DB="lancedb"

# Enable all below if you are using vector database: Weaviate.
# VECTOR_DB="pgvector"
# PGVECTOR_CONNECTION_STRING="postgresql://dbuser:dbuserpass@localhost:5432/yourdb"
# PGVECTOR_TABLE_NAME="anythingllm_vectors" # optional, but can be defined

# Enable all below if you are using vector database: Chroma.
# VECTOR_DB="chroma"
# CHROMA_ENDPOINT='http://host.docker.internal:8000'
Expand All @@ -200,9 +208,6 @@ GID='1000'
# PINECONE_API_KEY=
# PINECONE_INDEX=

# Enable all below if you are using vector database: LanceDB.
# VECTOR_DB="lancedb"

# Enable all below if you are using vector database: Weaviate.
# VECTOR_DB="weaviate"
# WEAVIATE_ENDPOINT="http://localhost:8080"
Expand Down
103 changes: 103 additions & 0 deletions frontend/src/components/VectorDBSelection/PGVectorOptions/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { Info } from "@phosphor-icons/react";
import { Tooltip } from "react-tooltip";

export default function PGVectorOptions({ settings }) {
return (
<div className="w-full flex flex-col gap-y-7">
<div className="w-full flex items-center gap-[36px] mt-1.5">
<div className="flex flex-col w-96">
<div className="flex items-center gap-x-1 mb-3">
<label className="text-white text-sm font-semibold block">
Postgres Connection String
</label>
<Info
size={16}
className="text-theme-text-secondary cursor-pointer"
data-tooltip-id="pgvector-connection-string-tooltip"
data-tooltip-place="right"
/>
<Tooltip
delayHide={300}
id="pgvector-connection-string-tooltip"
className="max-w-md z-99"
clickable={true}
>
<p className="text-md whitespace-pre-line break-words">
This is the connection string for the Postgres database in the
format of <br />
<code>postgresql://username:password@host:port/database</code>
<br />
<br />
The user for the database must have the following permissions:
<ul className="list-disc list-inside">
<li>Read access to the database</li>
<li>Read access to the database schema</li>
<li>Create access to the database</li>
</ul>
<br />
<b>
You must have the pgvector extension installed on the
database.
</b>
</p>
</Tooltip>
</div>
<input
type="text"
name="PGVectorConnectionString"
className="border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"
placeholder="postgresql://username:password@host:port/database"
defaultValue={
settings?.PGVectorConnectionString ? "*".repeat(20) : ""
}
required={true}
autoComplete="off"
spellCheck={false}
/>
</div>

<div className="flex flex-col w-60">
<div className="flex items-center gap-x-1 mb-3">
<label className="text-white text-sm font-semibold block">
Vector Table Name
</label>
<Info
size={16}
className="text-theme-text-secondary cursor-pointer"
data-tooltip-id="pgvector-table-name-tooltip"
data-tooltip-place="right"
/>
<Tooltip
delayHide={300}
id="pgvector-table-name-tooltip"
className="max-w-md z-99"
clickable={true}
>
<p className="text-md whitespace-pre-line break-words">
This is the name of the table in the Postgres database that will
store the vectors.
<br />
<br />
By default, the table name is <code>anythingllm_vectors</code>.
<br />
<br />
<b>
This table must not already exist on the database - it will be
created automatically.
</b>
</p>
</Tooltip>
</div>
<input
type="text"
name="PGVectorTableName"
autoComplete="off"
defaultValue={settings?.PGVectorTableName}
className="border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"
placeholder="vector_table"
/>
</div>
</div>
</div>
);
}
Binary file added frontend/src/media/vectordbs/pgvector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 21 additions & 10 deletions frontend/src/pages/GeneralSettings/VectorDatabase/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,34 @@ import Sidebar from "@/components/SettingsSidebar";
import { isMobile } from "react-device-detect";
import System from "@/models/system";
import showToast from "@/utils/toast";
import { useModal } from "@/hooks/useModal";
import CTAButton from "@/components/lib/CTAButton";
import { CaretUpDown, MagnifyingGlass, X } from "@phosphor-icons/react";
import { useTranslation } from "react-i18next";
import PreLoader from "@/components/Preloader";
import ChangeWarningModal from "@/components/ChangeWarning";
import ModalWrapper from "@/components/ModalWrapper";
import VectorDBItem from "@/components/VectorDBSelection/VectorDBItem";

import LanceDbLogo from "@/media/vectordbs/lancedb.png";
import ChromaLogo from "@/media/vectordbs/chroma.png";
import PineconeLogo from "@/media/vectordbs/pinecone.png";
import LanceDbLogo from "@/media/vectordbs/lancedb.png";
import WeaviateLogo from "@/media/vectordbs/weaviate.png";
import QDrantLogo from "@/media/vectordbs/qdrant.png";
import MilvusLogo from "@/media/vectordbs/milvus.png";
import ZillizLogo from "@/media/vectordbs/zilliz.png";
import AstraDBLogo from "@/media/vectordbs/astraDB.png";
import PreLoader from "@/components/Preloader";
import ChangeWarningModal from "@/components/ChangeWarning";
import { CaretUpDown, MagnifyingGlass, X } from "@phosphor-icons/react";
import PGVectorLogo from "@/media/vectordbs/pgvector.png";

import LanceDBOptions from "@/components/VectorDBSelection/LanceDBOptions";
import ChromaDBOptions from "@/components/VectorDBSelection/ChromaDBOptions";
import PineconeDBOptions from "@/components/VectorDBSelection/PineconeDBOptions";
import QDrantDBOptions from "@/components/VectorDBSelection/QDrantDBOptions";
import WeaviateDBOptions from "@/components/VectorDBSelection/WeaviateDBOptions";
import VectorDBItem from "@/components/VectorDBSelection/VectorDBItem";
import QDrantDBOptions from "@/components/VectorDBSelection/QDrantDBOptions";
import MilvusDBOptions from "@/components/VectorDBSelection/MilvusDBOptions";
import ZillizCloudOptions from "@/components/VectorDBSelection/ZillizCloudOptions";
import { useModal } from "@/hooks/useModal";
import ModalWrapper from "@/components/ModalWrapper";
import AstraDBOptions from "@/components/VectorDBSelection/AstraDBOptions";
import CTAButton from "@/components/lib/CTAButton";
import { useTranslation } from "react-i18next";
import PGVectorOptions from "@/components/VectorDBSelection/PGVectorOptions";

export default function GeneralVectorDatabase() {
const [saving, setSaving] = useState(false);
Expand Down Expand Up @@ -114,6 +118,13 @@ export default function GeneralVectorDatabase() {
description:
"100% local vector DB that runs on the same instance as AnythingLLM.",
},
{
name: "PGVector",
value: "pgvector",
logo: PGVectorLogo,
options: <PGVectorOptions settings={settings} />,
description: "Vector search powered by PostgreSQL.",
},
{
name: "Chroma",
value: "chroma",
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/pages/OnboardingFlow/Steps/DataHandling/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import QDrantLogo from "@/media/vectordbs/qdrant.png";
import MilvusLogo from "@/media/vectordbs/milvus.png";
import VoyageAiLogo from "@/media/embeddingprovider/voyageai.png";
import PPIOLogo from "@/media/llmprovider/ppio.png";

import PGVectorLogo from "@/media/vectordbs/pgvector.png";
import React, { useState, useEffect } from "react";
import paths from "@/utils/paths";
import { useNavigate } from "react-router-dom";
Expand Down Expand Up @@ -237,6 +237,14 @@ export const LLM_SELECTION_PRIVACY = {
};

export const VECTOR_DB_PRIVACY = {
pgvector: {
name: "PGVector",
description: [
"Your vectors and document text are stored on your PostgreSQL instance",
"Access to your instance is managed by you",
],
logo: PGVectorLogo,
},
chroma: {
name: "Chroma",
description: [
Expand Down
1 change: 1 addition & 0 deletions locales/README.fa-IR.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ AnythingLLM اسناد شما را به اشیایی به نام `workspaces` ت
**پایگاه‌های داده برداری:**

- [LanceDB](https://github.com/lancedb/lancedb) (پیش‌فرض)
- [PGVector](https://github.com/pgvector/pgvector)
- [Astra DB](https://www.datastax.com/products/datastax-astra)
- [Pinecone](https://pinecone.io)
- [Chroma](https://trychroma.com)
Expand Down
1 change: 1 addition & 0 deletions locales/README.ja-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ AnythingLLMは、ドキュメントを`ワークスペース`と呼ばれるオ
**ベクトルデータベース:**

- [LanceDB](https://github.com/lancedb/lancedb)(デフォルト)
- [PGVector](https://github.com/pgvector/pgvector)
- [Astra DB](https://www.datastax.com/products/datastax-astra)
- [Pinecone](https://pinecone.io)
- [Chroma](https://trychroma.com)
Expand Down
1 change: 1 addition & 0 deletions locales/README.tr-TR.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ AnythingLLM, belgelerinizi **"çalışma alanları" (workspaces)** adı verilen
**Vektör Databases:**

- [LanceDB](https://github.com/lancedb/lancedb) (default)
- [PGVector](https://github.com/pgvector/pgvector)
- [Astra DB](https://www.datastax.com/products/datastax-astra)
- [Pinecone](https://pinecone.io)
- [Chroma](https://trychroma.com)
Expand Down
1 change: 1 addition & 0 deletions locales/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ AnythingLLM将您的文档划分为称为`workspaces` (工作区)的对象。工
**支持的向量数据库:**

- [LanceDB](https://github.com/lancedb/lancedb) (默认)
- [PGVector](https://github.com/pgvector/pgvector)
- [Astra DB](https://www.datastax.com/products/datastax-astra)
- [Pinecone](https://pinecone.io)
- [Chroma](https://trychroma.com)
Expand Down
5 changes: 5 additions & 0 deletions server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ SIG_SALT='salt' # Please generate random string at least 32 chars long.
# Enable all below if you are using vector database: LanceDB.
VECTOR_DB="lancedb"

# Enable all below if you are using vector database: Weaviate.
# VECTOR_DB="pgvector"
# PGVECTOR_CONNECTION_STRING="postgresql://dbuser:dbuserpass@localhost:5432/yourdb"
# PGVECTOR_TABLE_NAME="anythingllm_vectors" # optional, but can be defined

# Enable all below if you are using vector database: Weaviate.
# VECTOR_DB="weaviate"
# WEAVIATE_ENDPOINT="http://localhost:8080"
Expand Down
5 changes: 5 additions & 0 deletions server/models/systemSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { isValidUrl, safeJsonParse } = require("../utils/http");
const prisma = require("../utils/prisma");
const { v4 } = require("uuid");
const { MetaGenerator } = require("../utils/boot/MetaGenerator");
const { PGVector } = require("../utils/vectorDbProviders/pgvector");

function isNullOrNaN(value) {
if (value === null) return true;
Expand Down Expand Up @@ -427,6 +428,10 @@ const SystemSettings = {
// AstraDB Keys
AstraDBApplicationToken: process?.env?.ASTRA_DB_APPLICATION_TOKEN,
AstraDBEndpoint: process?.env?.ASTRA_DB_ENDPOINT,

// PGVector Keys
PGVectorConnectionString: !!PGVector.connectionString() || false,
PGVectorTableName: PGVector.tableName(),
};
},

Expand Down
3 changes: 3 additions & 0 deletions server/utils/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ function getVectorDbClass(getExactly = null) {
case "astra":
const { AstraDB } = require("../vectorDbProviders/astra");
return AstraDB;
case "pgvector":
const { PGVector } = require("../vectorDbProviders/pgvector");
return PGVector;
default:
throw new Error("ENV: No VECTOR_DB value found in environment!");
}
Expand Down
Loading