Merge branch 'staging' of https://github.com/Cohee1207/SillyTavern into staging

This commit is contained in:
RossAscends 2023-11-23 17:20:35 +09:00
commit a88e2f93af
3 changed files with 39 additions and 25 deletions

View File

@ -1228,8 +1228,8 @@
<div class="flex-container flexFlowRow alignitemscenter gap10px flexShrink">
<div class="alignitemscenter flex-container marginBot5 flexFlowColumn flexGrow flexShrink gap0">
<small data-i18n="Number of Beams"># of Beams</small>
<input class="neo-range-slider" type="range" id="num_beams_textgenerationwebui" name="volume" min="1" max="20" step="1" />
<input class="neo-range-input" type="number" min="1" max="20" step="1" data-for="num_beams_textgenerationwebui" id="num_beams_counter_textgenerationwebui">
<input class="neo-range-slider" type="range" id="num_beams_textgenerationwebui" name="volume" min="0" max="20" step="1" />
<input class="neo-range-input" type="number" min="0" max="20" step="1" data-for="num_beams_textgenerationwebui" id="num_beams_counter_textgenerationwebui">
</div>
<div class="alignitemscenter flex-container marginBot5 flexFlowColumn flexGrow flexShrink gap0">
<small data-i18n="Length Penalty">Length Penalty</small>
@ -1513,7 +1513,7 @@
<option value="kobold"><span data-i18n="KoboldAI">KoboldAI Classic</span></option>
<option value="koboldhorde"><span data-i18n="KoboldAI Horde">KoboldAI Horde</span></option>
<option value="novel"><span data-i18n="NovelAI">NovelAI</span></option>
<option value="textgenerationwebui"><span data-i18n="Text Completion">Text Completion (ooba, Mancer, Aphrodite, KoboldCpp)</span></option>
<option value="textgenerationwebui"><span data-i18n="Text Completion">Text Completion (ooba, Mancer, Aphrodite, TabbyAPI, KoboldCpp)</span></option>
<option value="openai"><span data-i18n="Chat Completion (OpenAI, Claude, Window/OpenRouter, Scale, AI21)">Chat Completion (OpenAI, Claude, Window, OpenRouter, Scale, AI21, PaLM)</span></option>
</select>
</div>

View File

@ -596,6 +596,10 @@ app.post("/api/textgenerationwebui/status", jsonParser, async function (request,
const modelName = modelInfo?.id;
result = modelName || result;
} else {
// TabbyAPI returns an error 400 if a model isn't loaded
result = "None"
}
} catch (error) {
console.error(`Failed to get TabbyAPI model info: ${error}`);

View File

@ -58,6 +58,7 @@ function registerEndpoints(app, jsonParser) {
});
app.post('/api/translate/google', jsonParser, async (request, response) => {
try {
const { generateRequestUrl, normaliseResponse } = require('google-translate-api-browser');
const text = request.body.text;
const lang = request.body.lang;
@ -78,14 +79,23 @@ function registerEndpoints(app, jsonParser) {
});
resp.on('end', () => {
try {
const result = normaliseResponse(JSON.parse(data));
console.log('Translated text: ' + result.text);
return response.send(result.text);
} catch (error) {
console.log("Translation error", error);
return response.sendStatus(500);
}
});
}).on("error", (err) => {
console.log("Translation error: " + err.message);
return response.sendStatus(500);
});
} catch (error) {
console.log("Translation error", error);
return response.sendStatus(500);
}
});
app.post('/api/translate/deepl', jsonParser, async (request, response) => {