:boom: [Fix] Only fetch /models for http(s) endpoint
Browse files
networks/endpoint_storage.js
CHANGED
@@ -3,7 +3,7 @@ import {
|
|
3 |
AvailableModelsRequester,
|
4 |
} from "../networks/llm_requester.js";
|
5 |
|
6 |
-
class EndpointStorageItem {}
|
7 |
|
8 |
class EndpointStorage {
|
9 |
constructor() {
|
@@ -126,13 +126,19 @@ class EndpointStorage {
|
|
126 |
self.db.endpoints.delete(endpoint_input_value);
|
127 |
}
|
128 |
console.log(`remove endpoint: ${endpoint_input_value}`);
|
|
|
|
|
129 |
});
|
130 |
}
|
131 |
async fill_available_models_select(endpoint) {
|
132 |
var select = $("#available-models-select");
|
133 |
console.log("fetch available models for endpoint:", endpoint);
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
136 |
available_models[endpoint].forEach((value, index) => {
|
137 |
const option = new Option(value, value);
|
138 |
select.append(option);
|
|
|
3 |
AvailableModelsRequester,
|
4 |
} from "../networks/llm_requester.js";
|
5 |
|
6 |
+
class EndpointStorageItem { }
|
7 |
|
8 |
class EndpointStorage {
|
9 |
constructor() {
|
|
|
126 |
self.db.endpoints.delete(endpoint_input_value);
|
127 |
}
|
128 |
console.log(`remove endpoint: ${endpoint_input_value}`);
|
129 |
+
|
130 |
+
// TODO: remove models of current endpoint from available_models_select
|
131 |
});
|
132 |
}
|
133 |
async fill_available_models_select(endpoint) {
|
134 |
var select = $("#available-models-select");
|
135 |
console.log("fetch available models for endpoint:", endpoint);
|
136 |
+
// if endpoint not starts with http
|
137 |
+
if (endpoint.startsWith("http")) {
|
138 |
+
let available_models_requester = new AvailableModelsRequester(endpoint);
|
139 |
+
await available_models_requester.get();
|
140 |
+
} else {
|
141 |
+
}
|
142 |
available_models[endpoint].forEach((value, index) => {
|
143 |
const option = new Option(value, value);
|
144 |
select.append(option);
|