Merge branch 'master' of github.com:Mintplex-Labs/vector-admin into ui-v2

This commit is contained in:
timothycarambat
2024-01-10 13:55:42 -08:00
17 changed files with 229 additions and 95 deletions
+1
View File
@@ -0,0 +1 @@
github: Mintplex-Labs
+43
View File
@@ -0,0 +1,43 @@
name: 🐛 Bug Report
description: File a bug report for VectorAdmin
title: "[BUG]: "
labels: [possible bug]
body:
- type: markdown
attributes:
value: |
Use this template to file a bug report for VectorAdmin. Please be as descriptive as possible to allow everyone to replicate and solve your issue.
Want help contributing a PR? Use our repo chatbot by OnboardAI! https://app.getonboardai.com/chat/github/mintplex-labs/vector-admin
- type: dropdown
id: runtime
attributes:
label: How are you running VectorAdmin?
description: VectorAdmin can be run in many environments, pick the one that best represents where you encounter the bug.
options:
- Docker (local)
- Docker (remote machine)
- Local development
- Not listed
default: 0
validations:
required: true
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Are there known steps to reproduce?
description: |
Let us know how to reproduce the bug and we may be able to fix it more
quickly. This is not required, but it is helpful.
validations:
required: false
+22
View File
@@ -0,0 +1,22 @@
name: ✨ New Feature suggestion
description: Suggest a new feature for VectorAdmin!
title: "[FEAT]: "
labels: [enhancement, feature request]
body:
- type: markdown
attributes:
value: |
Share a new idea for a feature or improvement. Be sure to search existing
issues first to avoid duplicates.
Want help contributing a PR? Use our repo chatbot by OnboardAI! https://app.getonboardai.com/chat/github/mintplex-labs/vector-admin
- type: textarea
id: description
attributes:
label: What would you like to see?
description: |
Describe the feature and why it would be useful to your use-case as well as others.
validations:
required: true
@@ -0,0 +1,13 @@
name: 📚 Documentation improvement
title: "[DOCS]: "
description: Report an issue or problem with the documentation.
labels: [documentation]
body:
- type: textarea
id: description
attributes:
label: Description
description: Describe the issue with the documentation that is giving you trouble or causing confusion.
validations:
required: true
+5
View File
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: 🧑‍🤝‍🧑 Community Discord
url: https://discord.gg/6UyHPeGZAC
about: Interact with the Mintplex Labs community here by asking for help, discussing and more!
+21 -1
View File
@@ -1,8 +1,19 @@
name: Publish Docker image and Github Registry
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: ['master']
paths-ignore:
- '**.md'
- 'cloud-deployments/*'
- 'images/**/*'
- '.vscode/**/*'
- '**/.env.example'
- '.github/ISSUE_TEMPLATE/**/*'
jobs:
push_to_registries:
@@ -14,6 +25,11 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Parse repository name to lowercase
shell: bash
run: echo "repo=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
id: lowercase_repo
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
@@ -41,6 +57,10 @@ jobs:
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
tags: |
${{ steps.meta.outputs.tags }}
${{ github.ref_name == 'master' && 'mintplexlabs/vectoradmin:latest' || '' }}
${{ github.ref_name == 'master' && format('ghcr.io/{0}:{1}', steps.lowercase_repo.outputs.repo, 'latest') || '' }}
labels: ${{ steps.meta.outputs.labels }}
+1 -1
View File
@@ -6,4 +6,4 @@ SYS_PASSWORD=password
JWT_SECRET="YoUr_RaNd0M_sTr1nG"
# STORAGE_DIR=
DATABASE_CONNECTION_STRING="postgresql://user:password@host:port/database
DATABASE_CONNECTION_STRING="postgresql://user:password@host:port/database"
+1 -1
View File
@@ -24,7 +24,7 @@
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"express-admin": "^2.0.0",
"@mintplex-labs/express-admin": "^0.0.1",
"graphql": "^16.8.1",
"js-tiktoken": "^1.0.7",
"jsonwebtoken": "^8.5.1",
+1 -50
View File
@@ -1,45 +1,11 @@
process.env.NODE_ENV === "development"
? require("dotenv").config({ path: `.env.${process.env.NODE_ENV}` })
: require("dotenv").config();
const { DocumentVectors } = require("../../models/documentVectors");
const { Organization } = require("../../models/organization");
const { OrganizationApiKey } = require("../../models/organizationApiKey");
const {
OrganizationConnection,
} = require("../../models/organizationConnection");
const { OrganizationUser } = require("../../models/organizationUser");
const { OrganizationWorkspace } = require("../../models/organizationWorkspace");
const { Queue } = require("../../models/queue");
const { SystemSettings } = require("../../models/systemSettings");
const { Telemetry } = require("../../models/telemetry");
const { User } = require("../../models/user");
const { WorkspaceDocument } = require("../../models/workspaceDocument");
const { getGitVersion } = require("../metrics");
// function findOrCreateDBFile() {
// const fs = require("fs");
// const path = require("path");
// const storageFolder = path.resolve(__dirname, `../../storage/`);
// const dbPath = `${storageFolder}/vdbms.db`;
// if (!fs.existsSync(storageFolder)) fs.mkdirSync(storageFolder);
// if (fs.existsSync(dbPath)) return;
// fs.writeFileSync(dbPath, "");
// console.log("SQLite db created on boot.");
// return;
// }
// function findOrCreateJobDBFile() {
// const path = require("path");
// const fs = require("fs");
// const storageFolder = path.resolve(__dirname, `../../storage/`);
// const dbPath = `${storageFolder}/job_queue.db`;
// if (!fs.existsSync(storageFolder)) fs.mkdirSync(storageFolder);
// if (fs.existsSync(dbPath)) return;
// fs.writeFileSync(dbPath, "");
// console.log("SQLite jobs db created on boot.");
// return;
// }
function setupVectorCacheStorage() {
const fs = require("fs");
const path = require("path");
@@ -50,21 +16,6 @@ function setupVectorCacheStorage() {
return;
}
// Init all tables so to not try to reference foreign key
// tables that may not exist and also have their schema available.
// async function initTables() {
// (await SystemSettings.db()).close();
// (await User.db()).close();
// (await Organization.db()).close();
// (await OrganizationApiKey.db()).close();
// (await OrganizationConnection.db()).close();
// (await OrganizationUser.db()).close();
// (await OrganizationWorkspace.db()).close();
// (await WorkspaceDocument.db()).close();
// (await DocumentVectors.db()).close();
// (await Queue.db()).close();
// }
// Telemetry is anonymized and your data is never read. This can be disabled by setting
// DISABLE_TELEMETRY=true in the `.env` of however you setup. Telemetry helps us determine use
// of how VectorAdmin is used and how to improve this product!
+1 -1
View File
@@ -1,4 +1,4 @@
const dbAdmin = require("express-admin");
const dbAdmin = require("@mintplex-labs/express-admin");
const path = require("path");
const { SystemSettings } = require("../../models/systemSettings");
@@ -12,6 +12,40 @@ class Chroma {
this.config = this.setConfig(connector);
}
// For use with ChromaClient SDK only.
#appendClientAuthHeaders() {
const { settings } = this.config;
if (!settings?.authToken) return {};
const headerName = settings.authTokenHeader || "X-Api-Key";
const authToken =
headerName === "Authorization"
? `Bearer ${settings.authToken}`
: settings.authToken;
return {
fetchOptions: {
headers: {
[headerName]: authToken,
},
},
};
}
// For use with fetch API endpoints only.
#appendRawAuthHeaders() {
const { settings } = this.config;
if (!settings?.authToken) return {};
const headerName = settings.authTokenHeader || "X-Api-Key";
const authToken =
headerName === "Authorization"
? `Bearer ${settings.authToken}`
: settings.authToken;
return {
[headerName]: authToken,
};
}
setConfig(config) {
var { type, settings } = config;
if (typeof settings === "string") settings = JSON.parse(settings);
@@ -34,15 +68,7 @@ class Chroma {
const client = new ChromaClient({
path: settings.instanceURL,
...(settings?.authToken
? {
fetchOptions: {
headers: {
[settings.authTokenHeader || "X-Api-Key"]: settings.authToken,
},
},
}
: {}),
...this.#appendClientAuthHeaders(),
});
const isAlive = await client.heartbeat();
@@ -127,6 +153,7 @@ class Chroma {
headers: {
accept: "application/json",
"Content-Type": "application/json",
...this.#appendRawAuthHeaders(),
},
body: JSON.stringify({
limit: pageSize,
+37 -24
View File
@@ -46,6 +46,31 @@
semver "^7.3.5"
tar "^6.1.11"
"@mintplex-labs/express-admin@^0.0.1":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@mintplex-labs/express-admin/-/express-admin-0.0.1.tgz#f745b450dd6759d330446be7921b7f6e93056b91"
integrity sha512-p4b4ibXHklqc380qAKrIFjA6t1p0MUOU8bOdqRrntuhPz4GGSjgfzn0k20Mzs4V8VQ5QfU6iibHb/ciCLvsIKQ==
dependencies:
async "^0.9.2"
body-parser "^1.20.1"
connect-multiparty "^2.2.0"
consolidate "^0.16.0"
cookie-parser "^1.4.6"
csurf "^1.11.0"
deep-copy "^1.4.2"
express "^4.18.2"
express-admin-static "^2.2.2"
express-session "^1.17.3"
hogan.js "^3.0.2"
method-override "^2.3.10"
moment "^2.29.4"
mysql-validator "^0.1.6"
object-deep-compare "^1.2.0"
serve-static "^1.15.0"
slugify "^1.6.5"
sr-pagination "^1.0.1"
xsql "^1.0.1"
"@npmcli/fs@^1.0.0":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@npmcli/fs/-/fs-1.1.1.tgz#72f719fe935e687c56a4faecf3c03d06ba593257"
@@ -761,30 +786,6 @@ express-admin-static@^2.2.2:
resolved "https://registry.yarnpkg.com/express-admin-static/-/express-admin-static-2.2.2.tgz#606daa55bb47976c6168bc07f91934ac5278721f"
integrity sha512-wjI9lwZB89BqyMiupPa6tVzeMstA5zYcg/5nEaCRXzUxXtsf+MpROsKZ0/TnlldTSRBwxiKIyOz+NOdpygcCCQ==
express-admin@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/express-admin/-/express-admin-2.0.0.tgz#4a515f03b7071acafc3c9695da2a3856736c4996"
integrity sha512-815XtCZ9qtUZVI9Hx5c1o00fjAAGmqLXGxkDgCwWDX6q/Ne0ABFeB4S74afLRPHeuOqJy2odltvSVRSJH1+vUA==
dependencies:
async "^0.9.2"
body-parser "^1.20.1"
connect-multiparty "^2.2.0"
consolidate "^0.16.0"
cookie-parser "^1.4.6"
csurf "^1.11.0"
deep-copy "^1.4.2"
express "^4.18.2"
express-admin-static "^2.2.2"
express-session "^1.17.3"
hogan.js "^3.0.2"
method-override "^2.3.10"
moment "^2.29.4"
mysql-validator "^0.1.6"
serve-static "^1.15.0"
slugify "^1.6.5"
sr-pagination "^1.0.1"
xsql "^1.0.1"
express-session@^1.17.3:
version "1.17.3"
resolved "https://registry.yarnpkg.com/express-session/-/express-session-1.17.3.tgz#14b997a15ed43e5949cb1d073725675dd2777f36"
@@ -1358,6 +1359,11 @@ lodash.once@^4.0.0:
resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
integrity sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==
lodash@^4.17.20:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
lru-cache@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
@@ -1727,6 +1733,13 @@ object-assign@^4, object-assign@^4.1.1:
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==
object-deep-compare@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/object-deep-compare/-/object-deep-compare-1.2.0.tgz#f9d22a294fd5807b27b804bde15e3a2f68a55466"
integrity sha512-avtOP/QUywajg2LH01jQ8eikIiV3nwDU0Z0fvEl/vVrSg1XDY7KolblJECjEa477pocludBtexT5jW7jfrOXUw==
dependencies:
lodash "^4.17.20"
object-hash@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9"
+8 -3
View File
@@ -2,15 +2,20 @@ const fs = require('fs');
const path = require('path');
const serverEnvTemplate = path.resolve(__dirname, 'backend/.env.example');
const serverEnv = path.resolve(__dirname, 'backend/.env.development')
const serverDevEnv = path.resolve(__dirname, 'backend/.env.development')
const serverEnv = path.resolve(__dirname, 'backend/.env')
const frontendEnvTemplate = path.resolve(__dirname, 'frontend/.env.example');
const frontendEnv = path.resolve(__dirname, 'frontend/.env')
const workerEnvTemplate = path.resolve(__dirname, 'workers/.env.example');
const workerEnv = path.resolve(__dirname, 'workers/.env')
if (!fs.existsSync(serverEnv)) {
console.log("Copying server env file template.");
if (!fs.existsSync(serverEnv) || !fs.existsSync(serverDevEnv)) {
console.log("Copying server env & env.development file template.");
fs.writeFileSync(serverDevEnv, '');
fs.writeFileSync(serverEnv, '');
fs.copyFileSync(serverEnvTemplate, serverDevEnv);
fs.copyFileSync(serverEnvTemplate, serverEnv);
console.log("Server env file created.");
}
+2 -2
View File
@@ -14,7 +14,7 @@ Run this command first to get a dockerized Postgres container running:
`docker-compose up -d --build postgres`
## Run from Docker pre-built image
- `docker pull mintplexlabs/vectoradmin:master` to pull in latest image
- `docker pull mintplexlabs/vectoradmin` to pull in latest image
- Run the command with env variables and image defined.
`docker run -d -p 3001:3001 \
-e SERVER_PORT="3001" \
@@ -25,7 +25,7 @@ Run this command first to get a dockerized Postgres container running:
-e INNGEST_SIGNING_KEY="random-string-goes-here" \
-e INNGEST_LANDING_PAGE="true" \
-e DATABASE_CONNECTION_STRING="postgresql://vectoradmin:password@xxxxxxx:5432/vdbms" \
mintplexlabs/vectoradmin:master`
mintplexlabs/vectoradmin`
## Build docker image from source
-1
View File
@@ -22,7 +22,6 @@ services:
vector-admin:
container_name: vector-admin
image: vector-admin:latest
platform: linux/amd64
build:
context: ../.
dockerfile: ./docker/Dockerfile
+1 -2
View File
@@ -1,5 +1,4 @@
export const API_BASE =
import.meta.env.VITE_API_BASE || 'http://127.0.0.1:3001/api';
export const API_BASE = import.meta.env.VITE_API_BASE || '/api';
export const APP_NAME = import.meta.env.VITE_APP_NAME || 'VDMS';
export const STORE_USER = 'vdms_user';
export const STORE_TOKEN = 'vdms_authToken';
+36
View File
@@ -0,0 +1,36 @@
### Pull Request Type
<!-- For change type, change [ ] to [x]. -->
- [ ] ✨ feat
- [ ] 🐛 fix
- [ ] ♻️ refactor
- [ ] 💄 style
- [ ] 🔨 chore
- [ ] 📝 docs
### Relevant Issues
<!-- Use "resolves #xxx" to auto resolve on merge. Otherwise, please use "connect #xxx" -->
resolves #xxx
### What is in this change?
Describe the changes in this PR that are impactful to the repo.
### Additional Information
Add any other context about the Pull Request here that was not captured above.
### Developer Validations
<!-- All of the applicable items should be checked. -->
- [ ] I ran `yarn lint` from the root of the repo & committed changes
- [ ] Relevant documentation has been updated
- [ ] I have tested my code functionality
- [ ] Docker build succeeds locally