From 0440a810f56337e8398eeb58dd294a5af44ca696 Mon Sep 17 00:00:00 2001 From: ItzCrazyKns Date: Sat, 4 May 2024 15:01:53 +0530 Subject: [PATCH] feat(http-headers): add `Content-Type` --- ui/components/ChatWindow.tsx | 5 +++++ ui/components/SettingsDialog.tsx | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/components/ChatWindow.tsx b/ui/components/ChatWindow.tsx index ca08dfa..79f93a8 100644 --- a/ui/components/ChatWindow.tsx +++ b/ui/components/ChatWindow.tsx @@ -36,6 +36,11 @@ const useSocket = (url: string) => { ) { const providers = await fetch( `${process.env.NEXT_PUBLIC_API_URL}/models`, + { + headers: { + 'Content-Type': 'application/json', + }, + }, ).then(async (res) => await res.json()); const chatModelProviders = providers.chatModelProviders; diff --git a/ui/components/SettingsDialog.tsx b/ui/components/SettingsDialog.tsx index 41c10cf..f77a95c 100644 --- a/ui/components/SettingsDialog.tsx +++ b/ui/components/SettingsDialog.tsx @@ -46,7 +46,11 @@ const SettingsDialog = ({ if (isOpen) { const fetchConfig = async () => { setIsLoading(true); - const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/config`); + const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/config`, { + headers: { + 'Content-Type': 'application/json', + }, + }); const data = await res.json(); setConfig(data); setIsLoading(false); @@ -251,7 +255,7 @@ const SettingsDialog = ({ )} {/* Embedding models */} - {config.chatModelProviders && ( + {config.embeddingModelProviders && (

Embedding model Provider