{{char_version}} – the Character's version number
{{group}} – a comma-separated list of group member names or the character name in solo chats. Alias: {{charIfNotGroup}}
{{model}} – a text generation model name for the currently selected API. Can be inaccurate!
-
{{lastMessage}} - the text of the latest chat message.
+
{{lastMessage}} – the text of the latest chat message.
+
{{lastUserMessage}} – the text of the latest user chat message.
+
{{lastCharMessage}} – the text of the latest character chat message.
{{lastMessageId}} – index # of the latest chat message. Useful for slash command batching.
-
{{firstIncludedMessageId}} - the ID of the first message included in the context. Requires generation to be ran at least once in the current session.
+
{{firstIncludedMessageId}} – the ID of the first message included in the context. Requires generation to be ran at least once in the current session.
{{currentSwipeId}} – the 1-based ID of the current swipe in the last chat message. Empty string if the last message is user or prompt-hidden.
{{lastSwipeId}} – the number of swipes in the last chat message. Empty string if the last message is user or prompt-hidden.
{{// (note)}} – you can leave a note here, and the macro will be replaced with blank content. Not visible for the AI.
diff --git a/src/endpoints/extensions.js b/src/endpoints/extensions.js
index d14ddb8cf..87c06da9c 100644
--- a/src/endpoints/extensions.js
+++ b/src/endpoints/extensions.js
@@ -191,7 +191,7 @@ router.post('/delete', jsonParser, async (request, response) => {
return response.status(400).send('Bad Request: extensionName is required in the request body.');
}
- // Sanatize the extension name to prevent directory traversal
+ // Sanitize the extension name to prevent directory traversal
const extensionName = sanitize(request.body.extensionName);
try {
@@ -201,7 +201,7 @@ router.post('/delete', jsonParser, async (request, response) => {
return response.status(404).send(`Directory does not exist at ${extensionPath}`);
}
- await fs.promises.rmdir(extensionPath, { recursive: true });
+ await fs.promises.rm(extensionPath, { recursive: true });
console.log(`Extension has been deleted at ${extensionPath}`);
return response.send(`Extension has been deleted at ${extensionPath}`);
diff --git a/src/endpoints/vectors.js b/src/endpoints/vectors.js
index 74666e584..38f74f7d8 100644
--- a/src/endpoints/vectors.js
+++ b/src/endpoints/vectors.js
@@ -1,5 +1,6 @@
const vectra = require('vectra');
const path = require('path');
+const fs = require('fs');
const express = require('express');
const sanitize = require('sanitize-filename');
const { jsonParser } = require('../express-common');
@@ -440,6 +441,24 @@ router.post('/delete', jsonParser, async (req, res) => {
}
});
+router.post('/purge-all', jsonParser, async (req, res) => {
+ try {
+ for (const source of SOURCES) {
+ const sourcePath = path.join(req.user.directories.vectors, sanitize(source));
+ if (!fs.existsSync(sourcePath)) {
+ continue;
+ }
+ await fs.promises.rm(sourcePath, { recursive: true });
+ console.log(`Deleted vector source store at ${sourcePath}`);
+ }
+
+ return res.sendStatus(200);
+ } catch (error) {
+ console.error(error);
+ return res.sendStatus(500);
+ }
+});
+
router.post('/purge', jsonParser, async (req, res) => {
try {
if (!req.body.collectionId) {