new API calls updated

This commit is contained in:
mic 2025-09-09 22:16:12 +02:00
parent fc2d7aa830
commit 9fb1083495

View file

@ -578,7 +578,9 @@ export async function injectConnectionUI({
document.getElementById('btnUpdateChatGPTModels').addEventListener('click', async () => {
document.getElementById('chatgpt_model_fetch_loading').style.display = 'inline';
let openai = new OpenAI(document.getElementById("chatgpt_api_key").value, '', true);
let openai = new OpenAI({
apiKey: document.getElementById("chatgpt_api_key").value,
});
openai.fetchModels().then((data) => {
if(!data.ok){
let errorDetail;
@ -618,7 +620,9 @@ export async function injectConnectionUI({
document.getElementById('btnUpdateGoogleGeminiModels').addEventListener('click', async () => {
document.getElementById('google_gemini_model_fetch_loading').style.display = 'inline';
let google_gemini = new GoogleGemini(document.getElementById("google_gemini_api_key").value, '', true);
let google_gemini = new GoogleGemini({
apiKey: document.getElementById("google_gemini_api_key").value,
});
google_gemini.fetchModels().then((data) => {
if(!data.ok){
let errorDetail;
@ -658,7 +662,9 @@ export async function injectConnectionUI({
document.getElementById('btnUpdateOllamaModels').addEventListener('click', async () => {
document.getElementById('ollama_model_fetch_loading').style.display = 'inline';
let ollama = new Ollama(document.getElementById("ollama_host").value, true);
let ollama = new Ollama({
host: document.getElementById("ollama_host").value,
});
try {
let data = await ollama.fetchModels();
if(!data){
@ -715,7 +721,11 @@ export async function injectConnectionUI({
document.getElementById('btnUpdateOpenAICompModels').addEventListener('click', async () => {
document.getElementById('openai_comp_model_fetch_loading').style.display = 'inline';
let openai_comp = new OpenAIComp(document.getElementById("openai_comp_host").value , null, document.getElementById("openai_comp_api_key").value, true, document.getElementById("openai_comp_use_v1").checked);
let openai_comp = new OpenAIComp({
host: document.getElementById("openai_comp_host").value,
apiKey: document.getElementById("openai_comp_api_key").value,
use_v1: document.getElementById("openai_comp_use_v1").checked,
});
openai_comp.fetchModels().then((data) => {
if(!data.ok){
let errorDetail;
@ -756,7 +766,10 @@ export async function injectConnectionUI({
document.getElementById('btnUpdateAnthropicModels').addEventListener('click', async () => {
document.getElementById('anthropic_model_fetch_loading').style.display = 'inline';
let anthropic = new Anthropic(document.getElementById("anthropic_api_key").value, document.getElementById("anthropic_version").value, '');
let anthropic = new Anthropic({
apiKey: document.getElementById("anthropic_api_key").value,
version: document.getElementById("anthropic_version").value,
});
anthropic.fetchModels().then((data) => {
if(!data.ok){
let errorDetail;
@ -1100,4 +1113,4 @@ function loadOpenAICompConfigs(){
option.text = config.name;
select_openai_comp_model.appendChild(option);
});
}
}