Update models.py
Browse filesadded additional code file and improvements toward models.py code files.
models.py
CHANGED
|
@@ -1,51 +1,82 @@
|
|
| 1 |
-
from pydantic import BaseModel, Field
|
| 2 |
-
from typing import List, Dict, Optional, Any
|
| 3 |
-
from datetime import datetime
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseModel, Field
|
| 2 |
+
from typing import List, Dict, Optional, Any
|
| 3 |
+
from datetime import datetime
|
| 4 |
+
|
| 5 |
+
# ====================== Analysis ======================
|
| 6 |
+
class AnalysisRequest(BaseModel):
|
| 7 |
+
subreddits: List[str] = Field(..., description="List of subreddit names")
|
| 8 |
+
posts_per_subreddit: int = Field(10, ge=1, le=50, description="Number of posts per subreddit")
|
| 9 |
+
time_filter: str = Field("day", description="Time filter (hour, day, week, month, year, all)")
|
| 10 |
+
|
| 11 |
+
class AnalysisResponse(BaseModel):
|
| 12 |
+
status: str
|
| 13 |
+
message: str
|
| 14 |
+
insights: List[Dict[str, Any]] = []
|
| 15 |
+
|
| 16 |
+
# ====================== Insights ======================
|
| 17 |
+
class InsightResponse(BaseModel):
|
| 18 |
+
id: str
|
| 19 |
+
subreddit: str
|
| 20 |
+
post_title: str
|
| 21 |
+
post_url: str
|
| 22 |
+
timestamp: datetime
|
| 23 |
+
model: str
|
| 24 |
+
insight: Dict[str, Any]
|
| 25 |
+
|
| 26 |
+
# ====================== Query / RAG ======================
|
| 27 |
+
class QueryRequest(BaseModel):
|
| 28 |
+
query: str = Field(..., description="The user's question")
|
| 29 |
+
n_results: int = Field(5, ge=1, le=20, description="Number of sources to retrieve")
|
| 30 |
+
|
| 31 |
+
class QueryResponse(BaseModel):
|
| 32 |
+
answer: str
|
| 33 |
+
sources: List[Dict[str, Any]] # each source: {title, subreddit, url}
|
| 34 |
+
|
| 35 |
+
# ====================== Market Intelligence ======================
|
| 36 |
+
class MarketIntelligenceRequest(BaseModel):
|
| 37 |
+
idea: str = Field(..., description="Startup idea to analyze")
|
| 38 |
+
|
| 39 |
+
class MarketIntelligenceResponse(BaseModel):
|
| 40 |
+
interest_score: int
|
| 41 |
+
competitors: List[str]
|
| 42 |
+
funding_news: List[Dict[str, str]]
|
| 43 |
+
|
| 44 |
+
# ====================== Startup Builder ======================
|
| 45 |
+
class GeneratePlanRequest(BaseModel):
|
| 46 |
+
insight: Dict[str, Any] = Field(..., description="The insight object to generate a plan for")
|
| 47 |
+
|
| 48 |
+
class GeneratePlanResponse(BaseModel):
|
| 49 |
+
plan: str
|
| 50 |
+
|
| 51 |
+
# ====================== Trends ======================
|
| 52 |
+
class TrendRequest(BaseModel):
|
| 53 |
+
subreddit: Optional[str] = Field(None, description="Filter by subreddit (optional)")
|
| 54 |
+
|
| 55 |
+
class TrendResponse(BaseModel):
|
| 56 |
+
dates: List[str]
|
| 57 |
+
counts: List[int]
|
| 58 |
+
|
| 59 |
+
# ====================== Auth & Users ======================
|
| 60 |
+
class UserSignup(BaseModel):
|
| 61 |
+
email: str
|
| 62 |
+
password: str
|
| 63 |
+
full_name: Optional[str] = None
|
| 64 |
+
|
| 65 |
+
class UserLogin(BaseModel):
|
| 66 |
+
email: str
|
| 67 |
+
password: str
|
| 68 |
+
|
| 69 |
+
class UserProfile(BaseModel):
|
| 70 |
+
id: str
|
| 71 |
+
email: str
|
| 72 |
+
full_name: Optional[str]
|
| 73 |
+
subscription_tier: str
|
| 74 |
+
subscription_status: str
|
| 75 |
+
created_at: datetime
|
| 76 |
+
|
| 77 |
+
# ====================== Subscription Plans ======================
|
| 78 |
+
class SubscriptionPlan(BaseModel):
|
| 79 |
+
id: str
|
| 80 |
+
name: str
|
| 81 |
+
price: float
|
| 82 |
+
features: Dict[str, Any]
|