Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,9 +6,9 @@ import requests
|
|
6 |
session = requests.Session()
|
7 |
|
8 |
# Function to interact with the AI
|
9 |
-
def chat_with_ai(message):
|
10 |
api_url = os.getenv("CHAT_API_URL")
|
11 |
-
payload = {"message": message}
|
12 |
|
13 |
try:
|
14 |
with session.post(api_url, json=payload) as response:
|
@@ -65,9 +65,9 @@ def main():
|
|
65 |
search_results = web_search(query)
|
66 |
|
67 |
# Pass the search results to the AI for generating a report
|
68 |
-
prompt = f"Generate a research report based on the following information: {search_results}. If the search results are insufficient, answer the user's question using the information available."
|
69 |
with st.spinner('π Generating report...'):
|
70 |
-
report = chat_with_ai(prompt)
|
71 |
|
72 |
# Display the report
|
73 |
st.write(report)
|
|
|
6 |
session = requests.Session()
|
7 |
|
8 |
# Function to interact with the AI
|
9 |
+
def chat_with_ai(message, user_input):
|
10 |
api_url = os.getenv("CHAT_API_URL")
|
11 |
+
payload = {"message": message, "user_input": user_input}
|
12 |
|
13 |
try:
|
14 |
with session.post(api_url, json=payload) as response:
|
|
|
65 |
search_results = web_search(query)
|
66 |
|
67 |
# Pass the search results to the AI for generating a report
|
68 |
+
prompt = f"Generate a research report based on the following information: {search_results}. The user's query was: '{query}'. If the search results are insufficient, answer the user's question using the information available."
|
69 |
with st.spinner('π Generating report...'):
|
70 |
+
report = chat_with_ai(prompt, query)
|
71 |
|
72 |
# Display the report
|
73 |
st.write(report)
|