:zap: [Enhance] Behavior of toggle and add endpoint item
Browse files
components/buttons_binder.js
CHANGED
@@ -136,6 +136,7 @@ class ToggleEndpointAndApiKeyItemsButtonBinder {
|
|
136 |
button.attr("title", "Toggle endpoint and api key items");
|
137 |
button.click(() => {
|
138 |
$("#endpoint-and-api-key-items").toggle();
|
|
|
139 |
});
|
140 |
}
|
141 |
}
|
@@ -150,6 +151,7 @@ class AddEndpointAndApiKeyItemButtonBinder {
|
|
150 |
}
|
151 |
endpoint_storage.add_endpoint_and_api_key_item();
|
152 |
});
|
|
|
153 |
}
|
154 |
}
|
155 |
|
|
|
136 |
button.attr("title", "Toggle endpoint and api key items");
|
137 |
button.click(() => {
|
138 |
$("#endpoint-and-api-key-items").toggle();
|
139 |
+
$("#add-endpoint-and-api-key-item-button").parent().toggle();
|
140 |
});
|
141 |
}
|
142 |
}
|
|
|
151 |
}
|
152 |
endpoint_storage.add_endpoint_and_api_key_item();
|
153 |
});
|
154 |
+
button.parent().hide();
|
155 |
}
|
156 |
}
|
157 |
|
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() {
|
@@ -56,7 +56,7 @@ class EndpointStorage {
|
|
56 |
let endpoint_and_api_key_item = $(
|
57 |
this.get_endpoint_and_api_key_item_html()
|
58 |
);
|
59 |
-
endpoint_and_api_key_items.
|
60 |
this.bind_endpoint_and_api_key_buttons(endpoint_and_api_key_item);
|
61 |
}
|
62 |
create_endpoint_and_api_key_items() {
|
@@ -74,7 +74,7 @@ class EndpointStorage {
|
|
74 |
let api_key_input =
|
75 |
endpoint_and_api_key_item.find(".api-key-input");
|
76 |
api_key_input.val(row.api_key);
|
77 |
-
endpoint_and_api_key_items.
|
78 |
this.bind_endpoint_and_api_key_buttons(endpoint_and_api_key_item);
|
79 |
});
|
80 |
endpoints.each((row) => {
|
@@ -136,7 +136,9 @@ class EndpointStorage {
|
|
136 |
console.log("fetch available models for endpoint:", endpoint);
|
137 |
// if endpoint not starts with http
|
138 |
if (endpoint.startsWith("http")) {
|
139 |
-
let available_models_requester = new AvailableModelsRequester(
|
|
|
|
|
140 |
await available_models_requester.get();
|
141 |
} else {
|
142 |
}
|
@@ -145,7 +147,6 @@ class EndpointStorage {
|
|
145 |
select.append(option);
|
146 |
});
|
147 |
this.set_default_model();
|
148 |
-
|
149 |
}
|
150 |
set_default_model() {
|
151 |
let flatten_available_models = [];
|
|
|
3 |
AvailableModelsRequester,
|
4 |
} from "../networks/llm_requester.js";
|
5 |
|
6 |
+
class EndpointStorageItem {}
|
7 |
|
8 |
class EndpointStorage {
|
9 |
constructor() {
|
|
|
56 |
let endpoint_and_api_key_item = $(
|
57 |
this.get_endpoint_and_api_key_item_html()
|
58 |
);
|
59 |
+
endpoint_and_api_key_items.append(endpoint_and_api_key_item);
|
60 |
this.bind_endpoint_and_api_key_buttons(endpoint_and_api_key_item);
|
61 |
}
|
62 |
create_endpoint_and_api_key_items() {
|
|
|
74 |
let api_key_input =
|
75 |
endpoint_and_api_key_item.find(".api-key-input");
|
76 |
api_key_input.val(row.api_key);
|
77 |
+
endpoint_and_api_key_items.append(endpoint_and_api_key_item);
|
78 |
this.bind_endpoint_and_api_key_buttons(endpoint_and_api_key_item);
|
79 |
});
|
80 |
endpoints.each((row) => {
|
|
|
136 |
console.log("fetch available models for endpoint:", endpoint);
|
137 |
// if endpoint not starts with http
|
138 |
if (endpoint.startsWith("http")) {
|
139 |
+
let available_models_requester = new AvailableModelsRequester(
|
140 |
+
endpoint
|
141 |
+
);
|
142 |
await available_models_requester.get();
|
143 |
} else {
|
144 |
}
|
|
|
147 |
select.append(option);
|
148 |
});
|
149 |
this.set_default_model();
|
|
|
150 |
}
|
151 |
set_default_model() {
|
152 |
let flatten_available_models = [];
|