Skip to content

Commit 43167cf

Browse files
committed
refactor: Simplify Dockerfile and README, remove deprecated scripts
- Remove unnecessary environment variables from Dockerfile - Update README with new dashboard configuration details - Remove deprecated chunking script - Update knowledge base upload process in README - Remove ENCRYPTION.md from utils directory - Modify knowledgebase file upload API to use credentials from database
1 parent 76db54f commit 43167cf

File tree

5 files changed

+31
-223
lines changed

5 files changed

+31
-223
lines changed

Dockerfile

-6
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,13 @@ WORKDIR /app
2020
COPY --from=deps /app/node_modules ./node_modules
2121
COPY . .
2222

23-
ARG PINECONE_API_KEY
2423
ARG PINECONE_INDEX
25-
ARG RIPESEED_OPENAI_API_KEY
26-
ARG RIPESEED_DOC_INDEX_ID
2724
ARG MONGO_CONNECTION_STRING
2825
ARG OPENAI_API_KEY
2926
ARG NEXT_PUBLIC_CALENDLY
3027

3128
ENV OPENAI_API_KEY=$OPENAI_API_KEY
32-
ENV PINECONE_API_KEY=$PINECONE_API_KEY
3329
ENV PINECONE_INDEX=$PINECONE_INDEX
34-
ENV RIPESEED_OPENAI_API_KEY=$RIPESEED_OPENAI_API_KEY
35-
ENV RIPESEED_DOC_INDEX_ID=$RIPESEED_DOC_INDEX_ID
3630
ENV MONGO_CONNECTION_STRING=$MONGO_CONNECTION_STRING
3731
ENV NEXT_PUBLIC_CALENDLY=$NEXT_PUBLIC_CALENDLY
3832

File renamed without changes.

README.md

+22-16
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Try the deployed application on the link [here](https://ask.ripeseed.io). "Ask R
4646
Ask RipeSeed utilizes a modern and efficient tech stack to deliver a robust user experience. Below is an overview of the core libraries and tools used in the project:
4747

4848
| Library | Category | Version | Description |
49-
| ------------------------ | ----------------------- | -------- | ------------------------------------------------------------------------------------------ | --- |
49+
| ------------------------ | ----------------------- | -------- | ------------------------------------------------------------------------------------------ |
5050
| Next.js | Web Framework | v14.2.3 | A powerful React framework for building scalable web applications. |
5151
| TypeScript | Language | v5 | Provides static type checking to improve code quality and maintainability. |
5252
| Tailwind CSS | Styling Framework | v3.4.1 | A utility-first CSS framework for rapidly building custom designs. |
@@ -59,7 +59,6 @@ Ask RipeSeed utilizes a modern and efficient tech stack to deliver a robust user
5959
| Dexie | IndexedDB Wrapper | v4.0.7 | A minimalistic wrapper for IndexedDB to handle local storage effectively. |
6060
| PDF-parse | Document Parsing | v1.1.1 | Parses and processes PDF documents to extract content. |
6161
| Radix-ui | UI Components | v1.0.x | Provides a set of accessible and composable UI components for React. |
62-
| Valtio | State Management | v1.13.2 | A simple and efficient state management library for React. |
6362
| react-syntax-highlighter | Syntax Highlighting | v15.5.0 | Provides syntax highlighting for code snippets and markdown content. |
6463
| rehype-highlight | Markdown Parser | v7.0.0 | A plugin for Rehype to highlight code blocks in markdown. |
6564
| rehype-katex | Math Rendering | v7.0.0 | A plugin for Rehype to render math expressions using KaTeX. | |
@@ -71,18 +70,25 @@ Additional dependencies include several Radix UI components, libraries for state
7170

7271
## Documentation
7372

74-
### Replacing the RipeSeed Knowledge Base
73+
### Dashboard Configuration
7574

76-
To customize the chatbot's responses with your own knowledge base, follow these steps to create and upload document chunks:
75+
We are excited to introduce a new dashboard that allows users to easily configure various aspects of the Ask RipeSeed application. You can access the dashboard via the `/dashboard` route.
7776

78-
1. **Prepare Your Documents**: We have provided a [template](https://github.com/RipeSeed/ask-ripeseed/blob/main/public/example-docs/knowledgebase.template) and an [example document](https://github.com/RipeSeed/ask-ripeseed/blob/main/public/example-docs/knowledgebase) to start with and give agencies an idea on how should they create their knowledgebase. Use that or create your own document and place that in PDF format in the "Documents" folder located in the same directory as the chunking script.
79-
2. **Run the Chunking Script**: Use our script located [here](https://github.com/RipeSeed/ask-ripeseed/blob/main/scripts/ask_ripeseed_LC_chunking.ipynb). This script is an `.ipynb` file that can be run locally using Jupyter Notebook or online via Google Colab.
80-
3. **Configure the Script**: In the `upload_documents_service` function, set up the following variables:
81-
- `api_key`: Your Pinecone API key.
82-
- `pinecone.Index()`: Your Pinecone index name.
83-
- `openai_api_key`: Your OpenAI API key.
84-
- `id`: A hardcoded identifier in the metadata of vectors for distinguishing your documents in the vector database.
85-
4. **Run the Script**: Execute all the cells in sequence. This will vectorize your documents and store them in Pinecone with the specified index and metadata.
77+
If there are no users in the database, you will be first navigated to the registration page. This is a one-time process, and after completing registration, you will not be able to access the registration route again.
78+
79+
With this dashboard, you can manage:
80+
81+
- **Models**: Select and configure the AI models used for responses.
82+
- **Pinecone**: Set up and manage your Pinecone index for efficient data storage and retrieval.
83+
- **Calendly**: Integrate your Calendly link for seamless scheduling.
84+
- **Prompts**: Customize the prompts used by the AI to tailor responses to your needs.
85+
- **Knowledge Base**: Upload and manage your knowledge base documents directly from the dashboard.
86+
87+
This new feature simplifies the setup process and enhances the overall user experience, making it easier to customize the AI assistant to fit your specific requirements.
88+
89+
## Encryption
90+
91+
For security purposes, sensitive data is encrypted. For detailed information about the encryption methods implemented in this project, please refer to the [ENCRYPTION.md](ENCRYPTION.md) file located in the root of the project.
8692

8793
## Running the Application
8894

@@ -99,12 +105,12 @@ To run Ask RipeSeed locally, follow these steps:
99105

100106
- `MONGO_CONNECTION_STRING`: Your MongoDB connection string.
101107
- `NEXT_PUBLIC_GA_ID`: Google Analytics ID.
102-
- `OPENAI_KEY`: Your OpenAI API key.
103-
- `PINECONE_API_KEY`: Your Pinecone API key.
104108
- `PINECONE_INDEX`: Your Pinecone index name.
105-
- `RIPESEED_DOC_INDEX_ID`: The hardcoded ID for your indexed document in Pinecone.
106-
- `RIPESEED_OPENAI_API_KEY`: OpenAI key for querying the knowledge base.
107109
- `NEXT_PUBLIC_CALENDLY`: Your calendly link.
110+
- `ENCRYPTION_KEY`: Your encryption key for securing sensitive data.
111+
- `JWT_SEC`: Your JSON Web Token secret for authentication.
112+
- `AUTH_SECRET`: Your authentication secret key.
113+
- `BASE_URL`: The base URL of your application.
108114

109115
3. **Install Dependencies**:
110116

scripts/ask_ripeseed_LC_chunking.ipynb

-200
This file was deleted.

src/app/api/(admin)/knowledgebase/file/route.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { v4 as uuid } from 'uuid'
77
import { connectDB } from '@/models'
88
import FileModel from '@/models/knowledgeBase/File.model'
99
import { getPineconeIndex } from '@/services/pinecone/client'
10+
import APICredentials from '@/models/credentials/APICredentials.model'
1011

1112
export const POST = async (request: NextRequest, response: NextResponse) => {
1213
try {
@@ -35,8 +36,15 @@ export const POST = async (request: NextRequest, response: NextResponse) => {
3536
const chunks = outPut.map((chunk) => chunk.pageContent.replace(/\n/g, ''))
3637
const chunksLength = chunks.length
3738

39+
await connectDB()
40+
const credentials = await APICredentials.findOne()
41+
42+
if (!credentials || !credentials.providers.openai?.apiKey) {
43+
throw new Error('OpenAI API key not found in database')
44+
}
45+
3846
const embeddings = new OpenAIEmbeddings({
39-
apiKey: process.env.OPENAI_KEY,
47+
apiKey: credentials.providers.openai.apiKey,
4048
})
4149

4250
const vectors = await embeddings.embedDocuments(chunks)

0 commit comments

Comments
 (0)