feat: azure openai support
This commit is contained in:
@@ -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) => {
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user