:zap: [Enhance] Use button to toggle endpoint and api key, and prettify available model display
Browse files- apps/llm_mixer/index.html +37 -39
- apps/llm_mixer/js/buttons_binder.js +29 -2
- apps/llm_mixer/js/default.css +5 -1
apps/llm_mixer/index.html
CHANGED
@@ -30,28 +30,61 @@
|
|
30 |
<div id="messagers-container" class="container mt-3"></div>
|
31 |
</div>
|
32 |
<div id="user-interactions" class="container fixed-bottom mb-3">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
<div class="mt-2 row no-gutters">
|
34 |
<div class="col-auto">
|
|
|
|
|
|
|
|
|
|
|
35 |
<select
|
36 |
class="form-select"
|
37 |
id="available-models-select"
|
38 |
title="Available Models"
|
39 |
></select>
|
40 |
</div>
|
41 |
-
<div class="col-auto
|
42 |
<select
|
43 |
class="form-select"
|
44 |
id="temperature-select"
|
45 |
title="Temperature"
|
46 |
></select>
|
47 |
</div>
|
48 |
-
<div class="col-
|
49 |
<select
|
50 |
class="form-select"
|
51 |
id="chat-history-select"
|
52 |
title="Chat History"
|
53 |
></select>
|
54 |
-
</div>
|
55 |
</div>
|
56 |
<div class="mt-2 row no-gutters">
|
57 |
<div class="col-auto pl-3 pr-0">
|
@@ -73,42 +106,7 @@
|
|
73 |
</button>
|
74 |
</div>
|
75 |
</div>
|
76 |
-
|
77 |
-
<div class="col-auto pl-3 pr-0">
|
78 |
-
<button id="prev-user-input" class="btn btn-dark">
|
79 |
-
<span class="fa fa-arrow-left"></span>
|
80 |
-
</button>
|
81 |
-
<button id="next-user-input" class="btn btn-dark">
|
82 |
-
<span class="fa fa-arrow-right"></span>
|
83 |
-
</button>
|
84 |
-
</div>
|
85 |
-
<div class="col px-0">
|
86 |
-
<input
|
87 |
-
id="openai-endpoint"
|
88 |
-
class="form-control"
|
89 |
-
rows="1"
|
90 |
-
placeholder="Endpoint"
|
91 |
-
></input>
|
92 |
-
</div>
|
93 |
-
<div class="col-auto px-0">
|
94 |
-
<button id="openai-endpoint-button" class="btn">
|
95 |
-
<i class="fa fa-check"></i>
|
96 |
-
</button>
|
97 |
-
</div>
|
98 |
-
<div class="col px-0">
|
99 |
-
<input
|
100 |
-
id="openai-api-key"
|
101 |
-
class="form-control"
|
102 |
-
rows="1"
|
103 |
-
placeholder="API Key"
|
104 |
-
></input>
|
105 |
-
</div>
|
106 |
-
<div class="col-auto px-0">
|
107 |
-
<button id="openai-api-key-button" class="btn">
|
108 |
-
<i class="fa fa-check"></i>
|
109 |
-
</button>
|
110 |
-
</div>
|
111 |
-
</div>
|
112 |
</div>
|
113 |
</div>
|
114 |
</body>
|
|
|
30 |
<div id="messagers-container" class="container mt-3"></div>
|
31 |
</div>
|
32 |
<div id="user-interactions" class="container fixed-bottom mb-3">
|
33 |
+
<div class="row mt-2 no-gutters">
|
34 |
+
<div class="col px-0">
|
35 |
+
<input
|
36 |
+
id="openai-endpoint"
|
37 |
+
class="form-control"
|
38 |
+
rows="1"
|
39 |
+
placeholder="Endpoint"
|
40 |
+
></input>
|
41 |
+
</div>
|
42 |
+
<div class="col-auto px-0">
|
43 |
+
<button id="openai-endpoint-button" class="btn">
|
44 |
+
<i class="fa fa-check"></i>
|
45 |
+
</button>
|
46 |
+
</div>
|
47 |
+
<div class="col px-0">
|
48 |
+
<input
|
49 |
+
id="openai-api-key"
|
50 |
+
class="form-control"
|
51 |
+
rows="1"
|
52 |
+
placeholder="API Key"
|
53 |
+
></input>
|
54 |
+
</div>
|
55 |
+
<div class="col-auto px-0">
|
56 |
+
<button id="openai-api-key-button" class="btn">
|
57 |
+
<i class="fa fa-check"></i>
|
58 |
+
</button>
|
59 |
+
</div>
|
60 |
+
</div>
|
61 |
<div class="mt-2 row no-gutters">
|
62 |
<div class="col-auto">
|
63 |
+
<button id="show-endpoint-and-key-button" class="btn px-0">
|
64 |
+
<i class="fa fa-key"></i>
|
65 |
+
</button>
|
66 |
+
</div>
|
67 |
+
<div class="col-auto px-0">
|
68 |
<select
|
69 |
class="form-select"
|
70 |
id="available-models-select"
|
71 |
title="Available Models"
|
72 |
></select>
|
73 |
</div>
|
74 |
+
<div class="col-auto">
|
75 |
<select
|
76 |
class="form-select"
|
77 |
id="temperature-select"
|
78 |
title="Temperature"
|
79 |
></select>
|
80 |
</div>
|
81 |
+
<!-- <div class="col pr-0">
|
82 |
<select
|
83 |
class="form-select"
|
84 |
id="chat-history-select"
|
85 |
title="Chat History"
|
86 |
></select>
|
87 |
+
</div> -->
|
88 |
</div>
|
89 |
<div class="mt-2 row no-gutters">
|
90 |
<div class="col-auto pl-3 pr-0">
|
|
|
106 |
</button>
|
107 |
</div>
|
108 |
</div>
|
109 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
</div>
|
111 |
</div>
|
112 |
</body>
|
apps/llm_mixer/js/buttons_binder.js
CHANGED
@@ -16,6 +16,8 @@ export function bind_chat_buttons() {
|
|
16 |
openai_endpoint_binder.bind();
|
17 |
let openai_api_key_binder = new OpenaiAPIKeyButtonBinder();
|
18 |
openai_api_key_binder.bind();
|
|
|
|
|
19 |
}
|
20 |
|
21 |
class SendUserInputButtonBinder {
|
@@ -103,7 +105,7 @@ class OpenaiEndpointButtonBinder {
|
|
103 |
constructor() {}
|
104 |
bind() {
|
105 |
const button = $("#openai-endpoint-button");
|
106 |
-
button.attr("title", "Submit
|
107 |
const stored_openai_endpoint = localStorage.getItem("openai_endpoint");
|
108 |
if (stored_openai_endpoint) {
|
109 |
$("#openai-endpoint").val(stored_openai_endpoint);
|
@@ -123,7 +125,7 @@ class OpenaiAPIKeyButtonBinder {
|
|
123 |
constructor() {}
|
124 |
bind() {
|
125 |
const button = $("#openai-api-key-button");
|
126 |
-
button.attr("title", "Submit
|
127 |
const stored_openai_api_key = localStorage.getItem("openai_api_key");
|
128 |
if (stored_openai_api_key) {
|
129 |
$("#openai-api-key").val(stored_openai_api_key);
|
@@ -135,3 +137,28 @@ class OpenaiAPIKeyButtonBinder {
|
|
135 |
});
|
136 |
}
|
137 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
openai_endpoint_binder.bind();
|
17 |
let openai_api_key_binder = new OpenaiAPIKeyButtonBinder();
|
18 |
openai_api_key_binder.bind();
|
19 |
+
let show_endpoint_and_key_binder = new ShowEndpointAndKeyButtonBinder();
|
20 |
+
show_endpoint_and_key_binder.bind();
|
21 |
}
|
22 |
|
23 |
class SendUserInputButtonBinder {
|
|
|
105 |
constructor() {}
|
106 |
bind() {
|
107 |
const button = $("#openai-endpoint-button");
|
108 |
+
button.attr("title", "Submit Endpoint");
|
109 |
const stored_openai_endpoint = localStorage.getItem("openai_endpoint");
|
110 |
if (stored_openai_endpoint) {
|
111 |
$("#openai-endpoint").val(stored_openai_endpoint);
|
|
|
125 |
constructor() {}
|
126 |
bind() {
|
127 |
const button = $("#openai-api-key-button");
|
128 |
+
button.attr("title", "Submit API Key");
|
129 |
const stored_openai_api_key = localStorage.getItem("openai_api_key");
|
130 |
if (stored_openai_api_key) {
|
131 |
$("#openai-api-key").val(stored_openai_api_key);
|
|
|
137 |
});
|
138 |
}
|
139 |
}
|
140 |
+
|
141 |
+
class ShowEndpointAndKeyButtonBinder {
|
142 |
+
constructor() {}
|
143 |
+
bind() {
|
144 |
+
const button = $("#show-endpoint-and-key-button");
|
145 |
+
button.attr("title", "Show endpoint and api key");
|
146 |
+
|
147 |
+
if (localStorage.getItem("openai_endpoint")) {
|
148 |
+
$("#openai-endpoint").parent().hide();
|
149 |
+
$("#openai-endpoint-button").parent().hide();
|
150 |
+
}
|
151 |
+
|
152 |
+
if (localStorage.getItem("openai_api_key")) {
|
153 |
+
$("#openai-api-key").parent().hide();
|
154 |
+
$("#openai-api-key-button").parent().hide();
|
155 |
+
}
|
156 |
+
|
157 |
+
button.click(() => {
|
158 |
+
$("#openai-endpoint").parent().toggle();
|
159 |
+
$("#openai-endpoint-button").parent().toggle();
|
160 |
+
$("#openai-api-key").parent().toggle();
|
161 |
+
$("#openai-api-key-button").parent().toggle();
|
162 |
+
});
|
163 |
+
}
|
164 |
+
}
|
apps/llm_mixer/js/default.css
CHANGED
@@ -35,7 +35,11 @@
|
|
35 |
}
|
36 |
|
37 |
#available-models-select {
|
38 |
-
max-width:
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
.fa-spin-fast {
|
|
|
35 |
}
|
36 |
|
37 |
#available-models-select {
|
38 |
+
max-width: calc(100vw - 200px);
|
39 |
+
}
|
40 |
+
|
41 |
+
#temperature-select {
|
42 |
+
max-width: 70px;
|
43 |
}
|
44 |
|
45 |
.fa-spin-fast {
|