mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
No awaitless async. Add JSDocs.
This commit is contained in:
@ -2307,6 +2307,11 @@ class Message {
|
|||||||
this.tokens = await tokenHandler.countAsync({ role: this.role, content: this.content, name: this.name });
|
this.tokens = await tokenHandler.countAsync({ role: this.role, content: this.content, name: this.name });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an image to the message.
|
||||||
|
* @param {string} image Image URL or Data URL.
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
async addImage(image) {
|
async addImage(image) {
|
||||||
const textContent = this.content;
|
const textContent = this.content;
|
||||||
const isDataUrl = isDataURL(image);
|
const isDataUrl = isDataURL(image);
|
||||||
@ -2401,7 +2406,7 @@ class Message {
|
|||||||
* @param {Object} prompt - The prompt object.
|
* @param {Object} prompt - The prompt object.
|
||||||
* @returns {Promise<Message>} A new instance of Message.
|
* @returns {Promise<Message>} A new instance of Message.
|
||||||
*/
|
*/
|
||||||
static async fromPromptAsync(prompt) {
|
static fromPromptAsync(prompt) {
|
||||||
return Message.createAsync(prompt.role, prompt.content, prompt.identifier);
|
return Message.createAsync(prompt.role, prompt.content, prompt.identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user