From 2efe175d6228d3e5bb71e73d04413e6b22248e39 Mon Sep 17 00:00:00 2001 From: lakhoune Date: Mon, 4 Mar 2024 11:53:18 +0100 Subject: [PATCH] try fix for de facto model using get --- src/statistics/bot-statistics.js | 40 +++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/src/statistics/bot-statistics.js b/src/statistics/bot-statistics.js index f89a95e..effc453 100644 --- a/src/statistics/bot-statistics.js +++ b/src/statistics/bot-statistics.js @@ -457,19 +457,33 @@ class BotStats extends LitElement { } try { - const response = await fetch(url, { - method: "POST", - timeout: 10000, - headers: { - "Access-Control-Allow-Origin": "*", - Accept: "text/html", - "Content-type": "application/json", - }, - - body: JSON.stringify({ - "bot-model": botModel, - }), - }); + let response; + if (modelType === "de-facto") { + // for some weird reason the POST request fails in the cluster :/ + response = await fetch(url, { + method: "GET", + timeout: 10000, + headers: { + "Access-Control-Allow-Origin": "*", + Accept: "text/html", + "Content-type": "application/json", + }, + }); + } else { + response = await fetch(url, { + method: "POST", + timeout: 10000, + headers: { + "Access-Control-Allow-Origin": "*", + Accept: "text/html", + "Content-type": "application/json", + }, + + body: JSON.stringify({ + "bot-model": botModel, + }), + }); + } if (!response.ok) { try {