oceansweep commited on
Commit
2de654d
1 Parent(s): 3eb7d2f

Update App_Function_Libraries/DB/RAG_QA_Chat_DB.py

Browse files
App_Function_Libraries/DB/RAG_QA_Chat_DB.py CHANGED
@@ -26,50 +26,20 @@ from App_Function_Libraries.Utils.Utils import get_project_relative_path, get_pr
26
 
27
  def get_rag_qa_db_path():
28
  try:
29
- config_path = os.path.join(get_project_root(), 'Config_Files', 'config.txt')
30
- print(f"Attempting to read config from: {config_path}")
31
- # Print the actual content of the file being read
32
- with open(config_path, 'r') as f:
33
- print("Raw config file contents:")
34
- print(f.read())
35
 
36
- config = configparser.ConfigParser()
37
- files_read = config.read(config_path, encoding='utf-8')
38
- print(f"Config files read: {files_read}")
39
- print(f"Sections in config: {config.sections()}")
40
 
41
- if 'Database' in config.sections():
42
- print("Found Database section")
43
- print(f"Options in Database section: {config.options('Database')}")
44
-
45
- # Try to get all values in the Database section
46
- print("All values in Database section:")
47
- for key in config['Database']:
48
- print(f"{key} = {config['Database'][key]}")
49
-
50
- if 'rag_qa_db_path' in config.options('Database'):
51
- rag_qa_db_path = config.get('Database', 'rag_qa_db_path')
52
- print(f"Found rag_qa_db_path: {rag_qa_db_path}")
53
-
54
- if not os.path.isabs(rag_qa_db_path):
55
- project_root = get_project_root()
56
- rag_qa_db_path = os.path.join(project_root, rag_qa_db_path)
57
- print(f"Converted to absolute path: {rag_qa_db_path}")
58
-
59
- return rag_qa_db_path
60
- else:
61
- print("rag_qa_db_path not found in Database section")
62
-
63
- raise ValueError("Database path not found in config file")
64
 
65
  except Exception as e:
66
  print(f"Error in get_rag_qa_db_path: {str(e)}")
67
- print(f"Error type: {type(e)}")
68
- import traceback
69
- print(f"Traceback: {traceback.format_exc()}")
70
  raise
71
 
72
-
73
  # Set up logging
74
  logging.basicConfig(level=logging.INFO)
75
  logger = logging.getLogger(__name__)
 
26
 
27
  def get_rag_qa_db_path():
28
  try:
29
+ project_root = get_project_root()
30
+ # Hardcode the path following the same pattern as other DB paths
31
+ rag_qa_db_path = os.path.join(project_root, 'Databases', 'RAG_QA_Chat.db')
 
 
 
32
 
33
+ # Ensure the Databases directory exists
34
+ os.makedirs(os.path.dirname(rag_qa_db_path), exist_ok=True)
 
 
35
 
36
+ print(f"Using hardcoded RAG QA database path: {rag_qa_db_path}")
37
+ return rag_qa_db_path
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  except Exception as e:
40
  print(f"Error in get_rag_qa_db_path: {str(e)}")
 
 
 
41
  raise
42
 
 
43
  # Set up logging
44
  logging.basicConfig(level=logging.INFO)
45
  logger = logging.getLogger(__name__)