first commit

This commit is contained in:
Arturo Corro 2025-03-22 12:38:21 -06:00
commit 165d78cad1
28 changed files with 793 additions and 0 deletions

18
.editorconfig Normal file
View File

@ -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

38
.gitattributes vendored Normal file
View File

@ -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

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
/node_modules
/vendor
/.vscode
/.nova
/.fleet
/.phpactor.json
/.phpunit.cache
/.phpunit.result.cache
/.zed
/.idea

16
.prettierignore Normal file
View File

@ -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/

29
.prettierrc.json Normal file
View File

@ -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
}
}
]
}

0
CHANGELOG.md Normal file
View File

0
CONTRIBUTING.md Normal file
View File

9
LICENSE Normal file
View File

@ -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.

View File

@ -0,0 +1,45 @@
<?php
namespace Koneko\VuexyChatbot\Providers;
use Illuminate\Support\ServiceProvider;
use Livewire\Livewire;
class VuexyChatbotServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
// Register the module's routes
$this->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);
}
}
}

16
README.md Normal file
View File

@ -0,0 +1,16 @@
<p align="center">
<a href="https://koneko.mx" target="_blank">
<img src="https://git.koneko.mx/Koneko-ST/koneko-st/raw/branch/main/logo-images/horizontal-05.png" width="400" alt="Koneko Soluciones Tecnológicas Logo">
</a>
</p>
<p align="center">
<a href="https://packagist.org/packages/koneko/laravel-vuexy-admin"><img src="https://img.shields.io/packagist/v/koneko/laravel-vuexy-admin" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/koneko/laravel-vuexy-admin"><img src="https://img.shields.io/packagist/l/koneko/laravel-vuexy-admin" alt="License"></a>
<a href="mailto:contacto@koneko.mx"><img src="https://img.shields.io/badge/contact-email-green" alt="Email"></a>
</p>
---
# Laravel Vuexy

View File

@ -0,0 +1,8 @@
<?php
namespace Koneko\VuexyPrintManager\Services;
class VuexyPrintManagerService
{
//
}

30
composer.json Normal file
View File

@ -0,0 +1,30 @@
{
"name": "koneko/laravel-vuexy-chatbot",
"description": "Laravel Vuexy Chatbot, un modulo optimizado para México",
"type": "library",
"license": "MIT",
"require": {
"php": "^8.2",
"koneko/laravel-vuexy-admin": "@dev"
},
"autoload": {
"psr-4": {
"Koneko\\VuexyChatbot\\": ""
}
},
"extra": {
"laravel": {
"providers": [
"Koneko\\VuexyChatbot\\Providers\\VuexyChatbotServiceProvider"
]
}
},
"authors": [
{
"name": "Arturo Corro Pacheco",
"email": "arturo@koneko.mx"
}
],
"minimum-stability": "dev",
"prefer-stable": true
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_providers', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_provider_settings', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_client_settings', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_privacy_settings', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_resources', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_faqs', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_manual_training', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_guests', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_conversations', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_conversation_messages', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_usage_metrics', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_user_feedback', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_sensitive_data_logs', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_security_alerts', function (Blueprint $table) {
$table->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');
}
};

View File

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('chatbot_notifications_settings', function (Blueprint $table) {
$table->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');
}
};

9
routes/admin.php Normal file
View File

@ -0,0 +1,9 @@
<?php
use Illuminate\Support\Facades\Route;
use Koneko\VuexyAdmin\Http\Controllers\UserController;
// Grupo raíz para admin con middleware y prefijos comunes
Route::prefix('admin')->name('admin.')->middleware(['web', 'auth', 'admin.settings'])->group(function () {
});