Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -389,7 +389,7 @@ def generate_portfolio_summary():
|
|
| 389 |
|
| 390 |
def ask_ai_question(question, as_of_month, segment, history):
|
| 391 |
if not question or str(question).strip() == "":
|
| 392 |
-
return history or [], history or [], "
|
| 393 |
try:
|
| 394 |
answer = generate_ai_answer(
|
| 395 |
question=question,
|
|
@@ -401,7 +401,8 @@ def ask_ai_question(question, as_of_month, segment, history):
|
|
| 401 |
answer = f"AI error: {str(exc)}"
|
| 402 |
|
| 403 |
history = history or []
|
| 404 |
-
history.append(
|
|
|
|
| 405 |
return history, history, ""
|
| 406 |
|
| 407 |
|
|
|
|
| 389 |
|
| 390 |
def ask_ai_question(question, as_of_month, segment, history):
|
| 391 |
if not question or str(question).strip() == "":
|
| 392 |
+
return history or [], history or [], ""
|
| 393 |
try:
|
| 394 |
answer = generate_ai_answer(
|
| 395 |
question=question,
|
|
|
|
| 401 |
answer = f"AI error: {str(exc)}"
|
| 402 |
|
| 403 |
history = history or []
|
| 404 |
+
history.append({"role": "user", "content": question})
|
| 405 |
+
history.append({"role": "assistant", "content": answer})
|
| 406 |
return history, history, ""
|
| 407 |
|
| 408 |
|