Compare commits
1
Commits
f86717b542
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8ff7c6434 |
No files matched your search
@@ -303,6 +303,20 @@ if ($WpReady) {
|
||||
} else {
|
||||
Warn 'No se pudo auto-configurar. Re-ejecuta .\deploy.ps1 tras el asistente de WordPress.'
|
||||
}
|
||||
# Estilo editorial: copiar al wp-content (editable: editorial-style.php del pack)
|
||||
# e instalar el mu-plugin que lo inyecta en las instrucciones de la IA.
|
||||
$StyleRc = 1
|
||||
cmd /c "docker exec d0a1-wp mkdir -p /var/www/html/wp-content/mu-plugins >NUL 2>&1"
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
docker cp (Join-Path $ScriptDir 'editorial-style.php') d0a1-wp:/var/www/html/wp-content/editorial-style.php 2>$null
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
docker cp (Join-Path $ScriptDir 'mu-plugin-d0a1-editorial.php') d0a1-wp:/var/www/html/wp-content/mu-plugins/d0a1-editorial.php 2>$null
|
||||
$StyleRc = $LASTEXITCODE
|
||||
}
|
||||
}
|
||||
if ($StyleRc -eq 0) {
|
||||
Ok 'Estilo editorial activo (edita editorial-style.php y re-ejecuta para cambiarlo)'
|
||||
}
|
||||
} else {
|
||||
Warn 'WordPress aun no esta instalado. Tras el asistente del navegador,'
|
||||
Warn 'vuelve a ejecutar .\deploy.ps1 y los plugins de IA se configuran solos.'
|
||||
|
||||
@@ -171,6 +171,14 @@ if [ "$WP_READY" = "1" ]; then
|
||||
'{"host":"http://ollama:11434"}' --format=json >/dev/null 2>&1 \
|
||||
&& echo -e "${GREEN}✓${NC} Plugins de IA activados y conectados a Ollama (IA local)" \
|
||||
|| echo -e "${YELLOW}⚠ No se pudo auto-configurar. Re-ejecuta ./deploy.sh tras el asistente de WordPress.${NC}"
|
||||
# Estilo editorial: copiar al wp-content (editable: editorial-style.php del pack)
|
||||
# e instalar el mu-plugin que lo inyecta en las instrucciones de la IA.
|
||||
if docker cp "$SCRIPT_DIR/editorial-style.php" d0a1-wp:/var/www/html/wp-content/editorial-style.php >/dev/null 2>&1 \
|
||||
&& docker exec d0a1-wp mkdir -p /var/www/html/wp-content/mu-plugins \
|
||||
&& docker cp "$SCRIPT_DIR/mu-plugin-d0a1-editorial.php" \
|
||||
d0a1-wp:/var/www/html/wp-content/mu-plugins/d0a1-editorial.php >/dev/null 2>&1; then
|
||||
echo -e "${GREEN}✓${NC} Estilo editorial activo (edita editorial-style.php y re-ejecuta para cambiarlo)"
|
||||
fi
|
||||
else
|
||||
echo -e "${YELLOW}⚠ WordPress aun no está instalado. Tras el asistente del navegador,"
|
||||
echo -e " vuelve a ejecutar ./deploy.sh y los plugins de IA se configuran solos.${NC}"
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Estilo editorial de d0a1 para la IA local (WordPress "AI" plugin).
|
||||
* EDITA AQUI y re-ejecuta deploy para aplicarlo. La IA redacta segun esto.
|
||||
*/
|
||||
return array(
|
||||
'estilo' => 'Directo, claro y cercano. Sin humo. Espanol de Espana (tu, no usted). Frases cortas.',
|
||||
'reglas' => array(
|
||||
'Spanish (Spain) siempre, salvo que el contenido fuente este en otro idioma.',
|
||||
'Nada de relleno: cada frase aporta un dato, un beneficio o un paso.',
|
||||
'Precios en euros (EUR).',
|
||||
'Voz activa. Verbo al principio cuando sea natural.',
|
||||
),
|
||||
'prohibido' => array(
|
||||
'Emojis, hashtags ni llamadas a la accion genericas.',
|
||||
'Superlativos vacios ("increible", "revolucionario").',
|
||||
'Markdown ni comillas envolviendo el resultado.',
|
||||
),
|
||||
'titulares_max_chars' => 60,
|
||||
);
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: d0a1 — Instrucciones editoriales IA (mu-plugin)
|
||||
* Description: Inyecta el estilo editorial (editorial-style.php del pack) en las instrucciones de sistema del plugin "AI".
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
||||
|
||||
function d0a1_editorial_style() {
|
||||
$file = WP_CONTENT_DIR . '/editorial-style.php';
|
||||
if ( ! file_exists( $file ) ) { return null; }
|
||||
$s = include $file;
|
||||
return is_array( $s ) ? $s : null;
|
||||
}
|
||||
|
||||
function d0a1_editorial_block() {
|
||||
$s = d0a1_editorial_style();
|
||||
if ( ! $s ) { return ''; }
|
||||
$out = "\n\nESTILO EDITORIAL DEL SITIO (prioridad sobre instrucciones anteriores):\n";
|
||||
if ( ! empty( $s['estilo'] ) ) { $out .= 'Tono: ' . $s['estilo'] . "\n"; }
|
||||
if ( ! empty( $s['reglas'] ) ) {
|
||||
$out .= "Normas:\n";
|
||||
foreach ( $s['reglas'] as $r ) { $out .= '- ' . $r . "\n"; }
|
||||
}
|
||||
if ( ! empty( $s['prohibido'] ) ) {
|
||||
$out .= "Prohibido:\n";
|
||||
foreach ( $s['prohibido'] as $p ) { $out .= '- ' . $p . "\n"; }
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
// Global: todas las funciones IA del plugin (titulos, extractos, alt text, moderacion...).
|
||||
add_filter( 'wpai_system_instruction', function ( $instruction ) {
|
||||
return $instruction . d0a1_editorial_block();
|
||||
}, 10, 1 );
|
||||
|
||||
// Afinar titulares: max chars configurable en editorial-style.php.
|
||||
add_filter( 'wpai_title_generation_system_instruction', function ( $instruction ) {
|
||||
$s = d0a1_editorial_style();
|
||||
if ( $s && ! empty( $s['titulares_max_chars'] ) && $s['titulares_max_chars'] !== 80 ) {
|
||||
$instruction = preg_replace( '/Be no more than \d+ characters/', 'Be no more than ' . (int) $s['titulares_max_chars'] . ' characters', $instruction );
|
||||
}
|
||||
return $instruction;
|
||||
}, 10, 1 );
|
||||
Reference in new issue
Block a user