mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix expression list resolve
- New expression api "LLM" still queried local classify model for expressions, fixed by returning default list - Fixed failed API calls crashing Expressions extension
This commit is contained in:
@ -1270,13 +1270,10 @@ async function getExpressionsList() {
|
|||||||
* @returns {Promise<string[]>}
|
* @returns {Promise<string[]>}
|
||||||
*/
|
*/
|
||||||
async function resolveExpressionsList() {
|
async function resolveExpressionsList() {
|
||||||
// get something for offline mode (default images)
|
// See if we can retrieve a specific expression list from the API
|
||||||
if (!modules.includes('classify') && extension_settings.expressions.api == EXPRESSION_API.extras) {
|
|
||||||
return DEFAULT_EXPRESSIONS;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (extension_settings.expressions.api == EXPRESSION_API.extras) {
|
// Check Extras api first, if enabled and that module active
|
||||||
|
if (extension_settings.expressions.api == EXPRESSION_API.extras && modules.includes('classify')) {
|
||||||
const url = new URL(getApiUrl());
|
const url = new URL(getApiUrl());
|
||||||
url.pathname = '/api/classify/labels';
|
url.pathname = '/api/classify/labels';
|
||||||
|
|
||||||
@ -1291,7 +1288,10 @@ async function getExpressionsList() {
|
|||||||
expressionsList = data.labels;
|
expressionsList = data.labels;
|
||||||
return expressionsList;
|
return expressionsList;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
// If running the local classify model (not using the LLM), we ask that one
|
||||||
|
if (extension_settings.expressions.api == EXPRESSION_API.local) {
|
||||||
const apiResult = await fetch('/api/extra/classify/labels', {
|
const apiResult = await fetch('/api/extra/classify/labels', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: getRequestHeaders(),
|
headers: getRequestHeaders(),
|
||||||
@ -1303,11 +1303,12 @@ async function getExpressionsList() {
|
|||||||
return expressionsList;
|
return expressionsList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (error) {
|
||||||
catch (error) {
|
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there was no specific list, or an error, just return the default expressions
|
||||||
|
return DEFAULT_EXPRESSIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await resolveExpressionsList();
|
const result = await resolveExpressionsList();
|
||||||
|
Reference in New Issue
Block a user