#2566 Cache expressions list for LLM API

d214c181560fdd2ae0cb1dfc9d10ec7cd22014f6

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +6 -3Ignore whitespace
public/scripts/extensions/expressions/index.js+6 -3
@@ -1387,7 +1387,8 @@ async function getExpressionsList() {
13871387 }
13881388
13891389 // If there was no specific list, or an error, just return the default expressions
1390- return DEFAULT_EXPRESSIONS;
1390+ expressionsList = DEFAULT_EXPRESSIONS.filter(e => e !== 'talkinghead').slice();
1391+ return expressionsList;
13911392 }
13921393
13931394 const result = await resolveExpressionsList();
@@ -1618,11 +1619,13 @@ async function onClickExpressionRemoveCustom() {
16181619 moduleWorker();
16191620}
16201621
16211622function onExperesionApiChangedonExpressionApiChanged() {
16221623 const tempApi = this.value;
16231624 if (tempApi) {
16241625 extension_settings.expressions.api = Number(tempApi);
16251626 $('.expression_llm_prompt_block').toggle(extension_settings.expressions.api === EXPRESSION_API.llm);
1627+ expressionsList = null;
1628+ spriteCache = {};
16261629 moduleWorker();
16271630 saveSettingsDebounced();
16281631 }
@@ -1972,7 +1975,7 @@ function migrateSettings() {
19721975 $('#expression_custom_add').on('click', onClickExpressionAddCustom);
19731976 $('#expression_custom_remove').on('click', onClickExpressionRemoveCustom);
19741977 $('#expression_fallback').on('change', onExpressionFallbackChanged);
19751978 $('#expression_api').on('change', onExperesionApiChangedonExpressionApiChanged);
19761979 }
19771980
19781981 // Pause Talkinghead to save resources when the ST tab is not visible or the window is minimized.