mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Remove Kobold soft prompt selector UI
This commit is contained in:
39
server.js
39
server.js
@@ -661,45 +661,6 @@ const formatApiUrl = (url) => (url.indexOf('localhost') !== -1)
|
||||
? url.replace('localhost', '127.0.0.1')
|
||||
: url;
|
||||
|
||||
app.post('/getsoftprompts', jsonParser, async function (request, response) {
|
||||
if (!request.body || !request.body.api_server) {
|
||||
return response.sendStatus(400);
|
||||
}
|
||||
|
||||
const baseUrl = formatApiUrl(request.body.api_server);
|
||||
let soft_prompts = [];
|
||||
|
||||
try {
|
||||
const softPromptsList = (await getAsync(`${baseUrl}/v1/config/soft_prompts_list`, baseRequestArgs)).values.map(x => x.value);
|
||||
const softPromptSelected = (await getAsync(`${baseUrl}/v1/config/soft_prompt`, baseRequestArgs)).value;
|
||||
soft_prompts = softPromptsList.map(x => ({ name: x, selected: x === softPromptSelected }));
|
||||
} catch (err) {
|
||||
soft_prompts = [];
|
||||
}
|
||||
|
||||
return response.send({ soft_prompts });
|
||||
});
|
||||
|
||||
app.post("/setsoftprompt", jsonParser, async function (request, response) {
|
||||
if (!request.body || !request.body.api_server) {
|
||||
return response.sendStatus(400);
|
||||
}
|
||||
|
||||
const baseUrl = formatApiUrl(request.body.api_server);
|
||||
const args = {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
data: { value: request.body.name ?? '' },
|
||||
};
|
||||
|
||||
try {
|
||||
await putAsync(`${baseUrl}/v1/config/soft_prompt`, args);
|
||||
} catch {
|
||||
return response.sendStatus(500);
|
||||
}
|
||||
|
||||
return response.sendStatus(200);
|
||||
});
|
||||
|
||||
function getVersion() {
|
||||
let pkgVersion = 'UNKNOWN';
|
||||
let gitRevision = null;
|
||||
|
Reference in New Issue
Block a user