Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7500d51
Remove welcome.lottie file and update Welcome component to use welcom…
amankrs21 May 12, 2025
d934e2f
Update README and ZZZ.txt with project details and Azure deployment i…
amankrs21 May 12, 2025
c626898
Add feedback API endpoints for submitting and retrieving feedback
amankrs21 May 12, 2025
c7c4c0d
Add ChatFeedback component for user feedback on chat messages
amankrs21 May 12, 2025
1a2af75
Add feedback handling to ChatLayout component with like/dislike funct…
amankrs21 May 12, 2025
bc624fc
Improve error handling in Login component and manage loading state in…
amankrs21 May 12, 2025
0ee9d9b
Add Feedback component and route for displaying user feedback
amankrs21 May 12, 2025
c31a406
Add UI deployment workflow for React app to Cloudflare Pages
amankrs21 May 12, 2025
d96dbcc
Enhance feedback handling in ChatLayout component with async dislike …
amankrs21 May 14, 2025
03d7cf0
Update Feedback component to use small table size for improved layout
amankrs21 May 14, 2025
f6e2e61
Add Chat.css for chat layout styling and message formatting
amankrs21 May 14, 2025
cb4d6ce
Refactor Router component to correct route paths and ensure proper na…
amankrs21 May 14, 2025
9f0f6a8
Add ChatMainLayout component with chat functionality and message hand…
amankrs21 May 15, 2025
aff6547
Refactor ChatMainLayout to initialize messages state as empty array a…
amankrs21 May 15, 2025
f916331
Enhance ChatInput component by adding loading state support, adjustin…
amankrs21 May 16, 2025
71e1608
Add ChatInfoPop component for user manual and chat features overview
amankrs21 May 16, 2025
5e22ecc
Add ChatMessageBot and ChatMessageUser components for handling bot an…
amankrs21 May 18, 2025
d18a2b8
Refactor ChatHome component to enhance message handling, feedback fea…
amankrs21 May 18, 2025
24bdf6e
Update maxLength attribute in ChatInput component and remove unused C…
amankrs21 May 18, 2025
20d9f1c
Remove unused ChatLayout import from ChatMainLayout component
amankrs21 May 18, 2025
2328752
Refactor imports in App, Router, and index files for consistency and …
amankrs21 May 18, 2025
41c0a93
Move scrollbar styles to index.html and remove main.css
amankrs21 May 18, 2025
9339b29
Refactor code structure for improved readability and maintainability
amankrs21 May 20, 2025
e278e0e
Implement Login component and remove Welcome component and styles
amankrs21 May 20, 2025
241d53f
Add LogoutPop component for logout confirmation dialog; remove Login …
amankrs21 May 20, 2025
bbb087f
Remove AppHeader, MainLayout, and NavbarActions components to streaml…
amankrs21 May 20, 2025
1c1be62
Refactor PrivateRoutes and AuthContext for improved loading state han…
amankrs21 May 20, 2025
06045c2
Add Header component with navigation and logout functionality; includ…
amankrs21 May 20, 2025
d751bb0
Refactor import statements in Login component for improved readability
amankrs21 May 20, 2025
47c04ac
Add Account component for user account management; include placeholde…
amankrs21 May 20, 2025
9fd84ff
Update Loading component background color for improved visibility
amankrs21 May 20, 2025
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
28 changes: 28 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,31 @@ jobs:
with:
app-name: 'ragai'
slot-name: 'Production'


# 4. React App Hosting to Cloudflare (depends on Azure Web App deployment success)
ui-deployment:
name: UI Deployment
runs-on: ubuntu-latest
needs: fastapi-deployment
if: github.ref == 'refs/heads/main'

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install dependencies for React app
run: npm install
working-directory: ./client

- name: Build React app
run: npm run build
working-directory: ./client

- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: 'ragbot'
directory: 'client/dist'
108 changes: 107 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,107 @@
# GenAIChatBot
# 🤖 GENAI-RAG-BOT

A production-ready Generative AI Assistant built with Retrieval-Augmented Generation (RAG) architecture using **FastAPI**, **ChromaDB**, and **LLMs** (e.g., Mistral). This bot answers domain-specific queries using a vector store and never hallucinates — it only replies using relevant documents from its database.

---

## 🚀 Features

* 🔍 **Context-aware Retrieval** via [ChromaDB](https://www.trychroma.com/)
* 📚 **LangChain Integration**: Seamlessly chains LLM calls with retrieval, enabling advanced workflows like summarization, Q&A, and document parsing.
* 📚 **Document Embeddings**: Store and retrieve documents in vector format using cohere (embed-english-v3.0)
* 🧠 **LLM-Powered Responses** (e.g., Mistral via `mistral.ai`)
* 🔐 Strict: Only responds using data retrieved from vector store
* 💾 Source-aware: Supports citation-style responses
* 🧼 Clean **FastAPI** backend with CORS support
* ⚙️ Ready for deployment on Azure App Service
* 📦 Modular Router + Configured Error Handlers + Health Endpoint

---

## 🧠 How It Works

1. **User query** → `/api/chat`
2. **Query embedding** → Compare with ChromaDB document embeddings
3. **Retrieve top-k chunks** → Pass to the LLM as context
4. **Generate response** → Only if relevant chunks exist
5. **No relevant data?** → “Sorry, I don’t have any information about this.”

---

## ⚙️ Environment Variables

Create a `.env` file:

```env
PORT=your-port
HOST=http://localhost:5000
CORS_URL=http://localhost:5173
JWT_SECRET=your-secret
MONGO_URL=your-mongo-url
MISTRAL_MODEL_NAME=your-model-name
MISTRAL_API_KEY=your-mistral-api-key
COHERE_API_KEY=your-cohere-api-key
```

---

## 💻 Local Development

```bash
# 1. Clone the repo
git clone https://github.com/amankrs21/GENAI-RAG-BOT.git
cd GENAI-RAG-BOT

# 2. Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate

# 3. Install dependencies
pip install -r requirements.txt

# 4. Run the server
uvicorn main:app --reload
```

Then visit: [http://localhost:5000/health](http://localhost:5000/health)

---

## 🛡️ Agent Behavior

This bot **does not hallucinate**.

> It only replies based on retrieved chunks from the ChromaDB vector store.
> If nothing relevant is found, it replies:
> *“Sorry, I don’t have any information about this.”*

---

## 📦 Requirements

* Python 3.9+
* FastAPI
* Uvicorn
* ChromaDB
* Requests
* Uplinks for Mistral/LLM calls

(See `requirements.txt` for full list)

---

## 📄 License

This project is licensed under the Apache 2.0 License. See the [LICENSE](LICENSE) file for details.

---

## 🙋‍♂️ Author

Built with ❤️ by [**@amankrs21**](https://github.com/amankrs21)

---

## ✨ Want to Contribute?

PRs are welcome! This is just the beginning of RAG-native GenAI tooling.
12 changes: 9 additions & 3 deletions ZZZ.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
--------------------------------------------------------------------
WHILE DEPLOYEMENT ON AZURE WEB APP:
Copy link

Copilot AI May 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo in 'DEPLOYEMENT'; please correct it to 'DEPLOYMENT'.

Suggested change
WHILE DEPLOYEMENT ON AZURE WEB APP:
WHILE DEPLOYMENT ON AZURE WEB APP:

Copilot uses AI. Check for mistakes.
** NAVIGATE TO > AZURE WEB APP > SETTINGS > CONFIGURATION **
Then set the Startup command as-
- gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app
--------------------------------------------------------------------

--------------------------------------------------------------------------------------
GENAIBOT/
├── client/ # Contains all the UI (React)
├── src/
Expand All @@ -15,6 +23,4 @@ GENAIBOT/
|
|── main.py # FastAPI app
└── requirements.txt


TODO: Need to refreactor whole chroma DB Logic.
--------------------------------------------------------------------------------------
3 changes: 3 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
margin: 0;
padding: 0;
box-sizing: border-box;
scrollbar-width: thin;
scroll-behavior: smooth;
scrollbar-color: #757575 transparent;
}
</style>

Expand Down
Binary file removed client/public/BotImage.png
Binary file not shown.
1 change: 0 additions & 1 deletion client/public/LandingBackground.svg

This file was deleted.

Loading