Remove Ki-Moderator add more backlist
This commit is contained in:
@@ -893,7 +893,14 @@ function getCategoryIcon(category) {
|
||||
offensive: '⚠️',
|
||||
titles: '👑',
|
||||
brands: '🏷️',
|
||||
inappropriate: '🚫'
|
||||
inappropriate: '🚫',
|
||||
racial: '🌍',
|
||||
religious: '⛪',
|
||||
disability: '♿',
|
||||
leetspeak: '🔤',
|
||||
cyberbullying: '💻',
|
||||
drugs: '💊',
|
||||
violence: '⚔️'
|
||||
};
|
||||
return icons[category] || '📝';
|
||||
}
|
||||
@@ -904,7 +911,14 @@ function getCategoryDisplayName(category) {
|
||||
offensive: 'Beleidigend/anstößig',
|
||||
titles: 'Titel/Berufsbezeichnung',
|
||||
brands: 'Markenname',
|
||||
inappropriate: 'Unpassend'
|
||||
inappropriate: 'Unpassend',
|
||||
racial: 'Rassistisch/ethnisch',
|
||||
religious: 'Religiös beleidigend',
|
||||
disability: 'Behinderungsbezogen',
|
||||
leetspeak: 'Verschleiert',
|
||||
cyberbullying: 'Cyberbullying',
|
||||
drugs: 'Drogenbezogen',
|
||||
violence: 'Gewalt/Bedrohung'
|
||||
};
|
||||
return names[category] || category;
|
||||
}
|
||||
@@ -1103,196 +1117,7 @@ function displayBlacklistStats(stats) {
|
||||
statsDiv.innerHTML = html;
|
||||
}
|
||||
|
||||
// LLM-Management
|
||||
function showLLMManagement() {
|
||||
document.getElementById('llmModal').style.display = 'block';
|
||||
loadLLMStatus();
|
||||
}
|
||||
|
||||
function closeLLMModal() {
|
||||
document.getElementById('llmModal').style.display = 'none';
|
||||
}
|
||||
|
||||
// LLM-Status laden
|
||||
async function loadLLMStatus() {
|
||||
try {
|
||||
const response = await fetch('/api/v1/admin/llm/status', {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('adminToken')}`
|
||||
}
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
const statusContent = document.getElementById('llmStatusContent');
|
||||
|
||||
if (result.success) {
|
||||
const status = result.data;
|
||||
if (status.connected) {
|
||||
statusContent.innerHTML = `
|
||||
<div style="background: #e8f5e8; color: #2e7d32; padding: 0.5rem; border-radius: 3px;">
|
||||
<strong>✅ KI-Moderator verbunden</strong><br>
|
||||
Modell: ${status.model}<br>
|
||||
URL: ${status.baseUrl}
|
||||
</div>
|
||||
`;
|
||||
} else {
|
||||
statusContent.innerHTML = `
|
||||
<div style="background: #ffebee; color: #c62828; padding: 0.5rem; border-radius: 3px;">
|
||||
<strong>❌ KI-Moderator nicht verfügbar</strong><br>
|
||||
Modell: ${status.model}<br>
|
||||
URL: ${status.baseUrl}<br>
|
||||
Fehler: ${status.error}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
} else {
|
||||
statusContent.innerHTML = `
|
||||
<div style="background: #ffebee; color: #c62828; padding: 0.5rem; border-radius: 3px;">
|
||||
<strong>❌ Fehler beim Laden des Status</strong><br>
|
||||
${result.message}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error loading LLM status:', error);
|
||||
document.getElementById('llmStatusContent').innerHTML = `
|
||||
<div style="background: #ffebee; color: #c62828; padding: 0.5rem; border-radius: 3px;">
|
||||
<strong>❌ Fehler beim Laden des Status</strong><br>
|
||||
${error.message}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
// Name mit LLM testen
|
||||
async function testNameWithLLM() {
|
||||
const firstname = document.getElementById('llmFirstname').value.trim();
|
||||
const lastname = document.getElementById('llmLastname').value.trim();
|
||||
const context = document.getElementById('llmContext').value.trim();
|
||||
|
||||
if (!firstname || !lastname) {
|
||||
showLLMMessage('Bitte gib Vorname und Nachname ein', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// LLM-Test
|
||||
const llmResponse = await fetch('/api/v1/admin/llm/test', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${localStorage.getItem('adminToken')}`
|
||||
},
|
||||
body: JSON.stringify({ firstname, lastname, context })
|
||||
});
|
||||
|
||||
const llmResult = await llmResponse.json();
|
||||
|
||||
// Blacklist-Test zum Vergleich
|
||||
const blacklistResponse = await fetch('/api/v1/admin/blacklist/test', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${localStorage.getItem('adminToken')}`
|
||||
},
|
||||
body: JSON.stringify({ firstname, lastname })
|
||||
});
|
||||
|
||||
const blacklistResult = await blacklistResponse.json();
|
||||
|
||||
// Ergebnisse anzeigen
|
||||
displayLLMResults(llmResult, blacklistResult);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error testing name with LLM:', error);
|
||||
showLLMMessage('Fehler beim Testen: ' + error.message, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
// LLM-Ergebnisse anzeigen
|
||||
function displayLLMResults(llmResult, blacklistResult) {
|
||||
const resultDiv = document.getElementById('llmResult');
|
||||
const resultContent = document.getElementById('llmResultContent');
|
||||
const comparisonDiv = document.getElementById('llmComparison');
|
||||
const comparisonContent = document.getElementById('llmComparisonContent');
|
||||
|
||||
if (llmResult.success) {
|
||||
const llm = llmResult.data;
|
||||
|
||||
let llmStatus = '';
|
||||
if (llm.isBlocked) {
|
||||
llmStatus = `
|
||||
<div style="background: #ffebee; color: #c62828; padding: 0.5rem; border-radius: 3px;">
|
||||
<strong>❌ Name blockiert</strong><br>
|
||||
Grund: ${llm.reason}<br>
|
||||
Konfidenz: ${Math.round(llm.confidence * 100)}%<br>
|
||||
LLM-Antwort: "${llm.llmResponse}"<br>
|
||||
Typ: ${llm.matchType}
|
||||
</div>
|
||||
`;
|
||||
} else {
|
||||
llmStatus = `
|
||||
<div style="background: #e8f5e8; color: #2e7d32; padding: 0.5rem; border-radius: 3px;">
|
||||
<strong>✅ Name erlaubt</strong><br>
|
||||
Grund: ${llm.reason}<br>
|
||||
Konfidenz: ${Math.round(llm.confidence * 100)}%<br>
|
||||
LLM-Antwort: "${llm.llmResponse}"<br>
|
||||
Typ: ${llm.matchType}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
resultContent.innerHTML = llmStatus;
|
||||
resultDiv.style.display = 'block';
|
||||
|
||||
// Vergleich mit Blacklist
|
||||
if (blacklistResult.success) {
|
||||
const blacklist = blacklistResult.data;
|
||||
let comparisonStatus = '';
|
||||
|
||||
if (blacklist.combined.isBlocked) {
|
||||
comparisonStatus = `
|
||||
<div style="background: #fff3e0; color: #f57c00; padding: 0.5rem; border-radius: 3px;">
|
||||
<strong>⚠️ Name blockiert (${blacklist.combined.source})</strong><br>
|
||||
Grund: ${blacklist.combined.reason}
|
||||
</div>
|
||||
`;
|
||||
} else {
|
||||
comparisonStatus = `
|
||||
<div style="background: #e8f5e8; color: #2e7d32; padding: 0.5rem; border-radius: 3px;">
|
||||
<strong>✅ Name erlaubt</strong><br>
|
||||
Sowohl KI als auch Blacklist erlauben den Namen
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
comparisonContent.innerHTML = comparisonStatus;
|
||||
comparisonDiv.style.display = 'block';
|
||||
}
|
||||
|
||||
} else {
|
||||
resultContent.innerHTML = `
|
||||
<div style="background: #ffebee; color: #c62828; padding: 0.5rem; border-radius: 3px;">
|
||||
<strong>❌ Fehler beim Testen</strong><br>
|
||||
${llmResult.message}
|
||||
</div>
|
||||
`;
|
||||
resultDiv.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
// LLM-Nachricht anzeigen
|
||||
function showLLMMessage(message, type) {
|
||||
const resultDiv = document.getElementById('llmResult');
|
||||
const resultContent = document.getElementById('llmResultContent');
|
||||
|
||||
const color = type === 'error' ? '#c62828' : '#2e7d32';
|
||||
const bgColor = type === 'error' ? '#ffebee' : '#e8f5e8';
|
||||
|
||||
resultContent.innerHTML = `
|
||||
<div style="background: ${bgColor}; color: ${color}; padding: 0.5rem; border-radius: 3px;">
|
||||
<strong>${type === 'error' ? '❌' : '✅'} ${message}</strong>
|
||||
</div>
|
||||
`;
|
||||
resultDiv.style.display = 'block';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user