feat: consolidate docs, backend/session infra, and settings updates
This commit is contained in:
@@ -35,10 +35,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<p class="mb-3">
|
||||
<?php esc_html_e( 'Download the Local Backend proxy to run on your development machine. This allows unlimited, private AI content generation using your existing Claude CLI setup.', 'wp-agentic-writer' ); ?>
|
||||
</p>
|
||||
<a href="<?php echo esc_url( WP_AGENTIC_WRITER_URL . 'downloads/agentic-writer-local-backend.zip' ); ?>"
|
||||
class="btn btn-primary btn-lg" download>
|
||||
<a href="https://downloads.wpagentic.dev/wp-agentic-writer/agentic-writer-local-backend.zip"
|
||||
class="btn btn-primary btn-lg" target="_blank" rel="noopener">
|
||||
<i class="bi bi-download me-2"></i>
|
||||
<?php esc_html_e( 'Download Local Backend v1.0.0', 'wp-agentic-writer' ); ?>
|
||||
<?php esc_html_e( 'Download Local Backend v1.1.0', 'wp-agentic-writer' ); ?>
|
||||
</a>
|
||||
|
||||
<details class="mt-3">
|
||||
@@ -222,6 +222,91 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Brave Search Configuration -->
|
||||
<div class="col-12">
|
||||
<div class="card border-0 border-primary">
|
||||
<div class="card-header border-bottom-0 pt-3">
|
||||
<div class="d-flex align-items-center">
|
||||
<div>
|
||||
<h5 class="card-title mb-1 d-flex align-items-center gap-2">
|
||||
<i class="bi bi-search text-primary"></i>
|
||||
<?php esc_html_e( 'Step 4: Enable Web Search (Optional)', 'wp-agentic-writer' ); ?>
|
||||
</h5>
|
||||
<p class="text-muted small mb-0">
|
||||
<?php esc_html_e( 'Add Brave Search capability to your local backend for real-time web research', 'wp-agentic-writer' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="alert alert-info mb-3">
|
||||
<i class="bi bi-info-circle me-2"></i>
|
||||
<strong><?php esc_html_e( 'Requirements:', 'wp-agentic-writer' ); ?></strong>
|
||||
<?php esc_html_e( 'You need a Brave Search API key (free tier available at', 'wp-agentic-writer' ); ?>
|
||||
<a href="https://brave.com/search/api/" target="_blank">brave.com/search/api</a>)
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-semibold">
|
||||
<?php esc_html_e( '1. Get Brave API Key (if not already configured in General tab)', 'wp-agentic-writer' ); ?>
|
||||
</label>
|
||||
<p class="text-muted small">
|
||||
<?php esc_html_e( 'The API key you configured in Agentic Writer → Settings → General → Search will also be used by the local backend.', 'wp-agentic-writer' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-semibold">
|
||||
<?php esc_html_e( '2. Add API Key to Local Backend Proxy', 'wp-agentic-writer' ); ?>
|
||||
</label>
|
||||
<?php
|
||||
$brave_api_key = $settings['brave_search_api_key'] ?? '';
|
||||
$masked_key = $brave_api_key ? substr($brave_api_key, 0, 8) . '...' . substr($brave_api_key, -4) : '';
|
||||
?>
|
||||
<?php if ( $brave_api_key ) : ?>
|
||||
<p class="text-muted small mb-2">
|
||||
<?php esc_html_e( 'Navigate to your extracted folder, then run:', 'wp-agentic-writer' ); ?>
|
||||
</p>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<code id="brave-env-command">echo 'BRAVE_SEARCH_API_KEY="<?php echo esc_attr( $brave_api_key ); ?>"' > .env</code>
|
||||
<button type="button" class="btn btn-sm btn-outline-light" onclick="copyToClipboard(document.getElementById('brave-env-command').textContent)">
|
||||
<i class="bi bi-clipboard"></i>
|
||||
</button>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<div class="alert alert-warning mb-2">
|
||||
<i class="bi bi-exclamation-triangle me-2"></i>
|
||||
<?php esc_html_e( 'Brave API key not configured. Add it in Agentic Writer → Settings → General → Search section first.', 'wp-agentic-writer' ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-semibold">
|
||||
<?php esc_html_e( '3. Restart the Proxy', 'wp-agentic-writer' ); ?>
|
||||
</label>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<code id="restart-proxy-command">./stop-proxy.sh && ./start-proxy.sh</code>
|
||||
<button type="button" class="btn btn-sm btn-outline-light" onclick="copyToClipboard(document.getElementById('restart-proxy-command').textContent)">
|
||||
<i class="bi bi-clipboard"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-success">
|
||||
<i class="bi bi-check-circle me-2"></i>
|
||||
<strong><?php esc_html_e( 'Verification:', 'wp-agentic-writer' ); ?></strong>
|
||||
<?php esc_html_e( 'When the proxy starts, you should see "Brave Search: ✅ CONFIGURED" in the output.', 'wp-agentic-writer' ); ?>
|
||||
</div>
|
||||
|
||||
<p class="text-muted small mb-0">
|
||||
<strong><?php esc_html_e( 'Note:', 'wp-agentic-writer' ); ?></strong>
|
||||
<?php esc_html_e( 'Also ensure "Search" is enabled in the sidebar settings when using AI features that need web research.', 'wp-agentic-writer' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Help -->
|
||||
<div class="col-12">
|
||||
<div class="card border-0 border-warning">
|
||||
@@ -266,6 +351,31 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function copyToClipboard(text) {
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard.writeText(text).then(function() {
|
||||
alert('Command copied to clipboard!');
|
||||
}).catch(function(err) {
|
||||
console.error('Copy failed:', err);
|
||||
});
|
||||
} else {
|
||||
// Fallback for older browsers
|
||||
var textarea = document.createElement('textarea');
|
||||
textarea.value = text;
|
||||
textarea.style.position = 'fixed';
|
||||
textarea.style.opacity = '0';
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
try {
|
||||
document.execCommand('copy');
|
||||
alert('Command copied to clipboard!');
|
||||
} catch (err) {
|
||||
console.error('Copy failed:', err);
|
||||
}
|
||||
document.body.removeChild(textarea);
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
$('#test-local-backend').on('click', function() {
|
||||
const btn = $(this);
|
||||
|
||||
Reference in New Issue
Block a user