mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
code review adjustments part 1
This commit is contained in:
@@ -10,6 +10,7 @@ export {
|
||||
textgenerationwebui_settings,
|
||||
loadTextGenSettings,
|
||||
generateTextGenWithStreaming,
|
||||
formatTextGenURL,
|
||||
}
|
||||
|
||||
const textgenerationwebui_settings = {
|
||||
@@ -94,6 +95,16 @@ function selectPreset(name) {
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
function formatTextGenURL(value) {
|
||||
try {
|
||||
const url = new URL(value);
|
||||
if (url.pathname.endsWith('/api')) {
|
||||
return url.toString();
|
||||
}
|
||||
} catch { } // Try and Catch both fall through to the same return.
|
||||
return null;
|
||||
}
|
||||
|
||||
function convertPresets(presets) {
|
||||
return Array.isArray(presets) ? presets.map(JSON.parse) : [];
|
||||
}
|
||||
|
Reference in New Issue
Block a user