mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix Horde key not saving
This commit is contained in:
@ -1005,10 +1005,11 @@
|
|||||||
Adjust response length to worker capabilities
|
Adjust response length to worker capabilities
|
||||||
</label>
|
</label>
|
||||||
<h4>API key</h4>
|
<h4>API key</h4>
|
||||||
<h5>Get it here: <a target="_blank" href="https://horde.koboldai.net/register">Register</a>
|
<h5>Get it here: <a target="_blank" href="https://horde.koboldai.net/register">Register</a><br>
|
||||||
|
Enter <span class="monospace">0000000000</span> to use anonymous mode.
|
||||||
</h5>
|
</h5>
|
||||||
<input id="horde_api_key" name="horde_api_key" class="text_pole" maxlength="500" type="text" placeholder="0000000000">
|
<input id="horde_api_key" name="horde_api_key" class="text_pole" maxlength="500" type="text" placeholder="0000000000">
|
||||||
<div class="neutral_warning">Your API key will removed from here after you click "Connect" for privacy reasons.</div>
|
<div class="neutral_warning">Your API key will removed from here after you reload the page for privacy reasons.</div>
|
||||||
<h4 class="horde_model_title">
|
<h4 class="horde_model_title">
|
||||||
Model
|
Model
|
||||||
<div id="horde_refresh" title="Refresh models" class="right_menu_button">
|
<div id="horde_refresh" title="Refresh models" class="right_menu_button">
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { saveSettingsDebounced, changeMainAPI, callPopup, setGenerationProgress, CLIENT_VERSION, getRequestHeaders } from "../script.js";
|
import { saveSettingsDebounced, changeMainAPI, callPopup, setGenerationProgress, CLIENT_VERSION, getRequestHeaders } from "../script.js";
|
||||||
|
import { SECRET_KEYS, writeSecret } from "./secrets.js";
|
||||||
import { delay } from "./utils.js";
|
import { delay } from "./utils.js";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@ -217,5 +218,10 @@ jQuery(function () {
|
|||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#horde_api_key").on("input", async function () {
|
||||||
|
const key = $(this).val().trim();
|
||||||
|
await writeSecret(SECRET_KEYS.HORDE, key);
|
||||||
|
});
|
||||||
|
|
||||||
$("#horde_refresh").on("click", getHordeModels);
|
$("#horde_refresh").on("click", getHordeModels);
|
||||||
})
|
})
|
@ -18,7 +18,12 @@ function updateSecretDisplay() {
|
|||||||
for (const [secret_key, input_selector] of Object.entries(INPUT_MAP)) {
|
for (const [secret_key, input_selector] of Object.entries(INPUT_MAP)) {
|
||||||
const validSecret = !!secret_state[secret_key];
|
const validSecret = !!secret_state[secret_key];
|
||||||
const placeholder = validSecret ? '✔️ Key saved' : '❌ Missing key';
|
const placeholder = validSecret ? '✔️ Key saved' : '❌ Missing key';
|
||||||
$(input_selector).attr('placeholder', placeholder).val('');
|
$(input_selector).attr('placeholder', placeholder);
|
||||||
|
|
||||||
|
// Horde doesn't have a connect button
|
||||||
|
if (secret_key !== SECRET_KEYS.HORDE) {
|
||||||
|
$(input_selector).val('');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user