GenAICoder commited on
Commit
0829cdd
·
verified ·
1 Parent(s): 755d0ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
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 [], "Please enter a question."
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((question, answer))
 
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