Spaces:
Running
Running
Tobkubos commited on
Commit ·
cbb6dd7
1
Parent(s): d95e4bb
- backend/guild_configs.json +2 -2
- index.js +4 -14
backend/guild_configs.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
{
|
| 2 |
"1515307986963267595": {
|
| 3 |
-
"active_text_model": "
|
| 4 |
"active_image_model": "Hemg/Deepfake-image",
|
| 5 |
"log_channel_id": "1515373138937123007",
|
| 6 |
-
"multi_model_workflow":
|
| 7 |
},
|
| 8 |
"eval_test_guild": {
|
| 9 |
"active_text_model": "none",
|
|
|
|
| 1 |
{
|
| 2 |
"1515307986963267595": {
|
| 3 |
+
"active_text_model": "almanach/xlmr-chatgptdetect-noisy",
|
| 4 |
"active_image_model": "Hemg/Deepfake-image",
|
| 5 |
"log_channel_id": "1515373138937123007",
|
| 6 |
+
"multi_model_workflow": false
|
| 7 |
},
|
| 8 |
"eval_test_guild": {
|
| 9 |
"active_text_model": "none",
|
index.js
CHANGED
|
@@ -55,7 +55,7 @@ client.once(Events.ClientReady, async () => {
|
|
| 55 |
type: ApplicationCommandType.Message,
|
| 56 |
},
|
| 57 |
{
|
| 58 |
-
name: "Weryfikacja faktów",
|
| 59 |
type: ApplicationCommandType.Message,
|
| 60 |
},
|
| 61 |
]);
|
|
@@ -172,7 +172,6 @@ function getProgressBar(confidence, isDeepfake) {
|
|
| 172 |
return blockEmoji.repeat(filledBlocks) + "⬛".repeat(emptyBlocks);
|
| 173 |
}
|
| 174 |
|
| 175 |
-
// CAŁKOWICIE DYNAMICZNY GENERATOR WIDOKU SETUPU
|
| 176 |
function generateSetupView(tempConfig, availableModels) {
|
| 177 |
const embed = new EmbedBuilder()
|
| 178 |
.setColor(0x5865f2)
|
|
@@ -225,7 +224,6 @@ function generateSetupView(tempConfig, availableModels) {
|
|
| 225 |
.setCustomId(`setup_model_${contentType}`)
|
| 226 |
.setPlaceholder(`Wybierz model dla ${contentType}`)
|
| 227 |
.addOptions(selectOptions)
|
| 228 |
-
// WYszarzenie i zablokowanie wyboru, gdy włączony jest Multi-Model Workflow
|
| 229 |
.setDisabled(tempConfig.multiModelWorkflow);
|
| 230 |
|
| 231 |
components.push(new ActionRowBuilder().addComponents(modelSelect));
|
|
@@ -295,14 +293,14 @@ async function handleFactCheck(interaction, statement) {
|
|
| 295 |
|
| 296 |
const data = await response.json();
|
| 297 |
|
| 298 |
-
let embedColor = 0xFFAA00;
|
| 299 |
let verdictEmoji = "⚖️";
|
| 300 |
|
| 301 |
if (data.verdict === "PRAWDA") {
|
| 302 |
-
embedColor = 0x00FF00;
|
| 303 |
verdictEmoji = "✅";
|
| 304 |
} else if (data.verdict === "FAŁSZ") {
|
| 305 |
-
embedColor = 0xFF0000;
|
| 306 |
verdictEmoji = "❌";
|
| 307 |
}
|
| 308 |
|
|
@@ -422,7 +420,6 @@ async function handleAnalysis(
|
|
| 422 |
});
|
| 423 |
|
| 424 |
if (data.details && data.details.length > 0) {
|
| 425 |
-
// Widok dla Multi-Modelu: ładnie listujemy każdy model
|
| 426 |
embed.addFields({ name: "📊 Średnia pewność systemu", value: `\`${confidencePercent}%\``, inline: false });
|
| 427 |
|
| 428 |
for (const detail of data.details) {
|
|
@@ -437,7 +434,6 @@ async function handleAnalysis(
|
|
| 437 |
});
|
| 438 |
}
|
| 439 |
} else {
|
| 440 |
-
// Standardowy widok dla pojedynczego modelu (progressBar jest bezpiecznie zdefiniowany tutaj)
|
| 441 |
const progressBar = getProgressBar(data.confidence, data.is_deepfake);
|
| 442 |
embed.addFields(
|
| 443 |
{ name: "Pewność modelu", value: `\`${confidencePercent}%\` \n${progressBar}` },
|
|
@@ -445,7 +441,6 @@ async function handleAnalysis(
|
|
| 445 |
);
|
| 446 |
}
|
| 447 |
|
| 448 |
-
// 3. Dodatkowe pola wspólne (dodawane tylko raz na samym końcu)
|
| 449 |
embed.addFields(
|
| 450 |
{ name: "Czas przetwarzania", value: `\`${data.analysis_time.toFixed(3)}s\``, inline: true },
|
| 451 |
{ name: "Format danych", value: `\`${data.content_type.toUpperCase()}\``, inline: true }
|
|
@@ -476,7 +471,6 @@ async function handleAnalysis(
|
|
| 476 |
}
|
| 477 |
}
|
| 478 |
|
| 479 |
-
//funkcja kupczaka
|
| 480 |
|
| 481 |
client.on(Events.InteractionCreate, async (interaction) => {
|
| 482 |
if (interaction.isChatInputCommand()) {
|
|
@@ -503,7 +497,6 @@ client.on(Events.InteractionCreate, async (interaction) => {
|
|
| 503 |
|
| 504 |
await interaction.deferReply({ flags: [MessageFlags.Ephemeral] });
|
| 505 |
|
| 506 |
-
// Pobieramy konfigurację bezpośrednio z FastAPI
|
| 507 |
const currentConfig = await fetchGuildConfig(guildId);
|
| 508 |
const availableModels = await fetchAvailableModels();
|
| 509 |
|
|
@@ -547,13 +540,11 @@ client.on(Events.InteractionCreate, async (interaction) => {
|
|
| 547 |
}
|
| 548 |
}
|
| 549 |
|
| 550 |
-
// OBSŁUGA DYNAMICZNYCH MENU ROZWIJANYCH DLA MODELI
|
| 551 |
if (interaction.isStringSelectMenu()) {
|
| 552 |
const guildId = interaction.guildId;
|
| 553 |
const tempSession = activeSetupSessions.get(guildId);
|
| 554 |
|
| 555 |
if (tempSession) {
|
| 556 |
-
// Sprawdzamy czy zmieniany jest model (szukamy przedrostka setup_model_)
|
| 557 |
if (interaction.customId.startsWith("setup_model_")) {
|
| 558 |
const contentType = interaction.customId.replace("setup_model_", "");
|
| 559 |
tempSession.config.models[contentType] = interaction.values[0];
|
|
@@ -608,7 +599,6 @@ client.on(Events.InteractionCreate, async (interaction) => {
|
|
| 608 |
await handleFactCheck(interaction, contentToVerify);
|
| 609 |
}
|
| 610 |
}
|
| 611 |
-
//koniec funkcji kupczaka
|
| 612 |
|
| 613 |
if (interaction.isModalSubmit()) {
|
| 614 |
if (interaction.customId === "detectModal") {
|
|
|
|
| 55 |
type: ApplicationCommandType.Message,
|
| 56 |
},
|
| 57 |
{
|
| 58 |
+
name: "Weryfikacja faktów",
|
| 59 |
type: ApplicationCommandType.Message,
|
| 60 |
},
|
| 61 |
]);
|
|
|
|
| 172 |
return blockEmoji.repeat(filledBlocks) + "⬛".repeat(emptyBlocks);
|
| 173 |
}
|
| 174 |
|
|
|
|
| 175 |
function generateSetupView(tempConfig, availableModels) {
|
| 176 |
const embed = new EmbedBuilder()
|
| 177 |
.setColor(0x5865f2)
|
|
|
|
| 224 |
.setCustomId(`setup_model_${contentType}`)
|
| 225 |
.setPlaceholder(`Wybierz model dla ${contentType}`)
|
| 226 |
.addOptions(selectOptions)
|
|
|
|
| 227 |
.setDisabled(tempConfig.multiModelWorkflow);
|
| 228 |
|
| 229 |
components.push(new ActionRowBuilder().addComponents(modelSelect));
|
|
|
|
| 293 |
|
| 294 |
const data = await response.json();
|
| 295 |
|
| 296 |
+
let embedColor = 0xFFAA00;
|
| 297 |
let verdictEmoji = "⚖️";
|
| 298 |
|
| 299 |
if (data.verdict === "PRAWDA") {
|
| 300 |
+
embedColor = 0x00FF00;
|
| 301 |
verdictEmoji = "✅";
|
| 302 |
} else if (data.verdict === "FAŁSZ") {
|
| 303 |
+
embedColor = 0xFF0000;
|
| 304 |
verdictEmoji = "❌";
|
| 305 |
}
|
| 306 |
|
|
|
|
| 420 |
});
|
| 421 |
|
| 422 |
if (data.details && data.details.length > 0) {
|
|
|
|
| 423 |
embed.addFields({ name: "📊 Średnia pewność systemu", value: `\`${confidencePercent}%\``, inline: false });
|
| 424 |
|
| 425 |
for (const detail of data.details) {
|
|
|
|
| 434 |
});
|
| 435 |
}
|
| 436 |
} else {
|
|
|
|
| 437 |
const progressBar = getProgressBar(data.confidence, data.is_deepfake);
|
| 438 |
embed.addFields(
|
| 439 |
{ name: "Pewność modelu", value: `\`${confidencePercent}%\` \n${progressBar}` },
|
|
|
|
| 441 |
);
|
| 442 |
}
|
| 443 |
|
|
|
|
| 444 |
embed.addFields(
|
| 445 |
{ name: "Czas przetwarzania", value: `\`${data.analysis_time.toFixed(3)}s\``, inline: true },
|
| 446 |
{ name: "Format danych", value: `\`${data.content_type.toUpperCase()}\``, inline: true }
|
|
|
|
| 471 |
}
|
| 472 |
}
|
| 473 |
|
|
|
|
| 474 |
|
| 475 |
client.on(Events.InteractionCreate, async (interaction) => {
|
| 476 |
if (interaction.isChatInputCommand()) {
|
|
|
|
| 497 |
|
| 498 |
await interaction.deferReply({ flags: [MessageFlags.Ephemeral] });
|
| 499 |
|
|
|
|
| 500 |
const currentConfig = await fetchGuildConfig(guildId);
|
| 501 |
const availableModels = await fetchAvailableModels();
|
| 502 |
|
|
|
|
| 540 |
}
|
| 541 |
}
|
| 542 |
|
|
|
|
| 543 |
if (interaction.isStringSelectMenu()) {
|
| 544 |
const guildId = interaction.guildId;
|
| 545 |
const tempSession = activeSetupSessions.get(guildId);
|
| 546 |
|
| 547 |
if (tempSession) {
|
|
|
|
| 548 |
if (interaction.customId.startsWith("setup_model_")) {
|
| 549 |
const contentType = interaction.customId.replace("setup_model_", "");
|
| 550 |
tempSession.config.models[contentType] = interaction.values[0];
|
|
|
|
| 599 |
await handleFactCheck(interaction, contentToVerify);
|
| 600 |
}
|
| 601 |
}
|
|
|
|
| 602 |
|
| 603 |
if (interaction.isModalSubmit()) {
|
| 604 |
if (interaction.customId === "detectModal") {
|