feat: moderation

This commit is contained in:
Face 2025-05-30 14:35:15 +03:00
parent db9c133bbb
commit 2def8d7a00
6 changed files with 61 additions and 4 deletions

View file

@ -0,0 +1,22 @@
export async function isNameAppropriate(name: string): Promise<boolean> {
try {
const response = await fetch('http://localhost:9999', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ name }),
});
if (!response.ok) {
console.error('Moderation service error:', response.status, response.statusText);
return true;
}
const result = await response.json();
return result.appropriate !== false;
} catch (error) {
console.error('Failed to check name with moderation service:', error);
return true;
}
}