File size: 2,239 Bytes
03375c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import os
import streamlit as st
import pickle
from pathlib import Path

st.title("Debug App")

# Check environment variables
st.write("## Environment Variables")
if os.environ.get("OPENAI_API_KEY"):
    st.write("βœ… OPENAI_API_KEY is set")
else:
    st.error("❌ OPENAI_API_KEY is not set")

# Try to find data directory
st.write("## Data Directory")
possible_paths = [
    "data/processed_data",
    "app/data/processed_data",
    "/data/processed_data", 
    "/app/data/processed_data"
]

for path in possible_paths:
    if os.path.exists(path):
        st.write(f"βœ… Found data directory at: {path}")
        
        # Check for pickle files
        chunks_path = os.path.join(path, "chunks.pkl")
        if os.path.exists(chunks_path):
            st.write(f"βœ… Found chunks.pkl: {os.path.getsize(chunks_path) / (1024*1024):.2f} MB")
            
            # Try to load 
            try:
                with open(chunks_path, "rb") as f:
                    chunks = pickle.load(f)
                st.write(f"βœ… Successfully loaded chunks: {len(chunks)} items")
            except Exception as e:
                st.error(f"❌ Error loading chunks.pkl: {str(e)}")
        else:
            st.error(f"❌ chunks.pkl not found in {path}")
            
        embedded_docs_path = os.path.join(path, "embedded_docs.pkl")
        if os.path.exists(embedded_docs_path):
            st.write(f"βœ… Found embedded_docs.pkl: {os.path.getsize(embedded_docs_path) / (1024*1024):.2f} MB")
            
            # Try to load 
            try:
                with open(embedded_docs_path, "rb") as f:
                    embedded_docs = pickle.load(f)
                st.write(f"βœ… Successfully loaded embedded_docs: {len(embedded_docs)} items")
            except Exception as e:
                st.error(f"❌ Error loading embedded_docs.pkl: {str(e)}")
        else:
            st.error(f"❌ embedded_docs.pkl not found in {path}")
            
        break
else:
    st.error("❌ Could not find data directory")

st.write("## System Info")
import sys
st.write(f"Python version: {sys.version}")
st.write(f"Working directory: {os.getcwd()}")
st.write(f"Directory contents: {os.listdir('.')}")

st.write("Debug complete.")