JirasakJo commited on
Commit
2c2e24e
·
verified ·
1 Parent(s): 2840f69

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -286,6 +286,9 @@ def main():
286
  if 'chat_history' not in st.session_state:
287
  st.session_state.chat_history = []
288
 
 
 
 
289
  if 'query' not in st.session_state:
290
  st.session_state.query = ''
291
 
@@ -332,26 +335,23 @@ def main():
332
  {assistant_response}
333
  </div>
334
  """, unsafe_allow_html=True)
335
-
336
- # Add expanders right after the answer
337
- with st.expander("📚 แสดงข้อมูลอ้างอิง", expanded=False):
338
- for i, doc in enumerate(content['documents'], 1):
339
- st.markdown(f"""
340
- <div style="padding: 1rem; background-color: #000000; border-radius: 8px; margin: 0.5rem 0;">
341
- <strong>เอกสารที่ {i}:</strong><br>
342
- {doc.content}
343
- </div>
344
- """, unsafe_allow_html=True)
345
-
346
- # with st.expander("🔍 รายละเอียดการวิเคราะห์คำถาม", expanded=False):
347
- # st.json(content['query_info'])
348
 
349
  # Input section at the bottom
350
  with st.container():
351
- # Replace this section in your code:
352
  st.markdown("""
353
  <label for="query_input" style="font-size: 1.2rem; font-weight: 600; margin-bottom: 1rem; display: block;">
354
- <span style="color: #ffffff; border-left: 4px solid #ffffff; padding-left: 0.8rem;">
355
  โปรดระบุคำถามเกี่ยวกับปฏิทินการศึกษา:
356
  </span>
357
  </label>
@@ -377,7 +377,7 @@ def main():
377
  st.session_state.chat_history = []
378
  st.rerun()
379
 
380
- # Info column remains the same
381
  with info_col:
382
  st.markdown("""
383
  <div style="background-color: #F9FAFB; padding: 1.5rem; border-radius: 12px; margin-bottom: 2rem;">
 
286
  if 'chat_history' not in st.session_state:
287
  st.session_state.chat_history = []
288
 
289
+ if 'context_memory' not in st.session_state:
290
+ st.session_state.context_memory = []
291
+
292
  if 'query' not in st.session_state:
293
  st.session_state.query = ''
294
 
 
335
  {assistant_response}
336
  </div>
337
  """, unsafe_allow_html=True)
338
+
339
+ # Add expanders right after the answer (if additional document references exist)
340
+ if isinstance(content, dict) and 'documents' in content:
341
+ with st.expander("📚 แสดงข้อมูลอ้างอิง", expanded=False):
342
+ for i, doc in enumerate(content['documents'], 1):
343
+ st.markdown(f"""
344
+ <div style="padding: 1rem; background-color: #F9FAFB; border-radius: 8px; margin: 0.5rem 0;">
345
+ <strong>เอกสารที่ {i}:</strong><br>
346
+ {doc.get('content', 'ไม่มีข้อมูล')}
347
+ </div>
348
+ """, unsafe_allow_html=True)
 
 
349
 
350
  # Input section at the bottom
351
  with st.container():
 
352
  st.markdown("""
353
  <label for="query_input" style="font-size: 1.2rem; font-weight: 600; margin-bottom: 1rem; display: block;">
354
+ <span style="color: #1E3A8A; border-left: 4px solid #1E3A8A; padding-left: 0.8rem;">
355
  โปรดระบุคำถามเกี่ยวกับปฏิทินการศึกษา:
356
  </span>
357
  </label>
 
377
  st.session_state.chat_history = []
378
  st.rerun()
379
 
380
+ # Sidebar info column
381
  with info_col:
382
  st.markdown("""
383
  <div style="background-color: #F9FAFB; padding: 1.5rem; border-radius: 12px; margin-bottom: 2rem;">