mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add Gemini embedding model for vector storage
This commit is contained in:
@ -63,6 +63,7 @@ const settings = {
|
||||
ollama_keep: false,
|
||||
vllm_model: '',
|
||||
webllm_model: '',
|
||||
google_model: 'text-embedding-004',
|
||||
summarize: false,
|
||||
summarize_sent: false,
|
||||
summary_source: 'main',
|
||||
@ -789,6 +790,9 @@ function getVectorsRequestBody(args = {}) {
|
||||
case 'webllm':
|
||||
body.model = extension_settings.vectors.webllm_model;
|
||||
break;
|
||||
case 'palm':
|
||||
body.model = extension_settings.vectors.google_model;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1082,6 +1086,7 @@ function toggleSettings() {
|
||||
$('#nomicai_apiKey').toggle(settings.source === 'nomicai');
|
||||
$('#webllm_vectorsModel').toggle(settings.source === 'webllm');
|
||||
$('#koboldcpp_vectorsModel').toggle(settings.source === 'koboldcpp');
|
||||
$('#google_vectorsModel').toggle(settings.source === 'palm');
|
||||
if (settings.source === 'webllm') {
|
||||
loadWebLlmModels();
|
||||
}
|
||||
@ -1738,6 +1743,12 @@ jQuery(async () => {
|
||||
toastr.success('WebLLM model loaded');
|
||||
});
|
||||
|
||||
$('#vectors_google_model').val(settings.google_model).on('input', () => {
|
||||
settings.google_model = String($('#vectors_google_model').val());
|
||||
Object.assign(extension_settings.vectors, settings);
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#api_key_nomicai').toggleClass('success', !!secret_state[SECRET_KEYS.NOMICAI]);
|
||||
|
||||
toggleSettings();
|
||||
|
@ -120,7 +120,16 @@
|
||||
Hint: Set the URL in the API connection settings.
|
||||
</i>
|
||||
</div>
|
||||
|
||||
<div class="flex-container flexFlowColumn" id="google_vectorsModel">
|
||||
<label for="vectors_google_model" data-i18n="Vectorization Model">
|
||||
Vectorization Model
|
||||
</label>
|
||||
<select id="vectors_google_model" class="text_pole">
|
||||
<option value="gemini-embedding-exp-03-07">gemini-embedding-exp-03-07</option>
|
||||
<option value="text-embedding-004">text-embedding-004</option>
|
||||
<option value="embedding-001">embedding-001</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex-container alignItemsCenter" id="nomicai_apiKey">
|
||||
<label for="api_key_nomicai" class="flex1">
|
||||
<span data-i18n="NomicAI API Key">NomicAI API Key</span>
|
||||
|
@ -179,8 +179,7 @@ function getSourceSettings(source, request) {
|
||||
};
|
||||
case 'palm':
|
||||
return {
|
||||
// TODO: Add support for multiple models
|
||||
model: 'text-embedding-004',
|
||||
model: String(request.body.model || 'text-embedding-004'),
|
||||
};
|
||||
case 'mistral':
|
||||
return {
|
||||
|
Reference in New Issue
Block a user