dodeeric / langchain-ai-assistant-with-hybrid-rag

This is a LLM chatbot coded with LangChain. The web interface is coded with Streamlit. It implements a hybrid RAG (keyword and semantic search) and chat memory.
https://bmae-ragai-webapp.azurewebsites.net
GNU General Public License v3.0
8 stars 1 forks source link

Files and DB Info: why is the root directory not displayed when the chromadb directory does not exist? #47

Closed dodeeric closed 4 weeks ago

dodeeric commented 4 weeks ago
   if st.button("Files and DB Info"):

        load_files_and_embed(json_paths, pdf_paths, embed=False)

        try:

            file_path = './chromadb/chroma.sqlite3'
            file_size = os.path.getsize(file_path)
            file_size = file_size / 1024  # In KB
            if file_size > 144:
                st.write(f"DB size: {file_size} KB")
            else:
                st.write(f"DB size: {file_size} KB. DB is empty!")

            path = './'
            files = os.listdir(path)
            st.write("Root path:")
            st.write(files)   ==================> nok: should be displayed?

            path = './chromadb'
            files = os.listdir(path)
            st.write("DB path:")
            st.write(files)   ====================> ok: error if the chromadb dir does not exist

        except Exception as e:
            st.write("Error: Is the DB available?")
            st.write(f"Error: {e}")
dodeeric commented 4 weeks ago

solved: changed the error catching (separated "dir chromadb" and "dir /").