@@ -14,7 +14,6 @@ import {
1414} from "./constants" ;
1515import { Image } from "./image" ;
1616import {
17- ChangeEmotionOptions ,
1817 DirectorRequest ,
1918 HostInstance ,
2019 ImageInput ,
@@ -599,31 +598,32 @@ export class NovelAI {
599598 /**
600599 * Change the emotion of a character in an image
601600 *
602- * @param options - Options for changing emotion
603- * @param options.image - Image input (path, Blob, File, URL, etc.)
604- * @param options.emotion - Target emotion to change to
605- * @param options.prompt - Additional prompt to add to the request
606- * @param options.emotionLevel - Level of emotion change (0-5, optional)
601+ * @param image - Image input (path, Blob, File, URL, etc.)
607602 * @param host - Host to use for the request (optional)
603+ * @param emotion - Target emotion to change to
604+ * @param prompt - Additional prompt to add to the request
605+ * @param emotionLevel - Level of emotion change (0-5, optional)
608606 * @returns Promise resolving to an Image object
609607 */
610608 async changeEmotion (
611- options : ChangeEmotionOptions ,
609+ image : ImageInput ,
612610 host ?: Host | HostInstance ,
611+ emotion : string = EmotionOptions . NEUTRAL ,
612+ prompt : string = "" ,
613+ emotionLevel : EmotionLevel = EmotionLevel . NORMAL ,
614+
613615 ) : Promise < Image > {
614- const parsedImage = await parseImage ( options . image ) ;
616+ const parsedImage = await parseImage ( image ) ;
615617
616- // Create the prompt string in the format "originalEmotion;;targetEmotion,"
617- const originalEmotion = options . prompt || EmotionOptions . NEUTRAL ;
618- const prompt = `${ originalEmotion } ;;${ options . emotion } ,` ;
618+ const final_prompt = `${ emotion } ;;${ prompt } ` ;
619619
620620 const request : DirectorRequest = {
621621 req_type : DirectorTools . EMOTION ,
622622 width : parsedImage . width ,
623623 height : parsedImage . height ,
624624 image : parsedImage . base64 ,
625- prompt,
626- defry : options . emotionLevel ?? EmotionLevel . NORMAL ,
625+ prompt : final_prompt ,
626+ defry : emotionLevel ?? EmotionLevel . NORMAL ,
627627 } ;
628628
629629 return this . useDirectorTool ( request , host ) ;
0 commit comments