Spaces:
Runtime error
Runtime error
Update app.py
Browse files2 unmodified lines34567891011121314151617181920212223242526272829303132333435363738392 unmodified lines42434445464748495051525354555657585960616263642 unmodified linesassistant_icon_path = "chat_icon/assistant.ico"user_icon_path = "chat_icon/user01.png"# Custom CSS for alignmentst.markdown("""<style>.chat-container {display: flex;width: 100%;}.chat-left {justify-content: flex-start;text-align: left;}.chat-right {justify-content: flex-end;text-align: right;}.chat-box {max-width: 60%;padding: 10px;margin: 5px;border-radius: 10px;display: inline-block;}.user-box {background-color: #d1e7fd;}.assistant-box {background-color: #f1f1f1;}</style>""", unsafe_allow_html=True)# μΈμ μνμμ approval_state λ° messages μ΄κΈ°νif "approval_state" not in st.session_state:st.session_state.approval_state = "require"2 unmodified lines# Display chat messages from history on app rerunfor message in st.session_state.messages:if message["role"] == "user":align_class = "chat-left"box_class = "user-box"else:align_class = "chat-right"box_class = "assistant-box"st.markdown(f"""<div class="chat-container {align_class}"><div class="chat-box {box_class}"><b>{message["role"].capitalize()}:</b> {message["content"]}</div></div>""",unsafe_allow_html=True)# Start with an assistant messageif not st.session_state.messages:2 unmodified lines3456782 unmodified lines111213141516171819202122232425262 unmodified linesassistant_icon_path = "chat_icon/assistant.ico"user_icon_path = "chat_icon/user01.png"# μΈμ μνμμ approval_state λ° messages μ΄κΈ°νif "approval_state" not in st.session_state:st.session_state.approval_state = "require"2 unmodified lines# Display chat messages from history on app rerunfor message in st.session_state.messages:col1, col2 = st.columns([1, 1]) # λ κ°μ λμΌν ν¬κΈ°μ μ΄ μμ±if message["role"] == "user":with col1: # μΌμͺ½ μ΄μ μ¬μ©μ λ©μμ§ νμwith st.chat_message("user", avatar=user_icon_path):st.markdown(message["content"])else:with col2: # μ€λ₯Έμͺ½ μ΄μ AI λ©μμ§ νμwith st.chat_message("assistant", avatar=assistant_icon_path):st.markdown(message["content"])# Start with an assistant messageif not st.session_state.messages:
app.py+8-46