From 84fab36a1fcb2e0ade38c4a4770591c6236ce8df Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 8 May 2024 14:04:46 +0800 Subject: refactor: split /data.json into /v1/models and /v1/roles (#494) --- assets/arena.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'assets/arena.html') diff --git a/assets/arena.html b/assets/arena.html index b20553d..138849d 100644 --- a/assets/arena.html +++ b/assets/arena.html @@ -482,8 +482,8 @@ const QUERY = parseQueryString(location.search); const NUM = parseInt(QUERY.num) || 2 const API_BASE = QUERY.api_base || "."; - const DATAJSON_API = API_BASE + "/data.json"; const CHAT_COMPLETIONS_URL = API_BASE + "/v1/chat/completions"; + const MODELS_API = API_BASE + "/v1/models"; const MODEL_IDS_STORAGE_KEY = "__model_ids__"; document.addEventListener("alpine:init", () => { @@ -512,7 +512,7 @@ async init() { try { - const { models } = await fetchDataJSON(DATAJSON_API); + const models = await fetchJSON(MODELS_API); this.models = models; } catch (err) { console.error(err); @@ -755,10 +755,10 @@ })); } - async function fetchDataJSON(url) { + async function fetchJSON(url) { const res = await fetch(url); const data = await res.json() - return data; + return data.data; } async function* fetchChatCompletions(url, body, signal) { -- cgit v1.2.3