Updated for Experiment 2

This commit is contained in:
Shaheed Azaad
2025-07-02 21:53:49 +02:00
parent 7b525ff8fb
commit 55f927b564
2 changed files with 33 additions and 68 deletions

View File

@@ -18,9 +18,9 @@ const experiment_name = import.meta.env.VITE_EXPERIMENT_NAME;
let prolific_id;
let probe_condition; // will be set to ai or human based on the condition.
let probe_condition; // will be set to neutral or reveal based on the condition
let debug = false;
let probe_order; // will be set to ai_first or human_first based on the condition
const short_version = true; // just using the short version of the task
@@ -50,55 +50,30 @@ prolific_id = jsPsych.data.getURLVariable('PROLIFIC_PID');
const COND = Number(jsPsych.data.getURLVariable('C'));
const probe_preamble = 'In this experiment, we told you that you were playing a game with a partner. However, due to the difficulty of implementing multi-participant online studies, your partner was actually ';
const probe_closing_text = 'We would like to know what you thought about your partner. Please share your thoughts by indicating your agreement with the following statements.';
const probe_preamble = 'In this experiment, you worked together with a partner. ';
const probe_closing_text = 'Please share any suspicions you had about your partner during the experiment by indicating your agreement with the following statements.';
const probe_text_ai = probe_preamble + 'an AI agent trained to behave like a human participant. ' + probe_closing_text;
const probe_text_human = probe_preamble + 'an experimenter pretending to be a participant. ' + probe_closing_text;
const probe_text_neutral = probe_preamble + probe_closing_text;
const probe_text_reveal = probe_preamble + 'However, due to the difficulty of implementing multi-participant online studies, your partner was actually an AI agent trained to behave like a human participant. ' + probe_closing_text;
let together_colour;
let probe_text;
switch (COND) {
case 0:
probe_condition = 'ai';
probe_condition = 'neutral';
together_colour = 'blue';
probe_order = 'ai_first';
break;
case 1:
probe_condition = 'ai';
probe_condition = 'neutral';
together_colour = 'red';
probe_order = 'ai_first';
break;
case 2:
probe_condition = 'experimenter';
probe_condition = 'reveal';
together_colour = 'blue';
probe_order = 'ai_first';
break;
case 3:
probe_condition = 'experimenter';
probe_condition = 'reveal';
together_colour = 'red';
probe_order = 'ai_first';
break;
case 4:
probe_condition = 'ai';
together_colour = 'blue';
probe_order = 'human_first';
break;
case 5:
probe_condition = 'ai';
together_colour = 'red';
probe_order = 'human_first';
break;
case 6:
probe_condition = 'experimenter';
together_colour = 'blue';
probe_order = 'human_first';
break;
case 7:
probe_condition = 'experimenter';
together_colour = 'red';
probe_order = 'human_first';
break;
}
@@ -110,7 +85,6 @@ const props = {
together_colour: together_colour,
prolific_id: prolific_id,
experiment_name: experiment_name,
probe_order: probe_order,
cond: COND,
}
@@ -228,38 +202,27 @@ const pre_survey_info = {
stimulus: stimulusMap.get('pre_survey_info'),
};
const ai_probe_row = {
text: 'I believed that my partner was an AI agent or a bot.',
value: 'SuspicionAI',
}
const exprimenter_probe_row = {
text: 'I believed that my partner was an experimenter pretending to be a participant.',
value: 'SuspicionExperimenter',
}
const survey_function = (survey) => {
survey.onAfterRenderPage.add(function (sender, options) {
console.log('Survey page rendered:', sender.currentPage);
if (survey.activePage.name === 'page1') {
const nextButton = document.querySelector('#sv-nav-next > div > input');
if (nextButton) {
let seconds = 20;
const originalText = nextButton.value.replace(/\s*\(\d+\)$/, '') || 'Continue';
nextButton.disabled = true;
nextButton.value = `${originalText} (${seconds})`;
const interval = setInterval(() => {
seconds--;
const nextButton = document.querySelector('#sv-nav-next > div > input');
if (nextButton) {
let seconds = 15;
const originalText = nextButton.value.replace(/\s*\(\d+\)$/, '') || 'Continue';
nextButton.disabled = true;
nextButton.value = `${originalText} (${seconds})`;
if (seconds <= 0) {
clearInterval(interval);
nextButton.disabled = false;
nextButton.value = originalText;
}
}, 1000);
const interval = setInterval(() => {
seconds--;
nextButton.value = `${originalText} (${seconds})`;
if (seconds <= 0) {
clearInterval(interval);
nextButton.disabled = false;
nextButton.value = originalText;
}
}, 1000);
}
}
}
});
}
@@ -279,20 +242,22 @@ const survey = {
elements: [
{
type: 'matrix',
name: probe_condition === 'ai' ? probe_text_ai : probe_text_human,
name: probe_condition === 'neutral' ? probe_text_neutral : probe_text_reveal,
alternateRows: true,
isAllRowRequired: debug ? false : true,
rows: [
{
text: 'I believed that my partner was another participant.',
value: 'ConfidencePartner',
text: 'I believed that my partner was actually an AI agent or a bot.',
value: 'SuspicionPartner',
},
probe_order === 'ai_first' ? ai_probe_row : exprimenter_probe_row,
{
text: `There's no question here. Select 'Disagree' to show that you're paying attention.`,
value: 'AttentionCheck',
},
probe_order === 'ai_first' ? exprimenter_probe_row : ai_probe_row,
{
text: 'I believed that my partner was another, human, participant.',
value: 'ConfidencePartner',
},
],
columns: [
{