#2566 Cache expressions list for LLM API
| @@ -1387,7 +1387,8 @@ async function getExpressionsList() { | |||
| 1387 | } | 1387 | } |
| 1388 | 1388 | ||
| 1389 | // If there was no specific list, or an error, just return the default expressions | 1389 | // 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; | ||
| 1391 | } | 1392 | } |
| 1392 | 1393 | ||
| 1393 | const result = await resolveExpressionsList(); | 1394 | const result = await resolveExpressionsList(); |
| @@ -1618,11 +1619,13 @@ async function onClickExpressionRemoveCustom() { | |||
| 1618 | moduleWorker(); | 1619 | moduleWorker(); |
| 1619 | } | 1620 | } |
| 1620 | 1621 | ||
| 1621 | function onExperesionApiChanged() { | 1622 | function onExpressionApiChanged() { |
| 1622 | const tempApi = this.value; | 1623 | const tempApi = this.value; |
| 1623 | if (tempApi) { | 1624 | if (tempApi) { |
| 1624 | extension_settings.expressions.api = Number(tempApi); | 1625 | extension_settings.expressions.api = Number(tempApi); |
| 1625 | $('.expression_llm_prompt_block').toggle(extension_settings.expressions.api === EXPRESSION_API.llm); | 1626 | $('.expression_llm_prompt_block').toggle(extension_settings.expressions.api === EXPRESSION_API.llm); |
| 1627 | expressionsList = null; | ||
| 1628 | spriteCache = {}; | ||
| 1626 | moduleWorker(); | 1629 | moduleWorker(); |
| 1627 | saveSettingsDebounced(); | 1630 | saveSettingsDebounced(); |
| 1628 | } | 1631 | } |
| @@ -1972,7 +1975,7 @@ function migrateSettings() { | |||
| 1972 | $('#expression_custom_add').on('click', onClickExpressionAddCustom); | 1975 | $('#expression_custom_add').on('click', onClickExpressionAddCustom); |
| 1973 | $('#expression_custom_remove').on('click', onClickExpressionRemoveCustom); | 1976 | $('#expression_custom_remove').on('click', onClickExpressionRemoveCustom); |
| 1974 | $('#expression_fallback').on('change', onExpressionFallbackChanged); | 1977 | $('#expression_fallback').on('change', onExpressionFallbackChanged); |
| 1975 | $('#expression_api').on('change', onExperesionApiChanged); | 1978 | $('#expression_api').on('change', onExpressionApiChanged); |
| 1976 | } | 1979 | } |
| 1977 | 1980 | ||
| 1978 | // Pause Talkinghead to save resources when the ST tab is not visible or the window is minimized. | 1981 | // Pause Talkinghead to save resources when the ST tab is not visible or the window is minimized. |