File size: 1,560 Bytes
20b15f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
ui/paths.py
-----------
Filesystem + import-path wiring for NOVA.

This module MUST be the first `ui` import in nova_app.py. It does the sys.path
+ chdir + .env side effects that make `import app...` (the agent package) and
`from vectorizeer import ...` / `from Qa import ...` (the chatbot) resolve
later -- so it has to run before any other `ui` module that needs BASE,
DOWNLOADS_DIR, VECTORSTORES_DIR, or PDF_UA. Once nova_app.py imports this
first, every other module gets the same path setup for free via Python's module
cache (re-importing `ui.paths` elsewhere just returns the already-initialized
module, it doesn't re-run this file).
"""

import os
import sys
from pathlib import Path

# ---------------------------------------------------------------------------
# PATHS  — make both sub-projects importable without touching their code
# ---------------------------------------------------------------------------
BASE = Path(__file__).resolve().parent.parent
os.chdir(BASE)                                   # ./vectorstores, ./downloads resolve under NOVA/
sys.path.insert(0, str(BASE))                    # `import app...`  (the agent package)
sys.path.insert(0, str(BASE / "chatbot_core"))   # `import Qa`, `from vectorizeer import ...`

from dotenv import load_dotenv
load_dotenv(BASE / ".env")

DOWNLOADS_DIR = BASE / "downloads"
DOWNLOADS_DIR.mkdir(exist_ok=True)
VECTORSTORES_DIR = BASE / "vectorstores"

ASSETS_DIR = BASE / "assets"
ASSETS_DIR.mkdir(exist_ok=True)

PDF_UA = {"User-Agent": "Mozilla/5.0 (compatible; NOVA-research/1.0)"}