hp_chatbot/chat-interface/update-backend.sh
michael 594f749d4c Initial commit: HP Marketing Materials GraphRAG Chatbot
Full-stack GraphRAG chatbot for HP marketing materials with:
- Python/Flask backend with custom ReAct agent (LlamaIndex)
- Neo4j knowledge graph + vector search hybrid retrieval
- LlamaParse multimodal document processing (text + images)
- React/Vite frontend with conversation management
- MongoDB conversation persistence
- MSAL authentication support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 08:37:58 -06:00

38 lines
No EOL
1.4 KiB
Bash
Executable file

#!/bin/bash
# This script updates the backend URL and rebuilds the application
# Define the backend URL
BACKEND_URL="https://ai-sandbox.oliver.solutions/netflix_back_v2"
# Create or update the environment files
echo "# Backend API URL
VITE_BACKEND_URL=${BACKEND_URL}
# Base URL for the app (changes in production)
VITE_APP_BASE_URL=/" > .env
echo "# Production backend API URL
VITE_BACKEND_URL=${BACKEND_URL}
# Base URL for the app in production
VITE_APP_BASE_URL=/netflix_v2/" > .env.production
# Update components files
for file in src/components/ChatInterface.jsx src/components/ConversationManager.jsx src/App.jsx; do
# Replace hardcoded backend URL references
sed -i '' "s|const BACKEND_URL = ['\"]\/netflix_back_v2['\"]|const BACKEND_URL = import.meta.env.VITE_BACKEND_URL || '${BACKEND_URL}'|g" $file
sed -i '' "s|console.log('.*using backend URL (hardcoded):|console.log('Using backend URL:|g" $file
done
# Update vite.config.js to use the replacement plugin
sed -i '' 's|plugins: \[react()\],|plugins: [react(), replaceBackendUrl],|g' vite.config.js
sed -i '' 's|code: src.replace(/\['"'\]\/netflix_back\['"'\]/g, '"\/netflix_back_v2"'),|code: src.replace(/\['"'\]\/netflix_back\['"'\]/g, `"${BACKEND_URL}"`),|g' vite.config.js
# Force a complete rebuild by removing all assets
rm -rf dist/assets/*
# Rebuild the application
npm run build
echo "Update complete! The backend URL has been set to ${BACKEND_URL}"