File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,10 +196,7 @@ const TopicHistogram: FC = () => {
196196 const [ isLoadingExplanation , setIsLoadingExplanation ] = useState ( false ) ;
197197
198198 // State for API key
199- const [ apiKey , setApiKey ] = useState < string > ( ( ) => {
200- // Try to get from localStorage first
201- return localStorage . getItem ( 'GOOGLE_API_KEY' ) || '' ;
202- } ) ;
199+ const [ apiKey , setApiKey ] = useState < string > ( '' ) ;
203200
204201 // Add API key input modal - initialize to false instead of !apiKey
205202 const [ showApiKeyModal , setShowApiKeyModal ] = useState ( false ) ;
@@ -232,7 +229,6 @@ const TopicHistogram: FC = () => {
232229 // Function to save API key and fetch explanation if a topic was clicked
233230 const saveApiKey = ( key : string ) => {
234231 setApiKey ( key ) ;
235- localStorage . setItem ( 'GOOGLE_API_KEY' , key ) ;
236232 setShowApiKeyModal ( false ) ;
237233
238234 // If there was a topic waiting for explanation, fetch it now
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ # Function to check if a port is in use
4+ check_port () {
5+ lsof -i :$1 > /dev/null 2>&1
6+ return $?
7+ }
8+
9+ # Function to kill process using a port
10+ kill_port () {
11+ local port=$1
12+ if check_port $port ; then
13+ echo " Port $port is in use. Attempting to kill the process..."
14+ lsof -ti :$port | xargs kill -9 2> /dev/null
15+ sleep 1
16+ if check_port $port ; then
17+ echo " Failed to kill process on port $port . Please check manually."
18+ exit 1
19+ else
20+ echo " Successfully killed process on port $port "
21+ fi
22+ fi
23+ }
24+
25+ # Kill any existing process on port 5002
26+ kill_port 5002
27+
328# Start the Gunicorn backend server in the background
429echo " Starting backend server..."
530cd backend/app
@@ -8,6 +33,12 @@ gunicorn -b 127.0.0.1:5002 main:app &
833# Wait a moment for the backend to start
934sleep 2
1035
36+ # Verify backend is running
37+ if ! check_port 5002; then
38+ echo " Failed to start backend server. Please check the logs."
39+ exit 1
40+ fi
41+
1142# Start the frontend development server
1243echo " Starting frontend server..."
1344cd ../..
You can’t perform that action at this time.
0 commit comments