Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -89,17 +89,17 @@ def main():
|
|
| 89 |
st.session_state["state_reset"] = False
|
| 90 |
|
| 91 |
def process_input():
|
| 92 |
-
"""Generate a response as Tom Riddle
|
| 93 |
user_input = st.session_state["user_input"]
|
| 94 |
if user_input.strip():
|
| 95 |
try:
|
| 96 |
-
# Instruct
|
| 97 |
-
# in Tom Riddle's persona—clear, concise, and without exposing its internal reasoning.
|
| 98 |
response = agent.run(
|
| 99 |
f"You are Tom Riddle, a cunning and enigmatic character from Harry Potter. "
|
| 100 |
-
f"
|
| 101 |
-
f"
|
| 102 |
-
f"
|
|
|
|
| 103 |
)
|
| 104 |
st.session_state["response"] = response
|
| 105 |
st.session_state["waiting_for_input"] = False
|
|
|
|
| 89 |
st.session_state["state_reset"] = False
|
| 90 |
|
| 91 |
def process_input():
|
| 92 |
+
"""Generate a response as Tom Riddle using efficient web search only if needed."""
|
| 93 |
user_input = st.session_state["user_input"]
|
| 94 |
if user_input.strip():
|
| 95 |
try:
|
| 96 |
+
# Instruct Tom Riddle to use web search efficiently only when unsure.
|
|
|
|
| 97 |
response = agent.run(
|
| 98 |
f"You are Tom Riddle, a cunning and enigmatic character from Harry Potter. "
|
| 99 |
+
f"Answer the user's query clearly and concisely in your distinct persona. "
|
| 100 |
+
f"If you are not certain of your answer, only then use your available tools (DuckDuckGo search and image generation) to quickly gather necessary insights—doing so efficiently without causing delays. "
|
| 101 |
+
f"Finally, produce your answer in your characteristic voice without revealing your internal process. "
|
| 102 |
+
f"User Query: {user_input}"
|
| 103 |
)
|
| 104 |
st.session_state["response"] = response
|
| 105 |
st.session_state["waiting_for_input"] = False
|