Spaces:
Sleeping
Sleeping
| # ... (previous imports remain the same) | |
| def handle_chat(): | |
| st.subheader("π¬ Document Chat") | |
| if "messages" not in st.session_state: | |
| st.session_state.messages = [] | |
| for message in st.session_state.messages: | |
| with st.chat_message(message["role"]): | |
| st.markdown(message["content"]) | |
| if prompt := st.chat_input("Ask about your documents"): | |
| st.session_state.messages.append({"role": "user", "content": prompt}) | |
| with st.chat_message("user"): | |
| st.markdown(prompt) | |
| with st.chat_message("assistant"): | |
| with st.spinner("Thinking..."): | |
| try: | |
| response = get_groq_response( | |
| prompt, | |
| get_vector_db(), | |
| model_name="llama3-70b-8192" # Updated model | |
| ) | |
| st.markdown(response) | |
| st.session_state.messages.append( | |
| {"role": "assistant", "content": response} | |
| ) | |
| except Exception as e: | |
| st.error(f"Please check the model name in rag_utils.py. Error: {str(e)}") |