File size: 1,523 Bytes
2e91995
1804a7a
 
 
 
 
2e91995
 
 
a0b166b
2e91995
 
 
 
 
 
a0b166b
2e91995
da722e5
1804a7a
 
a0b166b
 
da722e5
1804a7a
2e91995
1804a7a
 
 
 
2e91995
 
1804a7a
 
 
2e91995
 
1804a7a
2e91995
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

import torch
import os

class Config:
    def __init__(self):
        self.PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
        self.DATA_DIR = os.path.join(self.PROJECT_ROOT, 'src', 'data')
        
        # Database
        raw_url = os.getenv("DATABASE_URL", "")
        if raw_url.startswith("postgres://"):
            self.DB_URL = raw_url.replace("postgres://", "postgresql+psycopg2://")
        elif raw_url.startswith("postgresql://"):
            self.DB_URL = raw_url.replace("postgresql://", "postgresql+psycopg2://")
        else:
            self.DB_URL = "sqlite:///:memory:"

        self.DOCS_DIR = os.path.join(self.DATA_DIR, 'docs') 
        os.makedirs(self.DATA_DIR, exist_ok=True)
        
        # --- LANGUAGE ENFORCEMENT ---
        self.SYSTEM_CONTEXT = "Bạn là Project A, trợ lý AI chuyên về tự động hóa bán lẻ. Luôn trả lời bằng Tiếng Việt. Giọng điệu chuyên nghiệp, thân thiện."

        self.model_id = "sonthaiha/project-a-14b"
        self.models = { "manager": self.model_id, "coder": self.model_id, "researcher": self.model_id }
        
        self.quantization = {
            "load_in_4bit": True,
            "bnb_4bit_compute_dtype": torch.float16,
            "bnb_4bit_quant_type": "nf4",
            "bnb_4bit_use_double_quant": True,
        }
        
        self.generation = {
            "max_new_tokens": 2048,
            "temperature": 0.1,
            "do_sample": True
        }