diff --git a/public/scripts/extensions/caption/index.js b/public/scripts/extensions/caption/index.js index d7a167fd4..f5cc0845d 100644 --- a/public/scripts/extensions/caption/index.js +++ b/public/scripts/extensions/caption/index.js @@ -377,6 +377,12 @@ jQuery(async function () { } function switchMultimodalBlocks() { const isMultimodal = extension_settings.caption.source === 'multimodal'; + $('#caption_ollama_pull').on('click', (e) => { + const presetModel = extension_settings.caption.multimodal_model !== 'ollama_current' ? extension_settings.caption.multimodal_model : ''; + e.preventDefault(); + $('#ollama_download_model').trigger('click'); + $('#dialogue_popup_input').val(presetModel); + }); $('#caption_multimodal_block').toggle(isMultimodal); $('#caption_prompt_block').toggle(isMultimodal); $('#caption_multimodal_api').val(extension_settings.caption.multimodal_api); diff --git a/public/scripts/extensions/caption/settings.html b/public/scripts/extensions/caption/settings.html index 1cdfbaefb..3e23cfbd5 100644 --- a/public/scripts/extensions/caption/settings.html +++ b/public/scripts/extensions/caption/settings.html @@ -58,14 +58,20 @@ - - + + + + + +
+ The model must be downloaded first! Do it with the ollama pull command or click here. +
- - Hint: Download models and set the URL in the API connection settings. +
+ The model must be downloaded first! Do it with the ollama pull command or click here. +
+ + Hint: Set the URL in the API connection settings.
diff --git a/public/scripts/preset-manager.js b/public/scripts/preset-manager.js index 42cc7585a..d751c5803 100644 --- a/public/scripts/preset-manager.js +++ b/public/scripts/preset-manager.js @@ -140,7 +140,10 @@ class PresetManager { * @param {string} value Preset option value */ selectPreset(value) { - $(this.select).find(`option[value=${value}]`).prop('selected', true); + const option = $(this.select).filter(function() { + return $(this).val() === value; + }); + option.prop('selected', true); $(this.select).val(value).trigger('change'); } diff --git a/public/scripts/templates/macros.html b/public/scripts/templates/macros.html index 353dcc12e..8d2e4ebdd 100644 --- a/public/scripts/templates/macros.html +++ b/public/scripts/templates/macros.html @@ -21,9 +21,11 @@
  • {{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) {