aef8791151
- Added Appshell component with responsive navbar and main content area - Integrated ColorSchemeToggle for light/dark mode switching - Created Welcome component with styled title and introductory text - Developed ChatPage for LLM interaction with WebSocket support - Implemented Biblioteca for managing notes with rich text editor - Added LoginPage for user authentication with error handling - Introduced MessageList and MessageBubble components for chat messages - Styled components with CSS modules for consistent design
24 lines
948 B
Python
24 lines
948 B
Python
from domains.Security.GenerarIDs import GeneradorIDUnico
|
|
|
|
class OpenAICredencial:
|
|
def __init__(self, titulo: str, api_key: str, organizacion: str = None, id: str = None):
|
|
"""
|
|
:param titulo: Nombre descriptivo para esta credencial.
|
|
:param api_key: Clave secreta de la API de OpenAI.
|
|
:param organizacion: (Opcional) ID de la organización asociada a la cuenta de OpenAI.
|
|
"""
|
|
self.id = id if id is not None else GeneradorIDUnico("OPAK").generar()
|
|
self.titulo = titulo
|
|
self.api_key = api_key
|
|
self.organizacion = organizacion
|
|
|
|
def get_headers(self) -> dict:
|
|
"""
|
|
Retorna los encabezados necesarios para autenticar una petición HTTP a OpenAI.
|
|
"""
|
|
headers = {
|
|
"Authorization": f"Bearer {self.api_key}"
|
|
}
|
|
if self.organizacion:
|
|
headers["OpenAI-Organization"] = self.organizacion
|
|
return headers |