mirror of
https://github.com/csd4ni3l/debt-by-ai.git
synced 2026-01-01 12:33:44 +01:00
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:
@@ -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()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user