- Instalar Golang
- Verificar instalación de Golang
go version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| services: | |
| postgres: | |
| image: postgres:16-alpine | |
| container_name: devboard_postgres | |
| environment: | |
| POSTGRES_USER: postgres <o tu USER> | |
| POSTGRES_PASSWORD: password | |
| POSTGRES_DB: devboard | |
| ports: | |
| - "5432:5432" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "2" | |
| linters: | |
| enable: | |
| - errcheck | |
| - staticcheck | |
| - govet | |
| - ineffassign | |
| - unused | |
| - gosec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Variables | |
| APP_NAME=devboard | |
| MAIN_PATH=./cmd/api | |
| MIGRATE_PATH=./migrations | |
| DB_URL=postgresql://postgres:password@localhost:5432/devboard?sslmode=disable | |
| .PHONY: run build test lint migrate-up migrate-down generate tidy help | |
| ## run: correr la aplicación | |
| run: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def run_chat( | |
| ... | |
| ) -> None: | |
| print(f"\n{'=' * 55}") | |
| print("Asistente de Conocimiento Empresarial") | |
| print(f"Sesión: {session_id}") | |
| print(f"{'=' * 55}") | |
| print("Comandos: 'sesion' | 'historial' | 'limpiar' | 'salir'") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| prompt = f"""Eres un asistente de conocimiento empresarial experto. | |
| {context_section} | |
| HISTORIAL RECIENTE: | |
| {history_text if history_text else 'Inicio de conversación'} | |
| PREGUNTA: {state['question']} | |
| INSTRUCCIONES: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| prompt = f"""Analiza si esta pregunta necesita buscar en la base de conocimiento empresarial. | |
| Contexto inmediato (últimos 2 mensajes): | |
| {recent_context if recent_context else 'Sin contexto previo'} | |
| Pregunta actual: {state['question']} | |
| Responde ÚNICAMENTE con este JSON (sin markdown): | |
| {{"needs_retrieval": true, "reason": "razón breve"}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def show_welcome(num_chunks: int) -> None: | |
| """Muestra el mensaje de bienvenida con estado del sistema.""" | |
| print("\n" + "=" * 60) | |
| print("🔍 RAG Interactivo — Chat con tus documentos") | |
| print("=" * 60) | |
| print(f" Carpeta de documentos: {DOCUMENTS_DIR}") | |
| print(f" Chunks en el índice: {num_chunks}") | |
| print() | |
| print(" Comandos:") | |
| print(" 'archivos' → ver archivos indexados") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| prompt = ChatPromptTemplate.from_messages([ | |
| ("system", """Eres un asistente que responde preguntas | |
| basándote ÚNICAMENTE en el contexto proporcionado. | |
| Contexto recuperado de los documentos: | |
| {context} | |
| Instrucciones: | |
| - Si la respuesta está en el contexto, respóndela con precisión. | |
| - Si no está, di: "No encontré esa información en los documentos." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def chat(self) -> None: | |
| """Loop principal de chat interactivo.""" | |
| console.print(Panel.fit( | |
| "[bold cyan]Chat con tus PDFs[/bold cyan]\n" | |
| "[dim]Comandos disponibles: 'estado' | 'reindexar' | 'salir'[/dim]", | |
| border_style="cyan" | |
| )) | |
| if self.rag.collection.count() == 0: |
NewerOlder
