-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b48e81
commit 6d01970
Showing
27 changed files
with
1,116 additions
and
509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
SERVER_PORT=5000 | ||
OPEN_AI_KEY= | ||
OPEN_MODEL_PREF='gpt-3.5-turbo' | ||
# AUTH_TOKEN="hunter2" # This is the password to your application if remote hosting. | ||
CACHE_VECTORS="true" | ||
|
||
# Enable all below if you are using vector database: Chroma. | ||
# VECTOR_DB="chroma" | ||
# CHROMA_ENDPOINT='http://localhost:8000' | ||
|
||
# Enable all below if you are using vector database: Pinecone. | ||
VECTOR_DB="pinecone" | ||
PINECONE_ENVIRONMENT= | ||
PINECONE_API_KEY= | ||
PINECONE_INDEX= | ||
AUTH_TOKEN="hunter2" # This is the password to your application if remote hosting. | ||
CACHE_VECTORS="true" | ||
PINECONE_INDEX= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v18.12.1 | ||
v18.13.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,46 @@ | ||
require('dotenv').config({ path: `.env.${process.env.NODE_ENV}` }) | ||
const { Pinecone } = require('../utils/pinecone'); | ||
const { viewLocalFiles } = require('../utils/files'); | ||
require("dotenv").config({ path: `.env.${process.env.NODE_ENV}` }); | ||
const { viewLocalFiles } = require("../utils/files"); | ||
const { getVectorDbClass } = require("../utils/helpers"); | ||
|
||
function systemEndpoints(app) { | ||
if (!app) return; | ||
|
||
app.get('/ping', (_, response) => { | ||
app.get("/ping", (_, response) => { | ||
response.sendStatus(200); | ||
}) | ||
}); | ||
|
||
app.get('/setup-complete', (_, response) => { | ||
app.get("/setup-complete", (_, response) => { | ||
const vectorDB = process.env.VECTOR_DB || "pinecone"; | ||
const results = { | ||
VectorDB: vectorDB, | ||
OpenAiKey: !!process.env.OPEN_AI_KEY, | ||
OpenAiModelPref: process.env.OPEN_MODEL_PREF || 'gpt-3.5-turbo', | ||
PineConeEnvironment: process.env.PINECONE_ENVIRONMENT, | ||
PineConeKey: !!process.env.PINECONE_API_KEY, | ||
PinceConeIndex: process.env.PINECONE_INDEX, | ||
} | ||
response.status(200).json({ results }) | ||
}) | ||
OpenAiModelPref: process.env.OPEN_MODEL_PREF || "gpt-3.5-turbo", | ||
...(vectorDB === "pinecone" | ||
? { | ||
PineConeEnvironment: process.env.PINECONE_ENVIRONMENT, | ||
PineConeKey: !!process.env.PINECONE_API_KEY, | ||
PineConeIndex: process.env.PINECONE_INDEX, | ||
} | ||
: {}), | ||
...(vectorDB === "chroma" | ||
? { | ||
ChromaEndpoint: process.env.CHROMA_ENDPOINT, | ||
} | ||
: {}), | ||
}; | ||
response.status(200).json({ results }); | ||
}); | ||
|
||
app.get('/system-vectors', async (_, response) => { | ||
const vectorCount = await Pinecone.totalIndicies(); | ||
response.status(200).json({ vectorCount }) | ||
}) | ||
app.get("/system-vectors", async (_, response) => { | ||
const VectorDb = getVectorDbClass(); | ||
const vectorCount = await VectorDb.totalIndicies(); | ||
response.status(200).json({ vectorCount }); | ||
}); | ||
|
||
app.get('/local-files', async (_, response) => { | ||
const localFiles = await viewLocalFiles() | ||
response.status(200).json({ localFiles }) | ||
}) | ||
app.get("/local-files", async (_, response) => { | ||
const localFiles = await viewLocalFiles(); | ||
response.status(200).json({ localFiles }); | ||
}); | ||
} | ||
|
||
module.exports = { systemEndpoints } | ||
module.exports = { systemEndpoints }; |
Oops, something went wrong.