Spaces:
Sleeping
Sleeping
Added NLP#2
Browse files- nlp_service.py +2 -2
nlp_service.py
CHANGED
@@ -568,7 +568,7 @@ def analyze_expense_text(text):
|
|
568 |
# --- Call Gemini API ---
|
569 |
gemini_result = call_gemini_api(text, GEMINI_API_KEY)
|
570 |
|
571 |
-
if gemini_result and isinstance(gemini_result, dict) and gemini_result.get("action") in ["add_expense", "query_expense", "info"]:
|
572 |
# If Gemini returned a structured result we can use (or an info message), return it
|
573 |
logging.info(f"Using result from Gemini API. Action: {gemini_result.get('action')}")
|
574 |
response_data = gemini_result
|
@@ -644,7 +644,7 @@ def analyze_expense_text(text):
|
|
644 |
if gemini_result and isinstance(gemini_result, dict) and "message" in gemini_result:
|
645 |
response_data["message"] += f"\n\nGemini suggestion: {gemini_result['message']}"
|
646 |
|
647 |
-
logging.info(f"Analysis complete. Action: {response_data.get('action')}, Status: {response_data.get('status'
|
648 |
return response_data
|
649 |
|
650 |
|
|
|
568 |
# --- Call Gemini API ---
|
569 |
gemini_result = call_gemini_api(text, GEMINI_API_KEY)
|
570 |
|
571 |
+
if (gemini_result and isinstance(gemini_result, dict) and gemini_result.get("action") in ["add_expense", "query_expense", "info"]):
|
572 |
# If Gemini returned a structured result we can use (or an info message), return it
|
573 |
logging.info(f"Using result from Gemini API. Action: {gemini_result.get('action')}")
|
574 |
response_data = gemini_result
|
|
|
644 |
if gemini_result and isinstance(gemini_result, dict) and "message" in gemini_result:
|
645 |
response_data["message"] += f"\n\nGemini suggestion: {gemini_result['message']}"
|
646 |
|
647 |
+
logging.info(f"Analysis complete. Action: {response_data.get('action')}, Status: {response_data.get('status')}") # Corrected closing parenthesis
|
648 |
return response_data
|
649 |
|
650 |
|