mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Kobold API url formatting
This commit is contained in:
@ -5,6 +5,7 @@ import {
|
||||
export {
|
||||
kai_settings,
|
||||
loadKoboldSettings,
|
||||
formatKoboldUrl,
|
||||
};
|
||||
|
||||
const kai_settings = {
|
||||
@ -20,6 +21,17 @@ const kai_settings = {
|
||||
single_line: false,
|
||||
};
|
||||
|
||||
function formatKoboldUrl(value) {
|
||||
try {
|
||||
const url = new URL(value);
|
||||
url.pathname = '/api';
|
||||
return url.toString();
|
||||
}
|
||||
catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function loadKoboldSettings(preset) {
|
||||
for (const name of Object.keys(kai_settings)) {
|
||||
const value = preset[name];
|
||||
|
Reference in New Issue
Block a user