Make the scenarios connected to the user in the database and also make win counts and other data work, fix achievements logic, fix slight typos and bugs, merge the scenario and answer routes, adjust prompts for better user experience

This commit is contained in:
csd4ni3l
2025-10-04 11:46:37 +02:00
parent 2e3f18bcbb
commit 8e1a7f4f49
4 changed files with 133 additions and 97 deletions

View File

@@ -90,7 +90,7 @@
}
async function generate_offensive_scenario() {
const response = await fetch("/offensive_scenario");
const response = await fetch("/generate_scenario?scenario_type=offensive");
const data = await response.json();
document.getElementById("scenario-label").innerHTML = `<strong>Scenario:</strong> ${DOMPurify.sanitize(data["scenario"])}`;
@@ -111,10 +111,11 @@
messageInput.value = "";
try {
const response = await fetch("/offensive_answer", {
const response = await fetch("/ai_answer", {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"scenario_type": "offensive",
"user_input": value,
"scenario": document.getElementById('scenario-label').textContent.replace('Scenario: ', '').replace('Scenario:', '').trim()
})