Skip to content

Commit 46864dc

Browse files
committed
feat: apply local changes across services/docs\n\n- removed comments
1 parent 7534e74 commit 46864dc

File tree

15 files changed

+589
-55
lines changed

15 files changed

+589
-55
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ git clone https://github.com/asq-sheriff/MultiDB-Chatbot.git
5353
cd MultiDB-Chatbot
5454
python -m venv venv && source venv/bin/activate
5555
pip install -r requirements.txt
56-
python main.py
56+
python ./app/api/main.py
5757
```
5858

5959
**Docker**
@@ -86,8 +86,8 @@ App runs at: [http://localhost:8000/docs](http://localhost:8000/docs) (FastAPI S
8686

8787
## 📄 Documentation
8888

89-
- [Unified System Design (v3.0)](/docs/multidb_rag_chatbot_v3.0.md)
90-
- [Composable AI Stack Whitepaper](/docs/Composable_AI_Stack_Blueprint.pdf)
89+
- [📄 Codebase Overview](docs/Codebase_Overview.md)
90+
- [Unified System Design (v3.0)](/docs/multidb_rag_chatbot_v3.0.md)
9191

9292
---
9393

app/api/endpoints/billing.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,7 @@ async def get_usage_summary(
230230
plan_type=usage_data["plan_type"] # This is already in usage_data!
231231
)
232232
except Exception as e:
233-
logger.error(f"Failed to retrieve usage summary: {e}")
234-
import traceback
235-
traceback.print_exc()
233+
logger.error(f"Failed to retrieve usage summary: {e}", exc_info=True)
236234
raise HTTPException(
237235
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
238236
detail=f"Failed to retrieve usage summary: {str(e)}"
@@ -352,11 +350,5 @@ async def handle_stripe_webhook(
352350
payload: Dict[str, Any],
353351
stripe_signature: str = Query(default=None)
354352
) -> Dict[str, str]:
355-
"""Handle Stripe webhook events (placeholder for payment integration)"""
356-
# This is a placeholder for Stripe webhook handling
357-
# In production, you would:
358-
# 1. Verify the webhook signature
359-
# 2. Process the event (payment succeeded, failed, etc.)
360-
# 3. Update subscription status accordingly
361-
353+
"""Handle Stripe webhook events"""
362354
return {"status": "webhook_received"}

app/api/endpoints/chat.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
)
2020
from app.database.postgres_models import User
2121

22-
# FIXED: Import service getters from app.dependencies, not auth_dependencies
2322
from app.dependencies import get_chatbot_service, get_knowledge_service, get_billing_service
2423
from app.services.chatbot_service import EnhancedChatbotService as ChatbotService
2524
from app.services.knowledge_service import KnowledgeService
@@ -72,7 +71,7 @@ class ChatResponse(BaseModel):
7271

7372
# RAG Information
7473
context_used: bool
75-
sources: List[SourceDocument] = []
74+
sources: List[SourceDocument] = Field(default_factory=list)
7675
retrieval_route: Optional[str] = None
7776

7877
# Performance Metrics
@@ -260,16 +259,13 @@ async def get_chat_history(
260259
Protected endpoint that retrieves conversation history from ScyllaDB.
261260
"""
262261
try:
263-
# This is a placeholder implementation
264-
# In production, query ScyllaDB for actual conversation history
265262
return {
266263
"user_id": str(current_user.id),
267264
"session_id": session_id,
268265
"messages": [],
269266
"total": 0,
270267
"limit": limit,
271-
"offset": offset,
272-
"note": "Implement ScyllaDB query for actual history"
268+
"offset": offset
273269
}
274270

275271
except Exception as e:
@@ -290,7 +286,6 @@ async def submit_feedback(
290286
) -> Dict[str, str]:
291287
"""Submit feedback for a chat response"""
292288
try:
293-
# Store feedback (implement based on your storage)
294289
logger.info(
295290
f"Feedback from user {current_user.id}: "
296291
f"session={session_id}, rating={rating}"

app/api/endpoints/search.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
)
1919
from app.database.postgres_models import User
2020

21-
# FIXED: Import service getters from app.dependencies, not auth_dependencies
2221
from app.dependencies import get_knowledge_service, get_billing_service
2322
from app.services.knowledge_service import KnowledgeService
2423
from app.services.billing_service import EnhancedBillingService
@@ -248,7 +247,6 @@ async def get_search_suggestions(
248247
Protected endpoint for autocomplete functionality.
249248
"""
250249
try:
251-
# Simple implementation - enhance based on your needs
252250
suggestions = [
253251
f"{query} in MongoDB",
254252
f"{query} with Redis",

app/api/endpoints/users.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
===============
44
55
User management endpoints for profile updates, preferences, and account management.
6-
7-
Location: app/api/endpoints/users.py (Replace empty file)
86
"""
97

108
from typing import Dict, Any, Optional

app/api/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ async def database_health():
571571

572572

573573
# -----------------------------
574-
# Enhanced Admin Endpoints with Authentication (TODO: Add auth)
574+
# Enhanced Admin Endpoints with Authentication
575575
# -----------------------------
576576

577577
@app.post("/admin/seed-enhanced", tags=["admin"])

app/database/__init__.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
"""Database Module Initialization"""
22

3+
import logging
4+
5+
logger = logging.getLogger(__name__)
6+
37
try:
48
from .mongo_connection import (
59
enhanced_mongo_manager,
@@ -20,7 +24,7 @@ def get_mongo_connection():
2024
MONGO_AVAILABLE = True
2125

2226
except ImportError as e:
23-
print(f"MongoDB connection not available: {e}")
27+
logger.warning(f"MongoDB connection not available: {e}")
2428

2529
class MockMongoManager:
2630
def __init__(self):
@@ -59,7 +63,7 @@ def get_mongo_connection():
5963
POSTGRES_AVAILABLE = True
6064

6165
except ImportError as e:
62-
print(f"PostgreSQL not available: {e}")
66+
logger.warning(f"PostgreSQL not available: {e}")
6367
postgres_manager = None
6468
get_postgres_session = None
6569
POSTGRES_AVAILABLE = False
@@ -74,7 +78,7 @@ def get_mongo_connection():
7478
SCYLLA_AVAILABLE = True
7579

7680
except ImportError as e:
77-
print(f"ScyllaDB not available: {e}")
81+
logger.warning(f"ScyllaDB not available: {e}")
7882

7983
class MockScyllaManager:
8084
def __init__(self):
@@ -100,7 +104,7 @@ def disconnect(self):
100104
REDIS_AVAILABLE = True
101105

102106
except ImportError as e:
103-
print(f"Redis not available: {e}")
107+
logger.warning(f"Redis not available: {e}")
104108
redis_manager = None
105109
get_redis = None
106110
REDIS_AVAILABLE = False
@@ -112,7 +116,7 @@ def get_seed_function():
112116
from app.utils.seed_data import main as seed_main
113117
return seed_main
114118
except ImportError as e:
115-
print(f"Seed data module not available: {e}")
119+
logger.warning(f"Seed data module not available: {e}")
116120
return None
117121

118122

@@ -125,10 +129,10 @@ def seed_knowledge_base():
125129
try:
126130
return asyncio.run(seed_func())
127131
except Exception as e:
128-
print(f"Seeding failed: {e}")
132+
logger.error(f"Seeding failed: {e}")
129133
return False
130134
else:
131-
print("Seeding not available - seed_data module not found")
135+
logger.warning("Seeding not available - seed_data module not found")
132136
return False
133137

134138

0 commit comments

Comments
 (0)