This commit is contained in:
Lizandro Guarnizo
2026-06-02 13:13:29 -05:00
parent ba76754331
commit 28d0eae715
7 changed files with 434 additions and 77 deletions
+28 -6
View File
@@ -48,10 +48,10 @@
<thead class="border-b border-gray-200 text-left text-xs font-semibold text-gray-500 uppercase">
<tr>
<th class="py-2 px-3">Nombre</th>
<th class="py-2 px-3">Módulo</th>
<th class="py-2 px-3">Provider</th>
<th class="py-2 px-3">Modelo</th>
<th class="py-2 px-3">API Key</th>
<th class="py-2 px-3">Base URL</th>
<th class="py-2 px-3">Estado</th>
<th class="py-2 px-3 text-right">Acciones</th>
</tr>
@@ -63,6 +63,16 @@
<template x-for="item in items" :key="item.ID">
<tr class="hover:bg-gray-50 transition">
<td class="py-2 px-3 font-medium" x-text="item.nombre"></td>
<td class="py-2 px-3">
<span class="px-2 py-0.5 rounded-full text-xs font-semibold"
:class="{
'bg-blue-100 text-blue-700': item.modulo === 'landing',
'bg-[#e9f0cf] text-[#5a7a1e]': item.modulo === 'query_runner',
'bg-gray-100 text-gray-500': !item.modulo
}"
x-text="item.modulo === 'landing' ? 'Landing' : item.modulo === 'query_runner' ? 'Query Runner' : 'Global'">
</span>
</td>
<td class="py-2 px-3">
<span class="px-2 py-0.5 rounded-full text-xs font-semibold"
:class="{
@@ -74,7 +84,6 @@
</td>
<td class="py-2 px-3 text-gray-500 font-mono text-xs" x-text="item.model_name || '—'"></td>
<td class="py-2 px-3 font-mono text-xs text-gray-400" x-text="item.api_key_hint"></td>
<td class="py-2 px-3 text-xs text-gray-400" x-text="item.base_url || 'default'"></td>
<td class="py-2 px-3">
<span :class="item.is_active ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-500'"
class="px-2 py-0.5 rounded-full text-xs font-semibold"
@@ -161,7 +170,20 @@
<div class="flex items-center gap-2">
<input x-model="form.is_active" type="checkbox" id="ai_is_active" class="rounded" />
<label for="ai_is_active" class="text-sm text-gray-700">Activo (usado por Landing Generator)</label>
<label for="ai_is_active" class="text-sm text-gray-700">Activo</label>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">Módulo / Servicio</label>
<select x-model="form.modulo"
class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-[#8eb02f]">
<option value="">Global (usado por todos como fallback)</option>
<option value="landing">Landing Generator</option>
<option value="query_runner">Query Runner SQL</option>
</select>
<p class="text-[10px] text-gray-400 mt-1">
Asigna esta IA a un servicio específico. "Global" actúa de fallback cuando un servicio no tiene IA propia.
</p>
</div>
</div>
@@ -209,7 +231,7 @@ function aiConfigApp() {
search: '',
showModal: false, editItem: null, deleteId: null,
errorMsg: '', successMsg: '', formError: '',
form: { nombre: '', provider: '', api_key: '', base_url: '', model_name: '', is_active: true, notes: '' },
form: { nombre: '', provider: '', api_key: '', base_url: '', model_name: '', is_active: true, notes: '', modulo: '' },
async init() { await this.load() },
@@ -229,14 +251,14 @@ function aiConfigApp() {
openAdd() {
this.editItem = null
this.form = { nombre: '', provider: 'qwen', api_key: '', base_url: '', model_name: 'qwen2.5-72b-instruct', is_active: true, notes: '' }
this.form = { nombre: '', provider: 'qwen', api_key: '', base_url: '', model_name: 'qwen2.5-72b-instruct', is_active: true, notes: '', modulo: '' }
this.formError = ''
this.showModal = true
},
openEdit(item) {
this.editItem = item
this.form = { nombre: item.nombre, provider: item.provider, api_key: '', base_url: item.base_url, model_name: item.model_name, is_active: item.is_active, notes: item.notes }
this.form = { nombre: item.nombre, provider: item.provider, api_key: '', base_url: item.base_url, model_name: item.model_name, is_active: item.is_active, notes: item.notes, modulo: item.modulo || '' }
this.formError = ''
this.showModal = true
},