netflix/chat-interface/update-backend.sh
michael 236d1ddbd8 Initial commit: Netflix GraphRAG marketing chatbot
Full-stack application combining LlamaIndex vector search with Neo4j
knowledge graph (GraphRAG) for answering queries about Netflix marketing
materials. Flask/Hypercorn backend with custom ReAct agent, React frontend.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 10:28:33 -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}"