Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -123,11 +123,15 @@ async def on_chat_start():
|
|
| 123 |
questions_format = str(questions_response).split('\n')
|
| 124 |
relevant_questions = [question.strip() for question in questions_format if question.strip() and question.strip()[0].isdigit()]
|
| 125 |
|
| 126 |
-
# Display
|
| 127 |
-
await cl.Message(content="Generated strategic questions:").send()
|
| 128 |
for question in relevant_questions:
|
| 129 |
await cl.Message(content=f"**{question}**").send()
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
msg.content = "Processing done. You can now ask more questions about the 10-K report!"
|
| 132 |
await msg.update()
|
| 133 |
|
|
@@ -150,4 +154,4 @@ async def main(message: cl.Message):
|
|
| 150 |
for token in str(response):
|
| 151 |
await response_message.stream_token(token=token)
|
| 152 |
|
| 153 |
-
await response_message.send()
|
|
|
|
| 123 |
questions_format = str(questions_response).split('\n')
|
| 124 |
relevant_questions = [question.strip() for question in questions_format if question.strip() and question.strip()[0].isdigit()]
|
| 125 |
|
| 126 |
+
# Display and answer questions
|
| 127 |
+
await cl.Message(content="Generated strategic questions and answers:").send()
|
| 128 |
for question in relevant_questions:
|
| 129 |
await cl.Message(content=f"**{question}**").send()
|
| 130 |
|
| 131 |
+
# Query the engine to get the answer for the question
|
| 132 |
+
answer = await cl.make_async(query_engine.query)(question)
|
| 133 |
+
await cl.Message(content=f"**Answer:**\n{answer}").send()
|
| 134 |
+
|
| 135 |
msg.content = "Processing done. You can now ask more questions about the 10-K report!"
|
| 136 |
await msg.update()
|
| 137 |
|
|
|
|
| 154 |
for token in str(response):
|
| 155 |
await response_message.stream_token(token=token)
|
| 156 |
|
| 157 |
+
await response_message.send()
|