diff --git a/assets/js/Containers/FrevaGPT/index.js b/assets/js/Containers/FrevaGPT/index.js index 8421a977..7867ed89 100644 --- a/assets/js/Containers/FrevaGPT/index.js +++ b/assets/js/Containers/FrevaGPT/index.js @@ -91,11 +91,8 @@ class FrevaGPT extends React.Component { }; const getBotModels = async () => { - const queryObject = { - auth_key: process.env.BOT_AUTH_KEY, - }; const response = await fetch( - `/api/chatbot/availablechatbots?` + objectToQueryString(queryObject) + `/api/chatbot/availablechatbots?` ); this.setState({ botModelList: await response.json() }); }; @@ -161,10 +158,8 @@ class FrevaGPT extends React.Component { async fetchData(input) { const queryObject = { input, - auth_key: process.env.BOT_AUTH_KEY, thread_id: this.props.frevaGPT.thread, chatbot: this.state.botModel, - freva_config: "/work/ch1187/clint/freva-dev/freva/evaluation_system.conf", }; // response of a new bot request is streamed @@ -280,7 +275,6 @@ class FrevaGPT extends React.Component { const response = await fetch( `/api/chatbot/getthread?` + new URLSearchParams({ - auth_key: process.env.BOT_AUTH_KEY, thread_id: thread, }).toString() ); @@ -295,7 +289,6 @@ class FrevaGPT extends React.Component { await fetch( `/api/chatbot/stop?` + new URLSearchParams({ - auth_key: process.env.BOT_AUTH_KEY, thread_id: this.props.frevaGPT.thread, }).toString() ); diff --git a/bot/proxyviews.py b/bot/proxyviews.py index ebb5d065..393c75eb 100644 --- a/bot/proxyviews.py +++ b/bot/proxyviews.py @@ -12,6 +12,10 @@ def get(self, request, *args, **kwargs): base_url = urljoin(settings.CHAT_BOT_URL, path) params = request.GET.dict() + # adding bot auth key and freva conf + params["auth_key"] = settings.CHAT_BOT_AUTH_KEY + params["freva_config"] = settings.CHAT_BOT_FREVA_CONFIG + try: upstream_response = requests.get(base_url[:-1], params=params, stream=True) upstream_response.raise_for_status() diff --git a/django_evaluation/settings/local.py b/django_evaluation/settings/local.py index d744d55e..9724abd0 100755 --- a/django_evaluation/settings/local.py +++ b/django_evaluation/settings/local.py @@ -298,7 +298,10 @@ def _set_favicon(html_color: str, project_root: Path) -> None: "variable", ] MENU_ENTRIES = [] + CHAT_BOT_URL = "http://vader5-icpub.lvt.dkrz.de:8502" +CHAT_BOT_AUTH_KEY = os.environ.get("CHAT_BOT_AUTH_KEY") +CHAT_BOT_FREVA_CONFIG = os.environ.get("CHAT_BOT_AUTH_KEY") if os.getenv("CHAT_BOT", "0").isdigit(): ACTIVATE_CHAT_BOT = bool(int(os.getenv("CHAT_BOT", "0")))