feat: azure openai support

This commit is contained in:
Timothy Jaeryang Baek
2025-05-19 03:40:32 +04:00
parent 47f8b3500b
commit caeb822cdc
5 changed files with 174 additions and 111 deletions
+2 -7
View File
@@ -1,10 +1,6 @@
import { OLLAMA_API_BASE_URL } from '$lib/constants';
export const verifyOllamaConnection = async (
token: string = '',
url: string = '',
key: string = ''
) => {
export const verifyOllamaConnection = async (token: string = '', connection: dict = {}) => {
let error = null;
const res = await fetch(`${OLLAMA_API_BASE_URL}/verify`, {
@@ -15,8 +11,7 @@ export const verifyOllamaConnection = async (
'Content-Type': 'application/json'
},
body: JSON.stringify({
url,
key
...connection
})
})
.then(async (res) => {
+4 -3
View File
@@ -267,10 +267,10 @@ export const getOpenAIModels = async (token: string, urlIdx?: number) => {
export const verifyOpenAIConnection = async (
token: string = '',
url: string = 'https://api.openai.com/v1',
key: string = '',
connection: dict = {},
direct: boolean = false
) => {
const { url, key, config } = connection;
if (!url) {
throw 'OpenAI: URL is required';
}
@@ -309,7 +309,8 @@ export const verifyOpenAIConnection = async (
},
body: JSON.stringify({
url,
key
key,
config
})
})
.then(async (res) => {