config.yaml: Group extension settings into one section
| @@ -133,24 +133,26 @@ whitelistImportDomains: | ||
| 133 | 133 | ## headers: |
| 134 | 134 | ## User-Agent: "Googlebot/2.1 (+http://www.google.com/bot.html)" |
| 135 | 135 | requestOverrides: [] |
| 136 | -# -- EXTENSIONS CONFIGURATION -- | |
| 136 | + | |
| 137 | +# EXTENSIONS CONFIGURATION | |
| 138 | +extensions: | |
| 137 | 139 | # Enable UI extensions |
| 138 | 140 | enableExtensions enabled: true |
| 139 | 141 | # Automatically update extensions when a release version changes |
| 140 | 142 | enableExtensionsAutoUpdate autoUpdate: true |
| 143 | + models: | |
| 144 | + # Enables automatic model download from HuggingFace | |
| 145 | + autoDownload: true | |
| 146 | + # Additional models for extensions. Expects model IDs from HuggingFace model hub in ONNX format | |
| 147 | + classification: Cohee/distilbert-base-uncased-go-emotions-onnx | |
| 148 | + captioning: Xenova/vit-gpt2-image-captioning | |
| 149 | + embedding: Cohee/jina-embeddings-v2-base-en | |
| 150 | + speechToText: Xenova/whisper-small | |
| 151 | + textToSpeech: Xenova/speecht5_tts | |
| 152 | + | |
| 141 | 153 | # Additional model tokenizers can be downloaded on demand. |
| 142 | 154 | # Disabling will fallback to another locally available tokenizer. |
| 143 | 155 | enableDownloadableTokenizers: true |
| 144 | -# Extension settings | |
| 145 | -extras: | |
| 146 | - # Disables automatic model download from HuggingFace | |
| 147 | - disableAutoDownload: false | |
| 148 | - # Extra models for plugins. Expects model IDs from HuggingFace model hub in ONNX format | |
| 149 | - classificationModel: Cohee/distilbert-base-uncased-go-emotions-onnx | |
| 150 | - captioningModel: Xenova/vit-gpt2-image-captioning | |
| 151 | - embeddingModel: Cohee/jina-embeddings-v2-base-en | |
| 152 | - speechToTextModel: Xenova/whisper-small | |
| 153 | - textToSpeechModel: Xenova/speecht5_tts | |
| 154 | 156 | # -- OPENAI CONFIGURATION -- |
| 155 | 157 | # A placeholder message to use in strict prompt post-processing mode when the prompt doesn't start with a user message |
| 156 | 158 | promptPlaceholder: "[Start a new chat]" |
| @@ -15,7 +15,7 @@ | ||
| 15 | 15 | "**/node_modules/**", |
| 16 | 16 | "**/dist/**", |
| 17 | 17 | "**/.git/**", |
| 18 | 18 | "public/lib/**", |
| 19 | 19 | "backups/**", |
| 20 | 20 | "data/**", |
| 21 | 21 | "cache/**", |
| @@ -64,6 +64,46 @@ const keyMigrationMap = [ | ||
| 64 | 64 | newKey: 'backups.chat.throttleInterval', |
| 65 | 65 | migrate: (value) => value, |
| 66 | 66 | }, |
| 67 | + { | |
| 68 | + oldKey: 'enableExtensions', | |
| 69 | + newKey: 'extensions.enabled', | |
| 70 | + migrate: (value) => value, | |
| 71 | + }, | |
| 72 | + { | |
| 73 | + oldKey: 'enableExtensionsAutoUpdate', | |
| 74 | + newKey: 'extensions.autoUpdate', | |
| 75 | + migrate: (value) => value, | |
| 76 | + }, | |
| 77 | + { | |
| 78 | + oldKey: 'extras.disableAutoDownload', | |
| 79 | + newKey: 'extensions.models.autoDownload', | |
| 80 | + migrate: (value) => !value, | |
| 81 | + }, | |
| 82 | + { | |
| 83 | + oldKey: 'extras.classificationModel', | |
| 84 | + newKey: 'extensions.models.classification', | |
| 85 | + migrate: (value) => value, | |
| 86 | + }, | |
| 87 | + { | |
| 88 | + oldKey: 'extras.captioningModel', | |
| 89 | + newKey: 'extensions.models.captioning', | |
| 90 | + migrate: (value) => value, | |
| 91 | + }, | |
| 92 | + { | |
| 93 | + oldKey: 'extras.embeddingModel', | |
| 94 | + newKey: 'extensions.models.embedding', | |
| 95 | + migrate: (value) => value, | |
| 96 | + }, | |
| 97 | + { | |
| 98 | + oldKey: 'extras.speechToTextModel', | |
| 99 | + newKey: 'extensions.models.speechToText', | |
| 100 | + migrate: (value) => value, | |
| 101 | + }, | |
| 102 | + { | |
| 103 | + oldKey: 'extras.textToSpeechModel', | |
| 104 | + newKey: 'extensions.models.textToSpeech', | |
| 105 | + migrate: (value) => value, | |
| 106 | + }, | |
| 67 | 107 | ]; |
| 68 | 108 | |
| 69 | 109 | /** |
| @@ -10,8 +10,8 @@ import { getConfigValue, generateTimestamp, removeOldBackups } from '../util.js' | ||
| 10 | 10 | import { jsonParser } from '../express-common.js'; |
| 11 | 11 | import { getAllUserHandles, getUserDirectories } from '../users.js'; |
| 12 | 12 | |
| 13 | 13 | const ENABLE_EXTENSIONS = !!getConfigValue('enableExtensionsextensions.enabled', true); |
| 14 | 14 | const ENABLE_EXTENSIONS_AUTO_UPDATE = !!getConfigValue('enableExtensionsAutoUpdateextensions.autoUpdate', true); |
| 15 | 15 | const ENABLE_ACCOUNTS = getConfigValue('enableUserAccounts', false); |
| 16 | 16 | |
| 17 | 17 | // 10 minutes |
| @@ -164,7 +164,7 @@ function getSourceSettings(source, request) { | ||
| 164 | 164 | }; |
| 165 | 165 | case 'transformers': |
| 166 | 166 | return { |
| 167 | 167 | model: getConfigValue('extrasextensions.embeddingModelmodels.embedding', ''), |
| 168 | 168 | }; |
| 169 | 169 | case 'palm': |
| 170 | 170 | return { |
| @@ -19,31 +19,31 @@ const tasks = { | ||
| 19 | 19 | 'text-classification': { |
| 20 | 20 | defaultModel: 'Cohee/distilbert-base-uncased-go-emotions-onnx', |
| 21 | 21 | pipeline: null, |
| 22 | 22 | configField: 'extrasextensions.classificationModelmodels.classification', |
| 23 | 23 | quantized: true, |
| 24 | 24 | }, |
| 25 | 25 | 'image-to-text': { |
| 26 | 26 | defaultModel: 'Xenova/vit-gpt2-image-captioning', |
| 27 | 27 | pipeline: null, |
| 28 | 28 | configField: 'extrasextensions.captioningModelmodels.captioning', |
| 29 | 29 | quantized: true, |
| 30 | 30 | }, |
| 31 | 31 | 'feature-extraction': { |
| 32 | 32 | defaultModel: 'Xenova/all-mpnet-base-v2', |
| 33 | 33 | pipeline: null, |
| 34 | 34 | configField: 'extrasextensions.embeddingModelmodels.embedding', |
| 35 | 35 | quantized: true, |
| 36 | 36 | }, |
| 37 | 37 | 'automatic-speech-recognition': { |
| 38 | 38 | defaultModel: 'Xenova/whisper-small', |
| 39 | 39 | pipeline: null, |
| 40 | 40 | configField: 'extrasextensions.speechToTextModelmodels.speechToText', |
| 41 | 41 | quantized: true, |
| 42 | 42 | }, |
| 43 | 43 | 'text-to-speech': { |
| 44 | 44 | defaultModel: 'Xenova/speecht5_tts', |
| 45 | 45 | pipeline: null, |
| 46 | 46 | configField: 'extrasextensions.textToSpeechModelmodels.textToSpeech', |
| 47 | 47 | quantized: false, |
| 48 | 48 | }, |
| 49 | 49 | }; |
| @@ -132,7 +132,7 @@ export async function getPipeline(task, forceModel = '') { | ||
| 132 | 132 | |
| 133 | 133 | const cacheDir = path.join(globalThis.DATA_ROOT, '_cache'); |
| 134 | 134 | const model = forceModel || getModelForTask(task); |
| 135 | 135 | const localOnly = !getConfigValue('extrasextensions.disableAutoDownloadmodels.autoDownload', falsetrue); |
| 136 | 136 | console.log('Initializing transformers.js pipeline for task', task, 'with model', model); |
| 137 | 137 | const instance = await pipeline(task, model, { cache_dir: cacheDir, quantized: tasks[task].quantized ?? true, local_files_only: localOnly }); |
| 138 | 138 | tasks[task].pipeline = instance; |