mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-20 06:00:40 +01:00
Merge branch 'staging' of https://github.com/Cohee1207/SillyTavern into staging
This commit is contained in:
commit
a88e2f93af
@ -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>
|
||||
@ -4848,4 +4848,4 @@
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
@ -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}`);
|
||||
|
@ -58,34 +58,44 @@ function registerEndpoints(app, jsonParser) {
|
||||
});
|
||||
|
||||
app.post('/api/translate/google', jsonParser, async (request, response) => {
|
||||
const { generateRequestUrl, normaliseResponse } = require('google-translate-api-browser');
|
||||
const text = request.body.text;
|
||||
const lang = request.body.lang;
|
||||
try {
|
||||
const { generateRequestUrl, normaliseResponse } = require('google-translate-api-browser');
|
||||
const text = request.body.text;
|
||||
const lang = request.body.lang;
|
||||
|
||||
if (!text || !lang) {
|
||||
return response.sendStatus(400);
|
||||
}
|
||||
if (!text || !lang) {
|
||||
return response.sendStatus(400);
|
||||
}
|
||||
|
||||
console.log('Input text: ' + text);
|
||||
console.log('Input text: ' + text);
|
||||
|
||||
const url = generateRequestUrl(text, { to: lang });
|
||||
const url = generateRequestUrl(text, { to: lang });
|
||||
|
||||
https.get(url, (resp) => {
|
||||
let data = '';
|
||||
https.get(url, (resp) => {
|
||||
let data = '';
|
||||
|
||||
resp.on('data', (chunk) => {
|
||||
data += chunk;
|
||||
resp.on('data', (chunk) => {
|
||||
data += chunk;
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
resp.on('end', () => {
|
||||
const result = normaliseResponse(JSON.parse(data));
|
||||
console.log('Translated text: ' + result.text);
|
||||
return response.send(result.text);
|
||||
});
|
||||
}).on("error", (err) => {
|
||||
console.log("Translation error: " + err.message);
|
||||
} catch (error) {
|
||||
console.log("Translation error", error);
|
||||
return response.sendStatus(500);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
app.post('/api/translate/deepl', jsonParser, async (request, response) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user