mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-04 19:58:34 +01:00
add "/emote xxx" support for talkinghead (when VN mode off)
This commit is contained in:
parent
9b24e7dc67
commit
059f61fee8
@ -1113,6 +1113,18 @@ async function setExpression(character, expression, force) {
|
|||||||
|
|
||||||
talkingHeadCheck().then(result => {
|
talkingHeadCheck().then(result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
|
// Set the talkinghead emotion to the specified expression
|
||||||
|
// TODO: For now, talkinghead emote only supported when VN mode is off; see also updateVisualNovelMode.
|
||||||
|
const url = new URL(getApiUrl());
|
||||||
|
url.pathname = '/api/talkinghead/set_emotion';
|
||||||
|
doExtrasFetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ emotion_name: expression }),
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
// Find the <img> element with id="expression-image" and class="expression"
|
// Find the <img> element with id="expression-image" and class="expression"
|
||||||
const imgElement = document.querySelector('img#expression-image.expression');
|
const imgElement = document.querySelector('img#expression-image.expression');
|
||||||
//console.log("searching");
|
//console.log("searching");
|
||||||
@ -1120,7 +1132,10 @@ async function setExpression(character, expression, force) {
|
|||||||
//console.log("setting value");
|
//console.log("setting value");
|
||||||
imgElement.src = getApiUrl() + '/api/talkinghead/result_feed';
|
imgElement.src = getApiUrl() + '/api/talkinghead/result_feed';
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
//console.log("The fetch failed!");
|
//console.log("The fetch failed!");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user