mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Adjusted naming and validation
This commit is contained in:
@ -111,7 +111,7 @@ const settings = {
|
|||||||
const moduleWorker = new ModuleWorkerWrapper(synchronizeChat);
|
const moduleWorker = new ModuleWorkerWrapper(synchronizeChat);
|
||||||
const webllmProvider = new WebLlmVectorProvider();
|
const webllmProvider = new WebLlmVectorProvider();
|
||||||
const cachedSummaries = new Map();
|
const cachedSummaries = new Map();
|
||||||
const vector_api_requires_url = ['llamacpp', 'vllm', 'ollama', 'koboldcpp'];
|
const vectorApiRequiresUrl = ['llamacpp', 'vllm', 'ollama', 'koboldcpp'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Collection ID for a file embedded in the chat.
|
* Gets the Collection ID for a file embedded in the chat.
|
||||||
@ -886,11 +886,18 @@ function throwIfSourceInvalid() {
|
|||||||
throw new Error('Vectors: API key missing', { cause: 'api_key_missing' });
|
throw new Error('Vectors: API key missing', { cause: 'api_key_missing' });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.source === 'ollama' && !textgenerationwebui_settings.server_urls[textgen_types.OLLAMA] ||
|
if (vectorApiRequiresUrl.includes(settings.source) && settings.use_alt_endpoint) {
|
||||||
settings.source === 'vllm' && !textgenerationwebui_settings.server_urls[textgen_types.VLLM] ||
|
if (!settings.alt_endpoint_url) {
|
||||||
settings.source === 'koboldcpp' && !textgenerationwebui_settings.server_urls[textgen_types.KOBOLDCPP] ||
|
throw new Error('Vectors: API URL missing', { cause: 'api_url_missing' });
|
||||||
settings.source === 'llamacpp' && !textgenerationwebui_settings.server_urls[textgen_types.LLAMACPP]) {
|
}
|
||||||
throw new Error('Vectors: API URL missing', { cause: 'api_url_missing' });
|
}
|
||||||
|
else {
|
||||||
|
if (settings.source === 'ollama' && !textgenerationwebui_settings.server_urls[textgen_types.OLLAMA] ||
|
||||||
|
settings.source === 'vllm' && !textgenerationwebui_settings.server_urls[textgen_types.VLLM] ||
|
||||||
|
settings.source === 'koboldcpp' && !textgenerationwebui_settings.server_urls[textgen_types.KOBOLDCPP] ||
|
||||||
|
settings.source === 'llamacpp' && !textgenerationwebui_settings.server_urls[textgen_types.LLAMACPP]) {
|
||||||
|
throw new Error('Vectors: API URL missing', { cause: 'api_url_missing' });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.source === 'ollama' && !settings.ollama_model || settings.source === 'vllm' && !settings.vllm_model) {
|
if (settings.source === 'ollama' && !settings.ollama_model || settings.source === 'vllm' && !settings.vllm_model) {
|
||||||
@ -1090,7 +1097,7 @@ function toggleSettings() {
|
|||||||
$('#webllm_vectorsModel').toggle(settings.source === 'webllm');
|
$('#webllm_vectorsModel').toggle(settings.source === 'webllm');
|
||||||
$('#koboldcpp_vectorsModel').toggle(settings.source === 'koboldcpp');
|
$('#koboldcpp_vectorsModel').toggle(settings.source === 'koboldcpp');
|
||||||
$('#google_vectorsModel').toggle(settings.source === 'palm');
|
$('#google_vectorsModel').toggle(settings.source === 'palm');
|
||||||
$('#altEndpointUrl').toggle(vector_api_requires_url.includes(settings.source));
|
$('#vector_altEndpointUrl').toggle(vectorApiRequiresUrl.includes(settings.source));
|
||||||
if (settings.source === 'webllm') {
|
if (settings.source === 'webllm') {
|
||||||
loadWebLlmModels();
|
loadWebLlmModels();
|
||||||
}
|
}
|
||||||
@ -1471,13 +1478,13 @@ jQuery(async () => {
|
|||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
toggleSettings();
|
toggleSettings();
|
||||||
});
|
});
|
||||||
$('#altEndpointUrl_enabled').prop('checked', settings.use_alt_endpoint).on('input', () => {
|
$('#vector_altEndpointUrl_enabled').prop('checked', settings.use_alt_endpoint).on('input', () => {
|
||||||
settings.use_alt_endpoint = $('#altEndpointUrl_enabled').prop('checked');
|
settings.use_alt_endpoint = $('#vector_altEndpointUrl_enabled').prop('checked');
|
||||||
Object.assign(extension_settings.vectors, settings);
|
Object.assign(extension_settings.vectors, settings);
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
$('#altEndpoint_address').val(settings.alt_endpoint_url).on('change', () => {
|
$('#vector_altEndpoint_address').val(settings.alt_endpoint_url).on('change', () => {
|
||||||
settings.alt_endpoint_url = String($('#altEndpoint_address').val());
|
settings.alt_endpoint_url = String($('#vector_altEndpoint_address').val());
|
||||||
Object.assign(extension_settings.vectors, settings);
|
Object.assign(extension_settings.vectors, settings);
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
@ -25,15 +25,15 @@
|
|||||||
<option value="webllm" data-i18n="WebLLM Extension">WebLLM Extension</option>
|
<option value="webllm" data-i18n="WebLLM Extension">WebLLM Extension</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-container flexFlowColumn" id="altEndpointUrl">
|
<div class="flex-container flexFlowColumn" id="vector_altEndpointUrl">
|
||||||
<label class="checkbox_label" for="altEndpointUrl_enabled" title="Enable secondary endpoint URL usage, instead of the main one.">
|
<label class="checkbox_label" for="vector_altEndpointUrl_enabled" title="Enable secondary endpoint URL usage, instead of the main one.">
|
||||||
<input id="altEndpointUrl_enabled" type="checkbox" class="checkbox">
|
<input id="vector_altEndpointUrl_enabled" type="checkbox" class="checkbox">
|
||||||
<span data-i18n="Use secondary URL">Use secondary URL</span>
|
<span data-i18n="Use secondary URL">Use secondary URL</span>
|
||||||
</label>
|
</label>
|
||||||
<label for="altEndpoint_address" data-i18n="Secondary Embedding endpoint URL">
|
<label for="vector_altEndpoint_address" data-i18n="Secondary Embedding endpoint URL">
|
||||||
Secondary Embedding endpoint URL
|
Secondary Embedding endpoint URL
|
||||||
</label>
|
</label>
|
||||||
<input id="altEndpoint_address" class="text_pole" type="text" placeholder="URL for secondary endpoint" />
|
<input id="vector_altEndpoint_address" class="text_pole" type="text" placeholder="URL for secondary endpoint" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-container flexFlowColumn" id="webllm_vectorsModel">
|
<div class="flex-container flexFlowColumn" id="webllm_vectorsModel">
|
||||||
<label for="vectors_webllm_model" data-i18n="Vectorization Model">
|
<label for="vectors_webllm_model" data-i18n="Vectorization Model">
|
||||||
|
Reference in New Issue
Block a user