Merge pull request #902 from SillyTavern/staging

Staging
This commit is contained in:
Cohee
2023-08-08 23:29:35 +03:00
committed by GitHub
5 changed files with 15 additions and 9 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "sillytavern", "name": "sillytavern",
"version": "1.9.5", "version": "1.9.6",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "sillytavern", "name": "sillytavern",
"version": "1.9.5", "version": "1.9.6",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"dependencies": { "dependencies": {
"@dqbd/tiktoken": "^1.0.2", "@dqbd/tiktoken": "^1.0.2",

View File

@@ -50,7 +50,7 @@
"type": "git", "type": "git",
"url": "https://github.com/SillyTavern/SillyTavern.git" "url": "https://github.com/SillyTavern/SillyTavern.git"
}, },
"version": "1.9.5", "version": "1.9.6",
"scripts": { "scripts": {
"start": "node server.js", "start": "node server.js",
"start-multi": "node server.js --disableCsrf", "start-multi": "node server.js --disableCsrf",

View File

@@ -7780,9 +7780,9 @@ $(document).ready(function () {
$("#api_button_textgenerationwebui").click(async function (e) { $("#api_button_textgenerationwebui").click(async function (e) {
e.stopPropagation(); e.stopPropagation();
if ($("#textgenerationwebui_api_url_text").val() != "") { if ($("#textgenerationwebui_api_url_text").val() != "") {
let value = formatTextGenURL($("#textgenerationwebui_api_url_text").val().trim()) let value = formatTextGenURL($("#textgenerationwebui_api_url_text").val().trim(), api_use_mancer_webui);
if (!value) { if (!value) {
callPopup('Please enter a valid URL.<br/>WebUI URLs should end with <tt>/api</tt>', 'text'); callPopup("Please enter a valid URL.<br/>WebUI URLs should end with <tt>/api</tt><br/>Enable 'Relaxed API URLs' to allow other paths.", 'text');
return; return;
} }

View File

@@ -99,11 +99,17 @@ function selectPreset(name) {
saveSettingsDebounced(); saveSettingsDebounced();
} }
function formatTextGenURL(value) { function formatTextGenURL(value, use_mancer) {
try { try {
const url = new URL(value); const url = new URL(value);
if (!power_user.relaxed_api_urls) { if (!power_user.relaxed_api_urls) {
url.pathname = '/api'; if (use_mancer) { // If Mancer is in use, only require the URL to *end* with `/api`.
if (!url.pathname.endsWith('/api')) {
return null;
}
} else {
url.pathname = '/api';
}
} }
return url.toString(); return url.toString();
} catch { } // Just using URL as a validation check } catch { } // Just using URL as a validation check

View File

@@ -3327,7 +3327,7 @@ app.post("/generate_openai", jsonParser, function (request, response_generate_op
makeRequest(config, response_generate_openai, request, retries - 1); makeRequest(config, response_generate_openai, request, retries - 1);
}, timeout); }, timeout);
} else { } else {
let errorData = error.response.data; let errorData = error?.response?.data;
if (request.body.stream) { if (request.body.stream) {
try { try {
@@ -3355,7 +3355,7 @@ app.post("/generate_openai", jsonParser, function (request, response_generate_op
} }
function handleError(error, response_generate_openai, errorData) { function handleError(error, response_generate_openai, errorData) {
console.error('Error:', error.message); console.error('Error:', error?.message);
let message = error?.response?.statusText; let message = error?.response?.statusText;