Major refactoring cleanup: - Add new controller architecture (class-controller-*.php) - Add new settings-v2 UI (views/settings-v2/) - Add new CSS architecture (agentic-sidebar.css, tokens) - Add esbuild build pipeline (scripts/build.js, package.json) - Add composer dependencies (vendor/) - Add frontend src directory (assets/js/src/index.jsx) - Add documentation files - Remove old/obsolete files (class-settings.php, old CSS) This commits all pending changes from previous refactoring efforts.
124 lines
4.8 KiB
PHP
124 lines
4.8 KiB
PHP
<?php
|
|
/**
|
|
* Settings V2: General.
|
|
*
|
|
* @package WP_Agentic_Writer
|
|
*/
|
|
|
|
if (!defined("ABSPATH")) {
|
|
exit();
|
|
} ?>
|
|
<div class="section-head">
|
|
<div>
|
|
<p class="eyebrow"><?php esc_html_e("Foundation", "wp-agentic-writer"); ?></p>
|
|
<h2><?php esc_html_e("General settings", "wp-agentic-writer"); ?></h2>
|
|
<p><?php esc_html_e(
|
|
"Manage your agent's core identity, clarification limits, and language preferences.",
|
|
"wp-agentic-writer",
|
|
); ?></p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel">
|
|
<div class="panel-head">
|
|
<div class="panel-title">
|
|
<h3><?php esc_html_e(
|
|
"Global Context & Brand Voice",
|
|
"wp-agentic-writer",
|
|
); ?></h3>
|
|
<p><?php esc_html_e(
|
|
"Set unbreakable rules, tone, and identity for the AI. This context is injected into every single agentic request.",
|
|
"wp-agentic-writer",
|
|
); ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="field" style="width: 100%;">
|
|
<textarea class="field-control" id="global_context" name="wp_agentic_writer_settings[global_context]" rows="5" placeholder="<?php esc_attr_e(
|
|
"e.g., You are a senior attorney writing for a legal blog. Never give direct legal advice. Always use British English. Avoid mentioning competitors.",
|
|
"wp-agentic-writer",
|
|
); ?>" style="width: 100%; font-family: ui-monospace, SFMono-Regular, monospace; resize: vertical;"><?php echo esc_textarea(
|
|
$global_context ?? "",
|
|
); ?></textarea>
|
|
<p class="help" style="margin-top: 8px;">
|
|
<?php esc_html_e(
|
|
"Think of this as the DNA of your agent. While Memanto learns from user feedback organically, this field defines hard guardrails that the AI must always follow.",
|
|
"wp-agentic-writer",
|
|
); ?>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel">
|
|
<div class="panel-head"><div class="panel-title"><h3><?php esc_html_e(
|
|
"Research & clarification",
|
|
"wp-agentic-writer",
|
|
); ?></h3><p><?php esc_html_e(
|
|
"Control question generation.",
|
|
"wp-agentic-writer",
|
|
); ?></p></div></div>
|
|
<div class="panel-body">
|
|
<label class="switch-row" style="margin-top:0px"><input type="checkbox" name="wp_agentic_writer_settings[enable_clarification_quiz]" value="1" <?php checked(
|
|
$enable_clarification_quiz,
|
|
); ?>><span class="switch"></span><span><?php esc_html_e(
|
|
"Ask clarification quiz before writing",
|
|
"wp-agentic-writer",
|
|
); ?></span></label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel">
|
|
<div class="panel-head"><div class="panel-title"><h3><?php esc_html_e(
|
|
"Language preferences",
|
|
"wp-agentic-writer",
|
|
); ?></h3><p><?php esc_html_e(
|
|
"Preferred writing languages and chat memory limits.",
|
|
"wp-agentic-writer",
|
|
); ?></p></div></div>
|
|
<div class="panel-body grid-2">
|
|
<div class="field"><label for="chat_history_limit"><?php esc_html_e(
|
|
"Chat history limit",
|
|
"wp-agentic-writer",
|
|
); ?></label><input class="field-control" type="number" min="1" id="chat_history_limit" name="wp_agentic_writer_settings[chat_history_limit]" value="<?php echo esc_attr(
|
|
$chat_history_limit,
|
|
); ?>"></div>
|
|
<div class="field"><label for="clarity_confidence_threshold"><?php esc_html_e(
|
|
"Clarity threshold",
|
|
"wp-agentic-writer",
|
|
); ?></label><select class="field-control" id="clarity_confidence_threshold" name="wp_agentic_writer_settings[clarity_confidence_threshold]"><option value="0.4" <?php selected(
|
|
$clarity_confidence_threshold,
|
|
"0.4",
|
|
); ?>>Relaxed</option><option value="0.6" <?php selected(
|
|
$clarity_confidence_threshold,
|
|
"0.6",
|
|
); ?>>Balanced</option><option value="0.8" <?php selected(
|
|
$clarity_confidence_threshold,
|
|
"0.8",
|
|
); ?>>Strict</option></select></div>
|
|
<div class="field language-field"><label for="preferred_languages"><?php esc_html_e(
|
|
"Preferred languages",
|
|
"wp-agentic-writer",
|
|
); ?></label><select class="field-control" id="preferred_languages" name="wp_agentic_writer_settings[preferred_languages][]" multiple><?php foreach (
|
|
(array) $available_languages
|
|
as $language_value => $language_label
|
|
): ?><option value="<?php echo esc_attr($language_value); ?>" <?php selected(
|
|
in_array($language_value, (array) $preferred_languages, true),
|
|
); ?>><?php echo esc_html(
|
|
$language_label,
|
|
); ?></option><?php endforeach; ?></select><p class="help"><?php esc_html_e(
|
|
"These are passed to the editor language controls.",
|
|
"wp-agentic-writer",
|
|
); ?></p></div>
|
|
<div class="field"><label for="custom_languages"><?php esc_html_e(
|
|
"Custom languages",
|
|
"wp-agentic-writer",
|
|
); ?></label><input class="field-control" type="text" id="custom_languages" name="wp_agentic_writer_settings[custom_languages][]" value="<?php echo esc_attr(
|
|
implode(", ", (array) $custom_languages),
|
|
); ?>" placeholder="Javanese, Sundanese"><p class="help"><?php esc_html_e(
|
|
"Separate multiple custom languages with commas.",
|
|
"wp-agentic-writer",
|
|
); ?></p></div>
|
|
</div>
|
|
</div>
|