Update app.py
Browse files
app.py
CHANGED
@@ -209,11 +209,11 @@ def transcribe_audio(audio, language="en"):
|
|
209 |
return None
|
210 |
|
211 |
async def get_chatbot_response(message, language="en", retries=2, timeout=10):
|
|
|
212 |
if not message:
|
213 |
return "No input provided. Please describe your symptoms or concerns.", None
|
214 |
if not chat:
|
215 |
logger.warning("Gemini chat object is None, attempting to reinitialize")
|
216 |
-
global chat
|
217 |
chat = initialize_gemini()
|
218 |
if not chat:
|
219 |
return "Error: Unable to connect to Gemini API. Please check API key.", None
|
@@ -436,11 +436,11 @@ def store_user_consent(email, language):
|
|
436 |
|
437 |
def generate_pdf_report(feedback, transcription, features, language, email, suggestions):
|
438 |
try:
|
439 |
-
feedback = feedback.replace('<', '
|
440 |
-
transcription = transcription.replace('<', '
|
441 |
-
suggestions = suggestions.replace('<', '
|
442 |
email_to_use = email.strip() if email and email.strip() else DEFAULT_EMAIL
|
443 |
-
email = email_to_use.replace('<', '
|
444 |
language_display = SALESFORCE_LANGUAGE_MAP.get(language, "English")
|
445 |
|
446 |
ist = pytz.timezone('Asia/Kolkata')
|
|
|
209 |
return None
|
210 |
|
211 |
async def get_chatbot_response(message, language="en", retries=2, timeout=10):
|
212 |
+
global chat # Declare global at the start
|
213 |
if not message:
|
214 |
return "No input provided. Please describe your symptoms or concerns.", None
|
215 |
if not chat:
|
216 |
logger.warning("Gemini chat object is None, attempting to reinitialize")
|
|
|
217 |
chat = initialize_gemini()
|
218 |
if not chat:
|
219 |
return "Error: Unable to connect to Gemini API. Please check API key.", None
|
|
|
436 |
|
437 |
def generate_pdf_report(feedback, transcription, features, language, email, suggestions):
|
438 |
try:
|
439 |
+
feedback = feedback.replace('<', '<').replace('>', '>').replace('&', '&')
|
440 |
+
transcription = transcription.replace('<', '<').replace('>', '>').replace('&', '&') if transcription else "None"
|
441 |
+
suggestions = suggestions.replace('<', '<').replace('>', '>').replace('&', '&') if suggestions else "None"
|
442 |
email_to_use = email.strip() if email and email.strip() else DEFAULT_EMAIL
|
443 |
+
email = email_to_use.replace('<', '<').replace('>', '>').replace('&', '&')
|
444 |
language_display = SALESFORCE_LANGUAGE_MAP.get(language, "English")
|
445 |
|
446 |
ist = pytz.timezone('Asia/Kolkata')
|