Spaces:
Sleeping
Sleeping
fixed
Browse files- app/main.py +13 -13
- logs/app.log +45 -0
app/main.py
CHANGED
|
@@ -132,12 +132,12 @@ class CompanyDetailsRequest(BaseModel):
|
|
| 132 |
company_asked: str
|
| 133 |
|
| 134 |
class CompanyDetailsResponse(BaseModel):
|
| 135 |
-
name: str
|
| 136 |
-
location: str
|
| 137 |
-
industry: str
|
| 138 |
-
ceo: str
|
| 139 |
-
founded: str
|
| 140 |
-
details: str
|
| 141 |
|
| 142 |
@app.post("/api/v1/get-company-details", response_model=CompanyDetailsResponse)
|
| 143 |
async def get_company_details(request: CompanyDetailsRequest):
|
|
@@ -158,14 +158,14 @@ async def get_company_details(request: CompanyDetailsRequest):
|
|
| 158 |
geography=None
|
| 159 |
)
|
| 160 |
|
| 161 |
-
#
|
| 162 |
return CompanyDetailsResponse(
|
| 163 |
-
name=company_data.get('name', request.company_asked),
|
| 164 |
-
location=company_data.get('location', '
|
| 165 |
-
industry=company_data.get('industry', '
|
| 166 |
-
ceo=company_data.get('ceo', '
|
| 167 |
-
founded=company_data.get('founded', '
|
| 168 |
-
details=company_data.get('details', f"
|
| 169 |
)
|
| 170 |
except Exception as e:
|
| 171 |
logger.error(f"Error fetching company details: {str(e)}")
|
|
|
|
| 132 |
company_asked: str
|
| 133 |
|
| 134 |
class CompanyDetailsResponse(BaseModel):
|
| 135 |
+
name: str = "Not available"
|
| 136 |
+
location: str = "Not available"
|
| 137 |
+
industry: str = "Not available"
|
| 138 |
+
ceo: str = "Not available"
|
| 139 |
+
founded: str = "Not available"
|
| 140 |
+
details: str = "No details available"
|
| 141 |
|
| 142 |
@app.post("/api/v1/get-company-details", response_model=CompanyDetailsResponse)
|
| 143 |
async def get_company_details(request: CompanyDetailsRequest):
|
|
|
|
| 158 |
geography=None
|
| 159 |
)
|
| 160 |
|
| 161 |
+
# Ensure no None values are passed to the response model
|
| 162 |
return CompanyDetailsResponse(
|
| 163 |
+
name=str(company_data.get('name', request.company_asked)),
|
| 164 |
+
location=str(company_data.get('location', 'Not available')),
|
| 165 |
+
industry=str(company_data.get('industry', 'Not available')),
|
| 166 |
+
ceo=str(company_data.get('ceo', 'Not available')),
|
| 167 |
+
founded=str(company_data.get('founded', 'Not available')),
|
| 168 |
+
details=str(company_data.get('details', f"No details available for {request.company_asked}"))
|
| 169 |
)
|
| 170 |
except Exception as e:
|
| 171 |
logger.error(f"Error fetching company details: {str(e)}")
|
logs/app.log
CHANGED
|
@@ -92,6 +92,7 @@ NameError: name 'llm' is not defined
|
|
| 92 |
2025-10-03 12:14:49,350 - app.main - INFO - Generating insights for Apple Inc.... - [main.py:103]
|
| 93 |
2025-10-03 12:14:49,973 - app.main - INFO - Generating insights for Amazon... - [main.py:103]
|
| 94 |
2025-10-03 12:15:17,226 - app.main - INFO - Export requested in format: pdf - [main.py:345]
|
|
|
|
| 95 |
2025-10-03 12:20:50,849 - app.main - INFO - RivalLens API v1.0.0 starting up... - [main.py:35]
|
| 96 |
2025-10-03 12:20:50,871 - app.main - INFO - Environment: production - [main.py:36]
|
| 97 |
2025-10-03 12:20:50,871 - app.main - INFO - API Key: Configured - [main.py:37]
|
|
@@ -105,3 +106,47 @@ NameError: name 'llm' is not defined
|
|
| 105 |
2025-10-03 12:28:33,974 - app.main - INFO - RivalLens API v1.0.0 starting up... - [main.py:35]
|
| 106 |
2025-10-03 12:28:33,975 - app.main - INFO - Environment: production - [main.py:36]
|
| 107 |
2025-10-03 12:28:33,975 - app.main - INFO - API Key: Configured - [main.py:37]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
2025-10-03 12:14:49,350 - app.main - INFO - Generating insights for Apple Inc.... - [main.py:103]
|
| 93 |
2025-10-03 12:14:49,973 - app.main - INFO - Generating insights for Amazon... - [main.py:103]
|
| 94 |
2025-10-03 12:15:17,226 - app.main - INFO - Export requested in format: pdf - [main.py:345]
|
| 95 |
+
<<<<<<< HEAD
|
| 96 |
2025-10-03 12:20:50,849 - app.main - INFO - RivalLens API v1.0.0 starting up... - [main.py:35]
|
| 97 |
2025-10-03 12:20:50,871 - app.main - INFO - Environment: production - [main.py:36]
|
| 98 |
2025-10-03 12:20:50,871 - app.main - INFO - API Key: Configured - [main.py:37]
|
|
|
|
| 106 |
2025-10-03 12:28:33,974 - app.main - INFO - RivalLens API v1.0.0 starting up... - [main.py:35]
|
| 107 |
2025-10-03 12:28:33,975 - app.main - INFO - Environment: production - [main.py:36]
|
| 108 |
2025-10-03 12:28:33,975 - app.main - INFO - API Key: Configured - [main.py:37]
|
| 109 |
+
=======
|
| 110 |
+
2025-10-03 12:34:51,325 - app.main - INFO - RivalLens API v1.0.0 starting up... - [main.py:35]
|
| 111 |
+
2025-10-03 12:34:51,326 - app.main - INFO - Environment: production - [main.py:36]
|
| 112 |
+
2025-10-03 12:34:51,326 - app.main - INFO - API Key: Configured - [main.py:37]
|
| 113 |
+
2025-10-03 12:35:10,081 - app.main - INFO - RivalLens API v1.0.0 starting up... - [main.py:35]
|
| 114 |
+
2025-10-03 12:35:10,081 - app.main - INFO - Environment: production - [main.py:36]
|
| 115 |
+
2025-10-03 12:35:10,082 - app.main - INFO - API Key: Configured - [main.py:37]
|
| 116 |
+
2025-10-03 12:35:15,488 - app.main - ERROR - Error fetching company details: 2 validation errors for CompanyDetailsResponse
|
| 117 |
+
location
|
| 118 |
+
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
|
| 119 |
+
For further information visit https://errors.pydantic.dev/2.11/v/string_type
|
| 120 |
+
ceo
|
| 121 |
+
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
|
| 122 |
+
For further information visit https://errors.pydantic.dev/2.11/v/string_type - [main.py:171]
|
| 123 |
+
2025-10-03 12:36:39,195 - app.main - INFO - RivalLens API v1.0.0 starting up... - [main.py:35]
|
| 124 |
+
2025-10-03 12:36:39,195 - app.main - INFO - Environment: production - [main.py:36]
|
| 125 |
+
2025-10-03 12:36:39,196 - app.main - INFO - API Key: Configured - [main.py:37]
|
| 126 |
+
2025-10-03 12:37:04,509 - app.main - INFO - RivalLens API v1.0.0 starting up... - [main.py:35]
|
| 127 |
+
2025-10-03 12:37:04,510 - app.main - INFO - Environment: production - [main.py:36]
|
| 128 |
+
2025-10-03 12:37:04,510 - app.main - INFO - API Key: Configured - [main.py:37]
|
| 129 |
+
2025-10-03 12:37:09,099 - app.main - ERROR - Error fetching company details: 2 validation errors for CompanyDetailsResponse
|
| 130 |
+
location
|
| 131 |
+
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
|
| 132 |
+
For further information visit https://errors.pydantic.dev/2.11/v/string_type
|
| 133 |
+
ceo
|
| 134 |
+
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
|
| 135 |
+
For further information visit https://errors.pydantic.dev/2.11/v/string_type - [main.py:171]
|
| 136 |
+
2025-10-03 12:37:15,191 - app.main - INFO - RivalLens API v1.0.0 starting up... - [main.py:35]
|
| 137 |
+
2025-10-03 12:37:15,192 - app.main - INFO - Environment: production - [main.py:36]
|
| 138 |
+
2025-10-03 12:37:15,192 - app.main - INFO - API Key: Configured - [main.py:37]
|
| 139 |
+
2025-10-03 12:37:16,100 - app.main - INFO - RivalLens API v1.0.0 starting up... - [main.py:35]
|
| 140 |
+
2025-10-03 12:37:16,100 - app.main - INFO - Environment: production - [main.py:36]
|
| 141 |
+
2025-10-03 12:37:16,100 - app.main - INFO - API Key: Configured - [main.py:37]
|
| 142 |
+
2025-10-03 12:37:34,119 - app.main - ERROR - Error fetching company details: 2 validation errors for CompanyDetailsResponse
|
| 143 |
+
location
|
| 144 |
+
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
|
| 145 |
+
For further information visit https://errors.pydantic.dev/2.11/v/string_type
|
| 146 |
+
ceo
|
| 147 |
+
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
|
| 148 |
+
For further information visit https://errors.pydantic.dev/2.11/v/string_type - [main.py:171]
|
| 149 |
+
2025-10-03 12:38:08,263 - app.main - INFO - RivalLens API v1.0.0 starting up... - [main.py:35]
|
| 150 |
+
2025-10-03 12:38:08,264 - app.main - INFO - Environment: production - [main.py:36]
|
| 151 |
+
2025-10-03 12:38:08,264 - app.main - INFO - API Key: Configured - [main.py:37]
|
| 152 |
+
>>>>>>> wikidata
|