Commit Graph

57 Commits

Author SHA1 Message Date
alexrg 13cf57505f Merge branch 'main' of https://github.lci.ulsa.mx/AlexRG/genesis-2
Deploy Function / deploy (push) Successful in 26s
Deploy Migrations to Production / deploy (push) Successful in 11s
2026-02-13 16:12:26 -06:00
alexrg 9d25203ef6 fix: update execution counts and improve message parsing in chat conversation functions 2026-02-13 16:12:23 -06:00
Guillermo.Arrieta 7a81e448f4 hotfix: se cambió el estado default de las asignaturas y se arregló un error donde se requería código de asignatura no nulo
Deploy Function / deploy (push) Successful in 44s
Deploy Migrations to Production / deploy (push) Successful in 14s
2026-02-13 12:39:14 -06:00
alexrg b7720496cf feat: update conversation archiving to store structured message data
CI / test (pull_request) Failing after 7s
2026-02-13 10:17:06 -06:00
alexrg a70f0c52a9 feat: implement create-chat-conversation function with OpenAI integration and Supabase support
CI / test (pull_request) Failing after 8s
- Added CORS handling for the create-chat-conversation function.
- Implemented health check endpoint for the function.
- Created endpoints for managing conversations and messages with OpenAI.
- Added error handling and response formatting for better API usability.
- Introduced utility functions for environment variable management and Supabase client creation.
- Enhanced schema handling for structured responses from OpenAI.
- Implemented conversation archiving and retrieval logic.
2026-02-13 09:31:58 -06:00
Guillermo.Arrieta f29465958a errores de imports
Deploy Function / deploy (push) Successful in 37m53s
Deploy Migrations to Production / deploy (push) Successful in 15s
2026-02-12 17:40:22 -06:00
Guillermo.Arrieta 9981b30260 feat: update subject suggestion guidelines and remove obsolete migration
CI / test (pull_request) Failing after 8s
- Enhanced the subject suggestion guidelines to specify that descriptions must not exceed 200 characters.
- Deleted the migration file for adding conversation_id to asignaturas and the associated view, as it is no longer needed.
2026-02-12 16:45:38 -06:00
Guillermo.Arrieta 2ff587d639 feat: opcion de update a asignaturas ya creadas para ponerles la información generada con IA
- Created a new enum type "estado_asignatura" with values 'borrador', 'revisada', 'aprobada', and 'generando'.
- Added a new column "estado" to the "asignaturas" table, defaulting to 'generando'.
- Implemented a trigger function to log changes in the "planes_estudio" table, capturing inserts, updates, and deletes.
- Updated the logging mechanism to track changes in various fields, including JSONB data.
- Removed the "asignaturas" table from the supabase_realtime publication.
- Added a script for generating TypeScript types from the local Supabase database.
2026-02-12 16:00:39 -06:00
Guillermo.Arrieta 48ab986cb8 Actualizar esquema de validación: limitar la descripción a 200 caracteres y reducir la cantidad máxima de sugerencias a 15 2026-02-12 16:00:00 -06:00
Guillermo.Arrieta 24b6338074 Implementar validación y generación de sugerencias de asignaturas con integración a Supabase 2026-02-12 16:00:00 -06:00
Guillermo.Arrieta b1d431a683 Generación con IA funcional 2026-02-12 16:00:00 -06:00
Guillermo.Arrieta ce5360a5c2 wip 2026-02-12 16:00:00 -06:00
Guillermo.Arrieta 93c7f11621 nueva edge function para la generación de sugerencais de asignaturas con IA 2026-02-12 16:00:00 -06:00
alexrg 53d9ab2876 Add trigger removal and logging function for cambios_planes_estudio
CI / test (pull_request) Failing after 2m19s
2026-02-12 15:13:19 -06:00
alexrg bdd4921795 Add initial implementation for create-chat-conversation function and related configuration files 2026-02-12 11:59:22 -06:00
alexrg 4615da4223 Implement new feature for user authentication and improve error handling 2026-02-12 10:37:41 -06:00
alexrg 484db49654 Refactor code structure for improved readability and maintainability 2026-02-12 10:35:52 -06:00
alexrg 0b72a227f1 Implement code changes to enhance functionality and improve performance 2026-02-12 10:04:42 -06:00
alexrg 801e23a89c Agregar semilla 2026-02-12 10:01:58 -06:00
alexrg 834e884c90 Remove deprecated AI function and related configuration files for cleaner project structure 2026-02-12 09:47:58 -06:00
alexrg e1410c65ec Remove obsolete SQL migration file for cleaner project structure 2026-02-12 09:42:32 -06:00
alexrg a3a7fd0de8 Refactor code structure for improved readability and maintainability 2026-02-12 09:38:06 -06:00
alexrg e7acf50b82 Remove SQL insert statements for faculties and careers from the database schema. 2026-02-12 09:37:40 -06:00
alexrg c33089726c Establecer permisos de funciones y eliminar funciones no utilizadas en las migraciones 2026-02-12 09:37:03 -06:00
Guillermo.Arrieta 5c9fde1a9e Generación de datos básicos de asignaturas funcional
Deploy Function / deploy (push) Successful in 24s
close #6:
- Ya se pueden generar asignaturas con IA. Específicamente los datos generales.
- Se actualizaron los tipos de supabase
- Se arreglaron los imports
- TODO: generar contenido temático de la asignatura
2026-02-05 19:42:12 -06:00
Guillermo.Arrieta 7f9226ce38 hotfix de importacion
Deploy Function / deploy (push) Successful in 21s
2026-02-05 16:13:55 -06:00
Guillermo.Arrieta 00f0bddf1c Arreglo de reverts 2026-02-05 16:00:07 -06:00
Guillermo.Arrieta 1ca861c51d Primera versión de la función de ai-generate-subject 2026-02-05 15:54:04 -06:00
Guillermo.Arrieta 42a437afa3 fix(functions): clasificar y estandarizar errores en ai-generate-plan
- Corregido el problema donde la función devolvía siempre 400; ahora se lanzan HttpError con status adecuados (405, 401, 415, 422, 404, 409, 502, 500) según el caso.
- Refactor: usar sendError/sendSuccess y HttpError desde _shared/utils.ts para respuestas consistentes y logging seguro.
- Validación: agrupar errores de parse/validación en un único mensaje numerado (cada error en nueva línea).
- OpenAI: manejo explícito de fallos (MissingEnv, JSON inválido, salida estructurada ausente) y mapeo a status apropiados.
- Supabase: distinguir errores 404/409/500 en consultas e inserts; incluir detalles en internalDetails para diagnóstico server-side.
- Eliminada dependencia de invocación HTTP a ai-structured; usar servicio compartido directo.
- Ajustes menores en mensajes y configuración (deno imports/deno.json) y tests marcados como ignorados donde corresponde.
2026-02-05 15:54:04 -06:00
Guillermo.Arrieta 7660d2c3a0 inicio de funcion de generación de asignatura 2026-02-05 15:53:23 -06:00
Guillermo.Arrieta e5657d6b0f chore(db): actualizar esquema/backups (auditoría de planes, hashes y conversation_id)
- Agrega fn_log_cambios_planes_estudio y trigger para registrar cambios en cambios_plan, usando response_id (reemplaza interaccion_ia_id).
- Extiende planes_estudio con conversation_id (unique) y plan_hash; agrega asignatura_hash en asignaturas; corrige unaccent_immutable y añade extensión http.
- Actualiza seeds/backups (data_backup.sql / scheme_backup.sql) y ajusta script de diff (sql_para_local_como_remoto.sql), elimina el diff viejo y actualiza archivos auxiliares (deno.lock, CLI temp).
2026-02-05 15:52:56 -06:00
alexrg b1a90858dc revert 1af0358e65
Deploy Function / deploy (push) Failing after 43s
revert Merge pull request 'REFACTOR OpenAI service to manage env and convo creation' (#12) from issue/9-hacer-una-funcin-que-inserte-el-id-de-conversacin into main

Reviewed-on: AlexRG/genesis-2#12
2026-02-05 20:41:28 +00:00
roberto.silva 132a51133b revert e1d865e6c3
Deploy Function / deploy (push) Failing after 45s
revert posible solución a issue #60
2026-02-05 16:11:09 +00:00
alexrg 0b7d2e83d7 Refactor OpenAI service to manage env and convo creation
- Add fromEnv factory to OpenAIService to handle env vars
- Move conversation creation into OpenAIService
- Update create- chat-conversation function to use new OpenAIService
  methods
- Add CORS headers to responses
2026-02-03 09:38:56 -06:00
alexrg e024057e47 Add create-chat-conversation function and related configurations 2026-02-03 09:26:30 -06:00
Guillermo.Arrieta e1d865e6c3 posible solución a issue #60
Deploy Function / deploy (push) Successful in 21s
2026-01-30 12:24:59 -06:00
Guillermo.Arrieta fdc8b688b3 generacion de plane exitosa y cambios en BDD
Deploy Function / deploy (push) Successful in 24s
2026-01-22 14:34:26 -06:00
Guillermo.Arrieta 8ef3f24652 Versión funcional de creación de plan de estudios con IA 2026-01-22 14:32:22 -06:00
Guillermo.Arrieta f15ab86e7f wip 2026-01-22 14:31:47 -06:00
Guillermo.Arrieta 1727b09bfb Función de ai-structured simplificada + tipado de la entrada 2026-01-22 14:31:47 -06:00
Guillermo.Arrieta 7a29f1a87d Antes de cambio de ai-structured 2026-01-22 14:30:53 -06:00
Guillermo.Arrieta 3170ed6975 Primera version de ai-generate-plan 2026-01-22 14:30:53 -06:00
Guillermo.Arrieta d5a095876e wip 2026-01-22 14:30:53 -06:00
Guillermo.Arrieta bb734cddd8 wip 2026-01-22 14:30:52 -06:00
Guillermo.Arrieta cd615d1f6e backup de base de datos 2026-01-22 13:52:12 -06:00
alexrg c51281856a feat: update deno.json and deno.lock to include OpenAI and Zod imports; add sample PDF file
- Added imports for OpenAI and Zod in deno.json
- Updated deno.lock with new versions for OpenAI and Zod
- Introduced a sample PDF file demonstrating bookmark functionality
- Refactored ai-structured function to improve error handling and logging
- Updated tests to reflect changes in input structure and expected output
2026-01-19 16:12:17 -06:00
alexrg 1d5d4b6a4e fix: update database queries to use 'template' instead of 'template_id' and adjust related references in ai_generate_plan function 2026-01-16 14:51:42 -06:00
alexrg 6c2faa97f1 test: enhance ai_generate_plan test for structured data validation and normalization 2026-01-16 11:04:28 -06:00
alexrg e321935286 feat: initialize database schema with essential tables, types, and functions for academic management system
- Created multiple tables including 'asignaturas', 'carreras', 'planes_estudio', and others to manage academic entities.
- Defined various ENUM types for categorizing academic roles, task statuses, and notification types.
- Implemented triggers and functions for automatic timestamp updates and validation of cycle numbers in subjects.
- Established foreign key relationships to maintain data integrity across tables.
- Added necessary extensions for enhanced functionality, including 'pgsodium', 'pg_graphql', and 'pg_stat_statements'.
2026-01-16 10:53:32 -06:00
alexrg 81262d706a Refactor input normalization and enhance logging for OpenAI function 2026-01-14 15:25:14 -06:00