Skip to content

Commit 244d12c

Browse files
committed
updated http
1 parent 79d3aed commit 244d12c

File tree

10 files changed

+78
-135
lines changed

10 files changed

+78
-135
lines changed

.env.example

Lines changed: 0 additions & 4 deletions
This file was deleted.

frontend/src/services/api/client.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,48 @@
11
import axios from 'axios';
22

3+
34
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
45

56

7+
console.log('Protocol mismatch warning:', window.location.protocol === 'https:' && API_BASE_URL.startsWith('http:'));
8+
69
const apiClient = axios.create({
710
baseURL: API_BASE_URL,
811
headers: {
912
'Content-Type': 'application/json',
1013
},
14+
timeout: 30000,
1115
});
1216

13-
1417
apiClient.interceptors.request.use(
1518
(config) => {
1619
const token = localStorage.getItem('firebase_token');
1720
if (token) {
1821
config.headers.Authorization = `Bearer ${token}`;
1922
}
23+
24+
// Log the request URL for debugging
25+
console.log('Making HTTP request to:', `${config.baseURL}${config.url}`);
26+
2027
return config;
2128
},
2229
(error) => {
2330
return Promise.reject(error);
2431
}
2532
);
2633

27-
2834
apiClient.interceptors.response.use(
2935
(response) => {
3036
return response;
3137
},
3238
(error) => {
3339
console.error('API Error:', error);
40+
console.error('Error details:', {
41+
url: error.config?.url,
42+
baseURL: error.config?.baseURL,
43+
status: error.response?.status,
44+
message: error.message
45+
});
3446

3547
// If token is invalid, clear it
3648
if (error.response?.status === 401) {

frontend/src/services/api/watchlistAPI.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const watchlistAPI = {
55
getWatchlist: async () => {
66
try {
77
const response = await apiClient.get('/watchlists/');
8+
console.log('Watchlist response:', response.data);
89
return response.data;
910
} catch (error) {
1011
throw new Error(error.response?.data?.detail || 'Failed to get watchlist');

requirements.txt

Lines changed: 0 additions & 113 deletions
This file was deleted.

stocksense/.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# .dockerignore - for development builds
2+
Dockerfile
3+
.git
4+
.gitignore
5+
README.md
6+
__pycache__
7+
*.pyc
8+
.pytest_cache
9+
node_modules
10+
.vscode
11+
.idea

stocksense/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM python:3.9-slim
2+
3+
# Set the working directory inside the container
4+
WORKDIR /app
5+
6+
# Copy the requirements file to the working directory
7+
COPY requirements.txt .
8+
9+
# Install the Python dependencies
10+
RUN pip install --upgrade pip
11+
RUN pip install -r requirements.txt
12+
13+
# Copy the application code to the working directory
14+
COPY . .
15+
16+
# Expose the port on which the application will run
17+
EXPOSE 8080
18+
19+
# Run the FastAPI application using uvicorn server
20+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]

stocksense/ai/analyzer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
stocksense_dir = os.path.dirname(ai_dir)
99
sys.path.append(stocksense_dir)
1010

11-
from stocksense.core.config import get_chat_llm, ConfigurationError
12-
from stocksense.data.collectors.data_collectors import get_news
11+
from core.config import get_chat_llm, ConfigurationError
12+
from data.collectors.data_collectors import get_news
1313

1414

1515
def analyze_sentiment_of_headlines(news: List[Dict]) -> str:

stocksense/ai/react_agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
stocksense_dir = os.path.dirname(ai_dir)
1515
sys.path.append(stocksense_dir)
1616

17-
from stocksense.core.config import get_chat_llm
18-
from stocksense.data.collectors.data_collectors import get_news, get_price_history
19-
from stocksense.ai.analyzer import analyze_sentiment_of_headlines
17+
from core.config import get_chat_llm
18+
from data.collectors.data_collectors import get_news, get_price_history
19+
from ai.analyzer import analyze_sentiment_of_headlines
2020

2121
class AgentState(TypedDict):
2222
"""

stocksense/main.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
parent_dir = os.path.dirname(current_dir)
1212
sys.path.append(parent_dir)
1313

14-
from stocksense.core.config import validate_configuration, ConfigurationError
15-
from stocksense.ai.react_agent import run_react_analysis
14+
from core.config import validate_configuration, ConfigurationError
15+
from ai.react_agent import run_react_analysis
1616

1717

1818
@asynccontextmanager
@@ -169,12 +169,3 @@ async def analyze_stock(ticker: str) -> Dict[str, Any]:
169169
raise HTTPException(status_code=500, detail="Internal server error")
170170

171171

172-
if __name__ == "__main__":
173-
print("Starting StockSense AI Analysis API server...")
174-
uvicorn.run(
175-
app,
176-
host="localhost",
177-
port=8000,
178-
reload=False,
179-
log_level="info"
180-
)

stocksense/requirements.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# FastAPI and web server dependencies
2+
fastapi==0.115.13
3+
uvicorn==0.34.3
4+
5+
# Data collection dependencies
6+
yfinance==0.2.63
7+
newsapi-python==0.2.7
8+
9+
# AI and LangChain dependencies
10+
langchain-google-genai==2.0.10
11+
langchain-core==0.3.65
12+
langgraph==0.4.8
13+
14+
# Configuration and utilities
15+
python-dotenv==1.1.0
16+
17+
# Google AI dependencies (required by langchain-google-genai)
18+
google-generativeai==0.8.5
19+
google-api-core==2.25.1
20+
google-auth==2.40.3
21+
22+
# Core dependencies (automatically included by above packages)
23+
pydantic==2.11.7
24+
typing-extensions==4.14.0
25+
requests==2.32.4

0 commit comments

Comments
 (0)