Primer commit

This commit is contained in:
2025-05-05 02:21:55 +02:00
commit 7b6f525809
62 changed files with 78661 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import os
from dotenv import load_dotenv
# Calcular ruta absoluta al .env
ENV_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'config', '.env'))
# Cargar el .env si existe
if os.path.exists(ENV_PATH):
load_dotenv(ENV_PATH)
else:
raise FileNotFoundError(f"No se encontró el archivo .env en {ENV_PATH}")
# Exponer la ruta como variable accesible al importar `entrypoint`
__all__ = ['ENV_PATH']
+21
View File
@@ -0,0 +1,21 @@
# Ruta que quieres agregar al PYTHONPATH
$folderPath = "E:\Fitz_Studio"
# Obtener el PYTHONPATH actual del entorno de usuario (si existe)
$currentPythonPath = [Environment]::GetEnvironmentVariable("PYTHONPATH", "User")
# Verificar si la ruta ya está incluida
if ($currentPythonPath -and $currentPythonPath.Split(';') -contains $folderPath) {
Write-Host "La ruta ya está en PYTHONPATH."
} else {
if ($currentPythonPath) {
$newPythonPath = "$folderPath;$currentPythonPath"
} else {
$newPythonPath = "$folderPath"
}
# Establecer el nuevo PYTHONPATH en el entorno del usuario
[Environment]::SetEnvironmentVariable("PYTHONPATH", $newPythonPath, "User")
Write-Host "✅ PYTHONPATH actualizado exitosamente. Nuevo valor:"
Write-Host $newPythonPath
}
+48
View File
@@ -0,0 +1,48 @@
# entrypoint/init_db.py
from backend.base import Base
from backend.ConexionSql.Postgres_conexion import PostgresConexion # Asegúrate de tener esta clase implementada correctamente
from backend.Credenciales.postgres_credencial import PostgresCredencial # Asegúrate de tener esta clase implementada correctamente
from backend.Credenciales.postgres_credencial_mmr import PostgresCredencialModel
from backend.ApiKeys.openai_apikey_mmr import OpenAICredencialModel
from llms.Modelos.Openai_model_mmr import ModeloOpenAIConfigModel
from dotenv import load_dotenv
import os
from entrypoint import ENV_PATH
# Ruta específica al archivo .env
dotenv_path = ENV_PATH
# Cargar el archivo
load_dotenv(dotenv_path)
titulo = os.getenv('DB_TITLE')
usuario = os.getenv('DB_USER')
passwrd = os.getenv('DB_PASSWORD')
host = os.getenv('DB_HOST')
port = os.getenv('DB_PORT')
db_name = os.getenv('DB_NAME')
db_credencial = PostgresCredencial(
titulo=titulo,
user=usuario,
password=passwrd,
host=host,
port=port,
dbname=db_name
)
def init_db():
# Crear engine desde la clase de conexión PostgreSQL
conexion = PostgresConexion(db_credencial)
engine = conexion.engine # Recuperamos el engine directamente
print("Creando tablas...")
Base.metadata.create_all(engine)
print("¡Listo!")