commit 165d78cad1c0596e0f24e176718cbb1955407124 Author: Arturo Corro Date: Sat Mar 22 12:38:21 2025 -0600 first commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8f0de65 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.{yml,yaml}] +indent_size = 2 + +[docker-compose.yml] +indent_size = 4 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7333620 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,38 @@ +* text=auto eol=lf + +*.blade.php diff=html +*.css diff=css +*.html diff=html +*.md diff=markdown +*.php diff=php + +/.github export-ignore +CHANGELOG.md export-ignore +.styleci.yml export-ignore + +# Ignorar archivos de configuración y herramientas de desarrollo +.editorconfig export-ignore +.prettierrc.json export-ignore +.prettierignore export-ignore +.eslintrc.json export-ignore + +# Ignorar node_modules y dependencias locales +node_modules/ export-ignore +vendor/ export-ignore + +# Ignorar archivos de build +npm-debug.log export-ignore + +# Ignorar carpetas de logs y caché +storage/logs/ export-ignore +storage/framework/ export-ignore + +# Ignorar carpetas de compilación de frontend +public/build/ export-ignore +dist/ export-ignore + +# Ignorar archivos de CI/CD +.github/ export-ignore +.gitlab-ci.yml export-ignore +.vscode/ export-ignore +.idea/ export-ignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d07bec2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +/node_modules +/vendor +/.vscode +/.nova +/.fleet +/.phpactor.json +/.phpunit.cache +/.phpunit.result.cache +/.zed +/.idea diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..5d3dfee --- /dev/null +++ b/.prettierignore @@ -0,0 +1,16 @@ +# Dependencias de Composer y Node.js +/vendor/ +/node_modules/ + +# Caché y logs +/storage/ +*.log +*.cache + +# Archivos del sistema +.DS_Store +Thumbs.db + +# Configuración de editores +.idea/ +.vscode/ diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..5f11c9c --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,29 @@ +{ + "arrowParens": "avoid", + "bracketSpacing": true, + "bracketSameLine": true, + "htmlWhitespaceSensitivity": "css", + "insertPragma": false, + "jsxSingleQuote": true, + "printWidth": 120, + "proseWrap": "preserve", + "quoteProps": "as-needed", + "requirePragma": false, + "semi": true, + "singleQuote": true, + "tabWidth": 4, + "trailingComma": "none", + "useTabs": false, + "endOfLine": "lf", + "embeddedLanguageFormatting": "auto", + "overrides": [ + { + "files": [ + "resources/assets/**/*.js" + ], + "options": { + "semi": false + } + } + ] +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..486d340 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2025 koneko + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Providers/VuexyChatbotServiceProvider.php b/Providers/VuexyChatbotServiceProvider.php new file mode 100644 index 0000000..b33e68a --- /dev/null +++ b/Providers/VuexyChatbotServiceProvider.php @@ -0,0 +1,45 @@ +loadRoutesFrom(__DIR__.'/../routes/admin.php'); + + + // Cargar vistas del paquete + $this->loadViewsFrom(__DIR__.'/../resources/views', 'vuexy-chatbot'); + + + // Register the migrations + $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); + + + // Registrar Livewire Components + $components = [ + //'cache-functions' => CacheFunctions::class, + ]; + + foreach ($components as $alias => $component) { + Livewire::component($alias, $component); + } + + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..1d75e61 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ + +

+ + Koneko Soluciones Tecnológicas Logo + +

+ +

+ Latest Stable Version + License + Email +

+ +--- + +# Laravel Vuexy \ No newline at end of file diff --git a/Services/VuexyChatBotService.php b/Services/VuexyChatBotService.php new file mode 100644 index 0000000..3f7808e --- /dev/null +++ b/Services/VuexyChatBotService.php @@ -0,0 +1,8 @@ +smallIncrements('id'); + + $table->string('name')->unique(); + $table->string('slug')->unique()->index(); + $table->string('api_endpoint'); + $table->boolean('active')->default(true)->index(); + + // Auditoría + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_providers'); + } +}; diff --git a/database/migrations/2025_03_19_212103_create_chatbot_provider_settings_table.php b/database/migrations/2025_03_19_212103_create_chatbot_provider_settings_table.php new file mode 100644 index 0000000..31c4602 --- /dev/null +++ b/database/migrations/2025_03_19_212103_create_chatbot_provider_settings_table.php @@ -0,0 +1,41 @@ +smallIncrements('id'); + + $table->unsignedSmallInteger('provider_id')->index(); + + $table->string('api_key'); + $table->string('model')->nullable(); + $table->float('temperature', 3, 2)->default(0.7); + $table->integer('max_tokens')->default(4096); + $table->float('frequency_penalty', 3, 2)->default(0.0); + $table->float('presence_penalty', 3, 2)->default(0.0); + + // Auditoría + $table->timestamps(); + + // Relaciones + $table->foreign('provider_id')->references('id')->on('chatbot_providers')->cascadeOnUpdate()->cascadeOnDelete(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_provider_settings'); + } +}; diff --git a/database/migrations/2025_03_19_212104_create_chatbot_client_settings_table.php b/database/migrations/2025_03_19_212104_create_chatbot_client_settings_table.php new file mode 100644 index 0000000..62d3149 --- /dev/null +++ b/database/migrations/2025_03_19_212104_create_chatbot_client_settings_table.php @@ -0,0 +1,40 @@ +smallIncrements('id'); + + $table->unsignedMediumInteger('user_id')->index(); + $table->unsignedSmallInteger('provider_id')->index(); + + $table->json('preferences')->nullable()->comment('Ajustes personalizados específicos del cliente para el chatbot'); + $table->decimal('monthly_budget', 10, 2)->default(0); + + // Auditoría + $table->timestamps(); + + // Relaciones + $table->foreign('user_id')->references('id')->on('users')->cascadeOnUpdate()->cascadeOnDelete(); + $table->foreign('provider_id')->references('id')->on('chatbot_providers')->cascadeOnUpdate()->cascadeOnDelete(); + }); + + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_privacy_settings'); + } +}; diff --git a/database/migrations/2025_03_19_212105_create_chatbot_privacy_settings_table.php b/database/migrations/2025_03_19_212105_create_chatbot_privacy_settings_table.php new file mode 100644 index 0000000..a3826e4 --- /dev/null +++ b/database/migrations/2025_03_19_212105_create_chatbot_privacy_settings_table.php @@ -0,0 +1,33 @@ +smallIncrements('id'); + + $table->boolean('store_conversations')->default(true); + $table->unsignedInteger('conversation_retention_days')->default(365); + $table->boolean('auto_anonymize')->default(true); + + // Auditoría + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_privacy_settings'); + } +}; diff --git a/database/migrations/2025_03_19_212106_create_chatbot_resources_table.php b/database/migrations/2025_03_19_212106_create_chatbot_resources_table.php new file mode 100644 index 0000000..976b1b5 --- /dev/null +++ b/database/migrations/2025_03_19_212106_create_chatbot_resources_table.php @@ -0,0 +1,34 @@ +smallIncrements('id'); + + $table->string('title'); + $table->text('description')->nullable(); + $table->string('resource_url'); + $table->boolean('active')->default(true)->index(); + + // Auditoría + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_resources'); + } +}; diff --git a/database/migrations/2025_03_19_212107_create_chatbot_faqs_table.php b/database/migrations/2025_03_19_212107_create_chatbot_faqs_table.php new file mode 100644 index 0000000..987065a --- /dev/null +++ b/database/migrations/2025_03_19_212107_create_chatbot_faqs_table.php @@ -0,0 +1,35 @@ +smallIncrements('id'); + + $table->string('question')->unique(); + $table->text('answer'); + $table->unsignedInteger('priority')->default(0)->index(); + $table->boolean('active')->default(true); + + // Auditoría + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_faqs'); + } +}; diff --git a/database/migrations/2025_03_19_212108_create_chatbot_manual_training_table.php b/database/migrations/2025_03_19_212108_create_chatbot_manual_training_table.php new file mode 100644 index 0000000..3e210bb --- /dev/null +++ b/database/migrations/2025_03_19_212108_create_chatbot_manual_training_table.php @@ -0,0 +1,38 @@ +smallIncrements('id'); + + $table->string('input')->unique(); + $table->text('expected_output'); + $table->boolean('validated')->default(false)->index(); + $table->unsignedMediumInteger('validated_by')->nullable(); + $table->timestamp('validated_at')->nullable(); + + // Auditoría + $table->timestamps(); + + // Relaciones + $table->foreign('validated_by')->references('id')->on('users')->nullOnDelete(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_manual_training'); + } +}; diff --git a/database/migrations/2025_03_19_212109_create_chatbot_guests_table.php b/database/migrations/2025_03_19_212109_create_chatbot_guests_table.php new file mode 100644 index 0000000..3c53ba9 --- /dev/null +++ b/database/migrations/2025_03_19_212109_create_chatbot_guests_table.php @@ -0,0 +1,34 @@ +smallIncrements('id'); + + $table->uuid('uuid')->unique()->index(); + $table->string('ip_address')->nullable(); + $table->string('browser')->nullable(); + $table->string('location')->nullable(); + + // Auditoría + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_guests'); + } +}; diff --git a/database/migrations/2025_03_19_212110_create_chatbot_conversations_table.php b/database/migrations/2025_03_19_212110_create_chatbot_conversations_table.php new file mode 100644 index 0000000..9f6857d --- /dev/null +++ b/database/migrations/2025_03_19_212110_create_chatbot_conversations_table.php @@ -0,0 +1,43 @@ +smallIncrements('id'); + + $table->uuid('uuid')->unique()->index(); + + // Relaciones polimórficas para participantes (usuarios, clientes, visitantes anónimos) + $table->unsignedMediumInteger('user_id')->nullable()->index(); + + $table->unsignedSmallInteger('provider_id')->index(); + + $table->enum('status', ['active', 'closed', 'archived'])->default('active')->index(); + + // Auditoría + $table->timestamps(); + $table->softDeletes(); + + // Relaciones + $table->foreign('user_id')->references('id')->on('users')->nullOnDelete(); + $table->foreign('provider_id')->references('id')->on('chatbot_providers')->cascadeOnUpdate()->cascadeOnDelete(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_conversations'); + } +}; diff --git a/database/migrations/2025_03_19_212111_create_chatbot_conversation_messages_table.php b/database/migrations/2025_03_19_212111_create_chatbot_conversation_messages_table.php new file mode 100644 index 0000000..3f0afa7 --- /dev/null +++ b/database/migrations/2025_03_19_212111_create_chatbot_conversation_messages_table.php @@ -0,0 +1,43 @@ +smallIncrements('id'); + + $table->unsignedSmallInteger('conversation_id')->index(); + + $table->enum('sender', ['user', 'chatbot']); + + $table->text('message'); + + $table->jsonb('metadata')->nullable()->comment('Información adicional del mensaje, como tokens usados, modelo usado, proveedor, etc.'); + + // Auditoría + $table->timestamps(); + + // Indices + $table->index(['conversation_id', 'sender']); + + // Relaciones + $table->foreign('conversation_id')->references('id')->on('chatbot_conversations')->cascadeOnUpdate()->cascadeOnDelete(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_conversation_messages'); + } +}; diff --git a/database/migrations/2025_03_19_212112_create_chatbot_usage_metrics_table.php b/database/migrations/2025_03_19_212112_create_chatbot_usage_metrics_table.php new file mode 100644 index 0000000..345a47f --- /dev/null +++ b/database/migrations/2025_03_19_212112_create_chatbot_usage_metrics_table.php @@ -0,0 +1,35 @@ +smallIncrements('id'); + + $table->date('metric_date')->index(); + $table->unsignedInteger('total_conversations')->default(0); + $table->unsignedInteger('total_messages')->default(0); + $table->unsignedInteger('unique_users')->default(0); + $table->unsignedInteger('guests')->default(0); + + // Auditoría + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_usage_metrics'); + } +}; diff --git a/database/migrations/2025_03_19_212114_create_chatbot_user_feedback_table.php b/database/migrations/2025_03_19_212114_create_chatbot_user_feedback_table.php new file mode 100644 index 0000000..46724d0 --- /dev/null +++ b/database/migrations/2025_03_19_212114_create_chatbot_user_feedback_table.php @@ -0,0 +1,42 @@ +smallIncrements('id'); + + $table->unsignedSmallInteger('conversation_id')->index(); + $table->unsignedMediumInteger('user_id')->nullable()->index(); + + $table->integer('rating')->default(5)->index(); + $table->text('feedback')->nullable(); + + // Auditoría + $table->timestamps(); + + // Indices + $table->index(['conversation_id', 'user_id']); + + // Relaciones + $table->foreign('conversation_id')->references('id')->on('chatbot_conversations')->cascadeOnUpdate()->cascadeOnDelete(); + $table->foreign('user_id')->references('id')->on('users')->nullOnDelete(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_user_feedback'); + } +}; diff --git a/database/migrations/2025_03_19_212115_create_chatbot_sensitive_data_logs_table.php b/database/migrations/2025_03_19_212115_create_chatbot_sensitive_data_logs_table.php new file mode 100644 index 0000000..7d5f883 --- /dev/null +++ b/database/migrations/2025_03_19_212115_create_chatbot_sensitive_data_logs_table.php @@ -0,0 +1,40 @@ +smallIncrements('id'); + + $table->unsignedSmallInteger('conversation_message_id')->index(); + + $table->string('detected_type')->index()->comment('Ej: RFC, Teléfono, Tarjeta de crédito'); + $table->text('masked_data'); + + // Auditoría + $table->timestamps(); + + // Indices + $table->index(['conversation_message_id', 'detected_type'])->name('chatbot_sensitive_data_logs_message_detected_type_index'); + + // Relaciones + $table->foreign('conversation_message_id')->references('id')->on('chatbot_conversation_messages')->cascadeOnUpdate()->cascadeOnDelete(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_sensitive_data_logs'); + } +}; diff --git a/database/migrations/2025_03_19_212116_create_chatbot_security_alerts_table.php b/database/migrations/2025_03_19_212116_create_chatbot_security_alerts_table.php new file mode 100644 index 0000000..bf82274 --- /dev/null +++ b/database/migrations/2025_03_19_212116_create_chatbot_security_alerts_table.php @@ -0,0 +1,34 @@ +smallIncrements('id'); + + $table->string('alert_type')->index(); + $table->text('description'); + $table->boolean('resolved')->default(false); + $table->timestamp('resolved_at')->nullable(); + + // Auditoría + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_security_alerts'); + } +}; diff --git a/database/migrations/2025_03_19_212118_create_chatbot_notifications_settings_table.php b/database/migrations/2025_03_19_212118_create_chatbot_notifications_settings_table.php new file mode 100644 index 0000000..c4cdc5a --- /dev/null +++ b/database/migrations/2025_03_19_212118_create_chatbot_notifications_settings_table.php @@ -0,0 +1,38 @@ +smallIncrements('id'); + + $table->unsignedMediumInteger('user_id')->index(); + + $table->boolean('email_notifications')->default(true); + $table->boolean('sms_notifications')->default(false); + $table->boolean('push_notifications')->default(true); + + // Auditoría + $table->timestamps(); + + // Relaciones + $table->foreign('user_id')->references('id')->on('users')->cascadeOnUpdate()->cascadeOnDelete(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('chatbot_notifications_settings'); + } +}; diff --git a/routes/admin.php b/routes/admin.php new file mode 100644 index 0000000..38a32fa --- /dev/null +++ b/routes/admin.php @@ -0,0 +1,9 @@ +name('admin.')->middleware(['web', 'auth', 'admin.settings'])->group(function () { + +});