Update settings.py
Browse files- settings.py +4 -4
settings.py
CHANGED
@@ -43,7 +43,7 @@ language = None
|
|
43 |
def generate_random_string(length=5):
|
44 |
return ''.join(random.choices(string.ascii_letters + string.digits, k=length))
|
45 |
|
46 |
-
def respond(message, history):
|
47 |
global question_count, interview_history, combined_retriever, last_audio_path, initial_audio_path, language, interview_retrieval_chain, report_retrieval_chain
|
48 |
|
49 |
if not isinstance(history, list):
|
@@ -66,7 +66,7 @@ def respond(message, history):
|
|
66 |
language = message.strip().lower()
|
67 |
# Reinitialize the interview chain with the new language
|
68 |
interview_retrieval_chain, report_retrieval_chain, combined_retriever = setup_knowledge_retrieval(
|
69 |
-
llm, language)
|
70 |
|
71 |
if question_count < n_of_questions:
|
72 |
result = interview_retrieval_chain.invoke({
|
@@ -84,7 +84,7 @@ def respond(message, history):
|
|
84 |
if question:
|
85 |
random_suffix = generate_random_string()
|
86 |
speech_file_path = Path(__file__).parent / f"question_{question_count}_{random_suffix}.mp3"
|
87 |
-
convert_text_to_speech(question, speech_file_path)
|
88 |
print(f"Question {question_count} saved as audio at {speech_file_path}")
|
89 |
|
90 |
# Remove the last audio file if it exists
|
@@ -99,7 +99,7 @@ def respond(message, history):
|
|
99 |
question = f"Can you elaborate on that? (in {language})"
|
100 |
if question_count < n_of_questions:
|
101 |
speech_file_path = Path(__file__).parent / f"question_{question_count}.mp3"
|
102 |
-
convert_text_to_speech(question, speech_file_path)
|
103 |
print(f"Question {question_count} saved as audio at {speech_file_path}")
|
104 |
|
105 |
if last_audio_path and os.path.exists(last_audio_path):
|
|
|
43 |
def generate_random_string(length=5):
|
44 |
return ''.join(random.choices(string.ascii_letters + string.digits, k=length))
|
45 |
|
46 |
+
def respond(message, history, voice, selected_interviewer):
|
47 |
global question_count, interview_history, combined_retriever, last_audio_path, initial_audio_path, language, interview_retrieval_chain, report_retrieval_chain
|
48 |
|
49 |
if not isinstance(history, list):
|
|
|
66 |
language = message.strip().lower()
|
67 |
# Reinitialize the interview chain with the new language
|
68 |
interview_retrieval_chain, report_retrieval_chain, combined_retriever = setup_knowledge_retrieval(
|
69 |
+
llm, language, selected_interviewer)
|
70 |
|
71 |
if question_count < n_of_questions:
|
72 |
result = interview_retrieval_chain.invoke({
|
|
|
84 |
if question:
|
85 |
random_suffix = generate_random_string()
|
86 |
speech_file_path = Path(__file__).parent / f"question_{question_count}_{random_suffix}.mp3"
|
87 |
+
convert_text_to_speech(question, speech_file_path, voice)
|
88 |
print(f"Question {question_count} saved as audio at {speech_file_path}")
|
89 |
|
90 |
# Remove the last audio file if it exists
|
|
|
99 |
question = f"Can you elaborate on that? (in {language})"
|
100 |
if question_count < n_of_questions:
|
101 |
speech_file_path = Path(__file__).parent / f"question_{question_count}.mp3"
|
102 |
+
convert_text_to_speech(question, speech_file_path, voice)
|
103 |
print(f"Question {question_count} saved as audio at {speech_file_path}")
|
104 |
|
105 |
if last_audio_path and os.path.exists(last_audio_path):
|