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="flex-container flexFlowRow alignitemscenter gap10px flexShrink">
|
||||||
<div class="alignitemscenter flex-container marginBot5 flexFlowColumn flexGrow flexShrink gap0">
|
<div class="alignitemscenter flex-container marginBot5 flexFlowColumn flexGrow flexShrink gap0">
|
||||||
<small data-i18n="Number of Beams"># of Beams</small>
|
<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-slider" type="range" id="num_beams_textgenerationwebui" name="volume" min="0" 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-input" type="number" min="0" max="20" step="1" data-for="num_beams_textgenerationwebui" id="num_beams_counter_textgenerationwebui">
|
||||||
</div>
|
</div>
|
||||||
<div class="alignitemscenter flex-container marginBot5 flexFlowColumn flexGrow flexShrink gap0">
|
<div class="alignitemscenter flex-container marginBot5 flexFlowColumn flexGrow flexShrink gap0">
|
||||||
<small data-i18n="Length Penalty">Length Penalty</small>
|
<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="kobold"><span data-i18n="KoboldAI">KoboldAI Classic</span></option>
|
||||||
<option value="koboldhorde"><span data-i18n="KoboldAI Horde">KoboldAI Horde</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="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>
|
<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>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4848,4 +4848,4 @@
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -596,6 +596,10 @@ app.post("/api/textgenerationwebui/status", jsonParser, async function (request,
|
||||||
|
|
||||||
const modelName = modelInfo?.id;
|
const modelName = modelInfo?.id;
|
||||||
result = modelName || result;
|
result = modelName || result;
|
||||||
|
} else {
|
||||||
|
// TabbyAPI returns an error 400 if a model isn't loaded
|
||||||
|
|
||||||
|
result = "None"
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Failed to get TabbyAPI model info: ${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) => {
|
app.post('/api/translate/google', jsonParser, async (request, response) => {
|
||||||
const { generateRequestUrl, normaliseResponse } = require('google-translate-api-browser');
|
try {
|
||||||
const text = request.body.text;
|
const { generateRequestUrl, normaliseResponse } = require('google-translate-api-browser');
|
||||||
const lang = request.body.lang;
|
const text = request.body.text;
|
||||||
|
const lang = request.body.lang;
|
||||||
|
|
||||||
if (!text || !lang) {
|
if (!text || !lang) {
|
||||||
return response.sendStatus(400);
|
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) => {
|
https.get(url, (resp) => {
|
||||||
let data = '';
|
let data = '';
|
||||||
|
|
||||||
resp.on('data', (chunk) => {
|
resp.on('data', (chunk) => {
|
||||||
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);
|
||||||
});
|
});
|
||||||
|
} catch (error) {
|
||||||
resp.on('end', () => {
|
console.log("Translation error", error);
|
||||||
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);
|
|
||||||
return response.sendStatus(500);
|
return response.sendStatus(500);
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/translate/deepl', jsonParser, async (request, response) => {
|
app.post('/api/translate/deepl', jsonParser, async (request, response) => {
|
||||||
|
|
Loading…
Reference in New Issue