Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -58,6 +58,12 @@ def get_conversational_chain():
|
|
58 |
prompt = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
|
59 |
chain = load_qa_chain(model, chain_type="stuff", prompt=prompt)
|
60 |
return chain
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
def user_input(user_question):
|
63 |
"""Handles user queries by retrieving answers from the vector store."""
|
@@ -85,7 +91,7 @@ def user_input(user_question):
|
|
85 |
thought_process = thought_process_match.group(1).strip()
|
86 |
|
87 |
# Remove the thought process from the main response
|
88 |
-
clean_response = original_response
|
89 |
|
90 |
# Debugging: Print the cleaned response
|
91 |
print("Cleaned Response:", clean_response)
|
|
|
58 |
prompt = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
|
59 |
chain = load_qa_chain(model, chain_type="stuff", prompt=prompt)
|
60 |
return chain
|
61 |
+
|
62 |
+
def eliminar_texto_entre_tags(texto):
|
63 |
+
patron = r'<think>.*?</think>'
|
64 |
+
texto_limpio = re.sub(patron, '', texto)
|
65 |
+
return texto_limpio
|
66 |
+
|
67 |
|
68 |
def user_input(user_question):
|
69 |
"""Handles user queries by retrieving answers from the vector store."""
|
|
|
91 |
thought_process = thought_process_match.group(1).strip()
|
92 |
|
93 |
# Remove the thought process from the main response
|
94 |
+
clean_response = eliminar_texto_entre_tags(original_response)
|
95 |
|
96 |
# Debugging: Print the cleaned response
|
97 |
print("Cleaned Response:", clean_response)
|