Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1838,12 +1838,12 @@ def chatbot_response(message, history):
|
|
| 1838 |
for statement in statements:
|
| 1839 |
top_scoring_statements += f"- {statement}\n"
|
| 1840 |
top_scoring_statements += "\n"
|
| 1841 |
-
last_top_scoring_statements = top_scoring_statements # Save
|
| 1842 |
else:
|
| 1843 |
-
top_scoring_statements =
|
| 1844 |
|
| 1845 |
-
# Combine predefined prompt, top-scoring statements (only
|
| 1846 |
-
combined_prompt =
|
| 1847 |
combined_prompt += "\n\nUser Input:\n" + message
|
| 1848 |
trust_tip, suggestion = get_trust_tip_and_suggestion()
|
| 1849 |
trust_tip_and_suggestion = f"\n\n---\n\n**Trust Tip**: {trust_tip}\n\n**Suggestion**: {suggestion}"
|
|
@@ -1871,9 +1871,7 @@ def chatbot_response(message, history):
|
|
| 1871 |
|
| 1872 |
# Prepare the final response
|
| 1873 |
response = f"**Selected Dataset: {selected_dataset_ai}**\n\n"
|
| 1874 |
-
#
|
| 1875 |
-
if top_scoring_statements:
|
| 1876 |
-
response += f"{top_scoring_statements}\n"
|
| 1877 |
response += f"\n{agent_output['output']}"
|
| 1878 |
response += trust_tip_and_suggestion
|
| 1879 |
|
|
|
|
| 1838 |
for statement in statements:
|
| 1839 |
top_scoring_statements += f"- {statement}\n"
|
| 1840 |
top_scoring_statements += "\n"
|
| 1841 |
+
last_top_scoring_statements = top_scoring_statements # Save for future use
|
| 1842 |
else:
|
| 1843 |
+
top_scoring_statements = last_top_scoring_statements # Reuse previously generated statements
|
| 1844 |
|
| 1845 |
+
# Combine predefined prompt, top-scoring statements (only for context), and user input
|
| 1846 |
+
combined_prompt = "\n\n### Top-Scoring Statements for Context ###\n" + top_scoring_statements
|
| 1847 |
combined_prompt += "\n\nUser Input:\n" + message
|
| 1848 |
trust_tip, suggestion = get_trust_tip_and_suggestion()
|
| 1849 |
trust_tip_and_suggestion = f"\n\n---\n\n**Trust Tip**: {trust_tip}\n\n**Suggestion**: {suggestion}"
|
|
|
|
| 1871 |
|
| 1872 |
# Prepare the final response
|
| 1873 |
response = f"**Selected Dataset: {selected_dataset_ai}**\n\n"
|
| 1874 |
+
# Do not include the top-scoring statements in the final response to the user
|
|
|
|
|
|
|
| 1875 |
response += f"\n{agent_output['output']}"
|
| 1876 |
response += trust_tip_and_suggestion
|
| 1877 |
|