refac: openai connections

This commit is contained in:
Timothy Jaeryang Baek
2024-11-11 21:18:51 -08:00
parent b82e25cac8
commit 0809eb79b8
13 changed files with 814 additions and 379 deletions
+8 -2
View File
@@ -32,7 +32,13 @@ export const getOllamaConfig = async (token: string = '') => {
return res;
};
export const updateOllamaConfig = async (token: string = '', enable_ollama_api: boolean) => {
type OllamaConfig = {
ENABLE_OLLAMA_API: boolean,
OLLAMA_BASE_URLS: string[],
OLLAMA_API_CONFIGS: object
}
export const updateOllamaConfig = async (token: string = '', config: OllamaConfig) => {
let error = null;
const res = await fetch(`${OLLAMA_API_BASE_URL}/config/update`, {
@@ -43,7 +49,7 @@ export const updateOllamaConfig = async (token: string = '', enable_ollama_api:
...(token && { authorization: `Bearer ${token}` })
},
body: JSON.stringify({
enable_ollama_api: enable_ollama_api
...config
})
})
.then(async (res) => {