Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2041,10 +2041,26 @@ def handle_prompt(prompt):
|
|
| 2041 |
display_typing_indicator()
|
| 2042 |
|
| 2043 |
cleaned_text = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2044 |
# Specialized responses if keywords detected
|
| 2045 |
try:
|
| 2046 |
output = agent_executor.invoke({
|
| 2047 |
-
"input":
|
| 2048 |
"chat_history": st.session_state.chat_history
|
| 2049 |
})
|
| 2050 |
full_response = output["output"]
|
|
|
|
| 2041 |
display_typing_indicator()
|
| 2042 |
|
| 2043 |
cleaned_text = ""
|
| 2044 |
+
base_instructions = (
|
| 2045 |
+
"Be in a natural tone. Avoid flowery language, typical AI phrases, or jargon. "
|
| 2046 |
+
"Sources must be the latest, valid, and verifiable . "
|
| 2047 |
+
)
|
| 2048 |
+
|
| 2049 |
+
# Check if user request includes blog, article, or newsletter
|
| 2050 |
+
if any(keyword in prompt.lower() for keyword in ["blog", "article", "newsletter"]):
|
| 2051 |
+
appended_instructions = (
|
| 2052 |
+
" Get a 10/10 marketing copy written by a professional copywriter without any AI words. "
|
| 2053 |
+
"Ensure the content is engaging, cohesive, and seamlessly interconnected."
|
| 2054 |
+
)
|
| 2055 |
+
else:
|
| 2056 |
+
appended_instructions = ""
|
| 2057 |
+
final_prompt = f"{prompt} {base_instructions} {appended_instructions}"
|
| 2058 |
+
|
| 2059 |
+
|
| 2060 |
# Specialized responses if keywords detected
|
| 2061 |
try:
|
| 2062 |
output = agent_executor.invoke({
|
| 2063 |
+
"input": final_prompt,
|
| 2064 |
"chat_history": st.session_state.chat_history
|
| 2065 |
})
|
| 2066 |
full_response = output["output"]
|