diff --git a/frontend/src/components/stages/chip_participant_view.ts b/frontend/src/components/stages/chip_participant_view.ts index ece53b22f..d5737ee8c 100644 --- a/frontend/src/components/stages/chip_participant_view.ts +++ b/frontend/src/components/stages/chip_participant_view.ts @@ -1227,4 +1227,4 @@ declare global { 'chip-participant-view': ChipView; 'chip-offer-form': ChipOfferForm; } -} \ No newline at end of file +} diff --git a/functions/src/api/gemini.api.test.ts b/functions/src/api/gemini.api.test.ts index 6cc6f2bd8..e376e95bb 100644 --- a/functions/src/api/gemini.api.test.ts +++ b/functions/src/api/gemini.api.test.ts @@ -166,7 +166,7 @@ describe('Gemini API', () => { topP: 0.9, frequencyPenalty: 0, presencePenalty: 0, - customRequestBodyFields: [{ name: 'seed', value: 123 }], + customRequestBodyFields: [{name: 'seed', value: 123}], }; const response: ModelResponse = await getGeminiAPIResponse( @@ -176,7 +176,9 @@ describe('Gemini API', () => { generationConfig, ); - expect(response.status).toBe(ModelResponseStatus.PROVIDER_UNAVAILABLE_ERROR); + expect(response.status).toBe( + ModelResponseStatus.PROVIDER_UNAVAILABLE_ERROR, + ); expect(response.errorMessage).toContain('Service Unavailable'); }); }); diff --git a/functions/src/api/gemini.api.ts b/functions/src/api/gemini.api.ts index efd004cfa..a08e944f4 100644 --- a/functions/src/api/gemini.api.ts +++ b/functions/src/api/gemini.api.ts @@ -129,8 +129,6 @@ export async function callGemini( }, }); - console.log(`DEBUG: ${JSON.stringify(response)}`); - if (response.promptFeedback) { return { status: ModelResponseStatus.REFUSAL_ERROR, @@ -261,4 +259,4 @@ export async function getGeminiAPIResponse( errorMessage: error.message, }; } -} \ No newline at end of file +} diff --git a/functions/src/stages/chip.endpoints.ts b/functions/src/stages/chip.endpoints.ts index 3bf5ae443..f6eeed931 100644 --- a/functions/src/stages/chip.endpoints.ts +++ b/functions/src/stages/chip.endpoints.ts @@ -312,7 +312,8 @@ export const requestChipAssistance = onCall(async (request) => { // Check if participant can accept the offer (for coach mode) const canAcceptOffer = () => { const buyChip = Object.keys(currentOffer.buy)[0]; - const participantChipMap = publicData.participantChipMap[participant.publicId] ?? {}; + const participantChipMap = + publicData.participantChipMap[participant.publicId] ?? {}; const availableSell = participantChipMap[buyChip] ?? 0; return availableSell >= currentOffer.buy[buyChip]; }; @@ -323,8 +324,9 @@ export const requestChipAssistance = onCall(async (request) => { response = { success: false, modelResponse: {}, - defaultMessage: "You do not have enough chips to accept this offer. So you need to reject.", - defaultReasoning: "Insufficient chips to accept the offer" + defaultMessage: + 'You do not have enough chips to accept this offer. So you need to reject.', + defaultReasoning: 'Insufficient chips to accept the offer', }; } else { response = await getChipResponseAssistance( @@ -537,7 +539,8 @@ export const selectChipAssistanceMode = onCall(async (request) => { // Check if participant can accept the offer const canAcceptOffer = () => { const buyChip = Object.keys(currentOffer.buy)[0]; - const participantChipMap = publicData.participantChipMap[participant.publicId] ?? {}; + const participantChipMap = + publicData.participantChipMap[participant.publicId] ?? {}; const availableSell = participantChipMap[buyChip] ?? 0; return availableSell >= currentOffer.buy[buyChip]; }; @@ -545,15 +548,16 @@ export const selectChipAssistanceMode = onCall(async (request) => { // If participant cannot accept the offer, set default response without calling LLM if (!canAcceptOffer()) { currentAssistance.proposedResponse = false; // auto-reject - currentAssistance.message = "You do not have enough chips to accept this offer. So you need to reject."; - currentAssistance.reasoning = "Insufficient chips to accept the offer"; + currentAssistance.message = + 'You do not have enough chips to accept this offer. So you need to reject.'; + currentAssistance.reasoning = 'Insufficient chips to accept the offer'; currentAssistance.proposedTime = Timestamp.now(); - + // If delegate mode, mark as completed and actually send the reject response if (data.assistanceMode === ChipAssistanceMode.DELEGATE) { currentAssistance.endTime = Timestamp.now(); currentAssistance.finalResponse = false; - + // Actually send the reject response to the game await addChipResponseToPublicData( data.experimentId, @@ -569,7 +573,10 @@ export const selectChipAssistanceMode = onCall(async (request) => { data.experimentId, stage, publicData, - await getFirestoreCohortParticipants(data.experimentId, data.cohortId), + await getFirestoreCohortParticipants( + data.experimentId, + data.cohortId, + ), participant, participantAnswer, await getExperimenterDataFromExperiment(data.experimentId), @@ -579,9 +586,11 @@ export const selectChipAssistanceMode = onCall(async (request) => { ); // If response is valid, add to current assistance if (response.success) { - currentAssistance.proposedResponse = response.modelResponse['response']; + currentAssistance.proposedResponse = + response.modelResponse['response']; currentAssistance.message = response.modelResponse['feedback'] ?? ''; - currentAssistance.reasoning = response.modelResponse['reasoning'] ?? ''; + currentAssistance.reasoning = + response.modelResponse['reasoning'] ?? ''; currentAssistance.modelResponse = response.modelResponse; } else { // Set error mode if response failed diff --git a/functions/src/stages/chip.utils.ts b/functions/src/stages/chip.utils.ts index d29d65bbc..25bca807e 100644 --- a/functions/src/stages/chip.utils.ts +++ b/functions/src/stages/chip.utils.ts @@ -595,7 +595,7 @@ export async function getChipOfferAssistance( ); } if (responseObj) { - console.log( responseObj); + console.log(responseObj); console.log( `Suggested: Give ${responseObj['suggestedSellQuantity']} ${responseObj['suggestedSellType']} to get ${responseObj['suggestedBuyQuantity']} ${responseObj['suggestedBuyType']} (${responseObj['reasoning']})`, );