Ajout traduction Confluent→Français + suppression choix IA
Modifications de l'interface HTML: - Ajout onglet "Confluent → Français" avec traducteur brut - Appel API vers /api/translate/conf2fr - Renommage onglet "Traduction" → "Français → Confluent" - Suppression section "Configuration" (provider/model) - Simplification: seul le choix langue cible reste - Nettoyage code JS (loadConfig, saveConfig simplifiés) Interface plus simple et focalisée sur les fonctionnalités essentielles. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
5c03390aaf
commit
f05805e705
@ -311,37 +311,15 @@
|
||||
|
||||
<!-- Tabs -->
|
||||
<div class="tabs">
|
||||
<button class="tab active" data-tab="traduction">Traduction</button>
|
||||
<button class="tab active" data-tab="traduction">Français → Confluent</button>
|
||||
<button class="tab" data-tab="cf2fr">Confluent → Français</button>
|
||||
<button class="tab" data-tab="lexique">Lexique</button>
|
||||
</div>
|
||||
|
||||
<!-- Tab: Traduction -->
|
||||
<!-- Tab: Traduction Français → Confluent -->
|
||||
<div id="tab-traduction" class="tab-content active">
|
||||
<div class="panel">
|
||||
<h2>Configuration</h2>
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<label>Provider</label>
|
||||
<select id="provider">
|
||||
<option value="anthropic">Anthropic</option>
|
||||
<option value="openai">OpenAI</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Modèle</label>
|
||||
<select id="model">
|
||||
<option value="claude-sonnet-4-20250514">Claude Sonnet 4.5 (latest)</option>
|
||||
<option value="claude-haiku-4-20250514">Claude Haiku 4.5</option>
|
||||
<option value="chatgpt-4o-latest">ChatGPT-5.1 (latest)</option>
|
||||
<option value="gpt-4o">GPT-4o</option>
|
||||
<option value="gpt-4o-mini">GPT-4o Mini</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<h2>Traduction</h2>
|
||||
<h2>Traduction Français → Confluent</h2>
|
||||
<div class="form-group">
|
||||
<label>Langue cible</label>
|
||||
<select id="target">
|
||||
@ -411,6 +389,26 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tab: Confluent → Français -->
|
||||
<div id="tab-cf2fr" class="tab-content">
|
||||
<div class="panel">
|
||||
<h2>Traduction Confluent → Français</h2>
|
||||
<div class="form-group">
|
||||
<label>Texte en Confluent</label>
|
||||
<textarea id="cf-input" placeholder="Entrez votre texte en Confluent..."></textarea>
|
||||
</div>
|
||||
<button id="translate-cf2fr">Traduire</button>
|
||||
</div>
|
||||
|
||||
<!-- Résultat -->
|
||||
<div id="cf2fr-result-container" style="display: none;">
|
||||
<div class="layer layer1">
|
||||
<div class="layer1-title">Traduction brute</div>
|
||||
<div id="cf2fr-layer1-content" class="layer1-content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tab: Lexique -->
|
||||
<div id="tab-lexique" class="tab-content">
|
||||
<div class="panel">
|
||||
@ -542,41 +540,16 @@
|
||||
// Load/Save config
|
||||
const loadConfig = () => {
|
||||
const config = JSON.parse(localStorage.getItem('confluentConfig') || '{}');
|
||||
if (config.provider) document.getElementById('provider').value = config.provider;
|
||||
if (config.model) document.getElementById('model').value = config.model;
|
||||
if (config.target) document.getElementById('target').value = config.target;
|
||||
};
|
||||
|
||||
const saveConfig = () => {
|
||||
const config = {
|
||||
provider: document.getElementById('provider').value,
|
||||
model: document.getElementById('model').value,
|
||||
target: document.getElementById('target').value,
|
||||
};
|
||||
localStorage.setItem('confluentConfig', JSON.stringify(config));
|
||||
};
|
||||
|
||||
// Update model options
|
||||
document.getElementById('provider').addEventListener('change', (e) => {
|
||||
const modelSelect = document.getElementById('model');
|
||||
modelSelect.innerHTML = '';
|
||||
|
||||
if (e.target.value === 'anthropic') {
|
||||
modelSelect.innerHTML = `
|
||||
<option value="claude-sonnet-4-20250514">Claude Sonnet 4.5 (latest)</option>
|
||||
<option value="claude-haiku-4-20250514">Claude Haiku 4.5</option>
|
||||
`;
|
||||
} else if (e.target.value === 'openai') {
|
||||
modelSelect.innerHTML = `
|
||||
<option value="chatgpt-4o-latest">ChatGPT-5.1 (latest)</option>
|
||||
<option value="gpt-4o">GPT-4o</option>
|
||||
<option value="gpt-4o-mini">GPT-4o Mini</option>
|
||||
`;
|
||||
}
|
||||
saveConfig();
|
||||
});
|
||||
|
||||
document.getElementById('model').addEventListener('change', saveConfig);
|
||||
document.getElementById('target').addEventListener('change', saveConfig);
|
||||
|
||||
// Translation with 3 layers
|
||||
@ -600,8 +573,6 @@
|
||||
const config = {
|
||||
text,
|
||||
target: document.getElementById('target').value,
|
||||
provider: document.getElementById('provider').value,
|
||||
model: document.getElementById('model').value,
|
||||
};
|
||||
|
||||
try {
|
||||
@ -681,6 +652,45 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Confluent → Français translation
|
||||
document.getElementById('translate-cf2fr').addEventListener('click', async () => {
|
||||
const button = document.getElementById('translate-cf2fr');
|
||||
const text = document.getElementById('cf-input').value.trim();
|
||||
const resultContainer = document.getElementById('cf2fr-result-container');
|
||||
|
||||
if (!text) {
|
||||
alert('Veuillez entrer un texte en Confluent.');
|
||||
return;
|
||||
}
|
||||
|
||||
button.disabled = true;
|
||||
resultContainer.style.display = 'none';
|
||||
|
||||
// Show loading
|
||||
resultContainer.style.display = 'block';
|
||||
document.getElementById('cf2fr-layer1-content').textContent = 'Traduction en cours...';
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/translate/conf2fr', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ text }),
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (response.ok) {
|
||||
document.getElementById('cf2fr-layer1-content').textContent = data.translation || data.result || 'Traduction effectuée';
|
||||
} else {
|
||||
document.getElementById('cf2fr-layer1-content').innerHTML = `<span class="error">Erreur: ${data.error}</span>`;
|
||||
}
|
||||
} catch (error) {
|
||||
document.getElementById('cf2fr-layer1-content').innerHTML = `<span class="error">Erreur: ${error.message}</span>`;
|
||||
} finally {
|
||||
button.disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize
|
||||
loadConfig();
|
||||
loadLexique();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user