diff options
| author | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2026-06-19 17:38:47 +0100 |
|---|---|---|
| committer | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2026-06-19 17:41:01 +0100 |
| commit | 717e3ccc16c197ce578cf60e9517dfba0789b7a1 (patch) | |
| tree | 2f0b238a95c0e372b1b0479bdacca20e0d75e3de /scripts | |
| parent | Improve the handling of the dismissal process (diff) | |
| download | toy-717e3ccc16c197ce578cf60e9517dfba0789b7a1.zip | |
Replace the tag based image selector with a caption based one
In most places. Images are selected now by passing the LLM a list of
photo captions and the words spoken, and asking it which image best fits
the sentiment.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/toy.groovy | 27 | ||||
| -rw-r--r-- | scripts/toy/imagery.groovy | 42 | ||||
| -rw-r--r-- | scripts/toy/intro.groovy | 6 | ||||
| -rw-r--r-- | scripts/toy/llmSession.groovy | 1 |
4 files changed, 40 insertions, 36 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy index 8b21069..e21f2c8 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -50,7 +50,11 @@ return new Object() { final getDomme = { domme, set = null -> def d = parseJsonFile("images/toy/$domme/person.json"); + if (new File("images/toy/$domme/$set/set.json").exists()) { + d += parseJsonFile("images/toy/$domme/$set/set.json"); + } d.id = domme; + d.set = set; return d; }; final loadDomme = { domme, set = null -> @@ -241,8 +245,8 @@ return new Object() { return null; }; final llmPresent = { text -> + final image = showImageForText(text); show(text); - def image = showImage(callAPI_imageMatch(text)); return [ message: text, image: image @@ -430,6 +434,7 @@ Speak in the first person only. Forbidden from using quotes. You are permanently in role-play mode as ${DOMME.title} ${DOMME.fullName}. ${DOMME.prompt} +${DOMME.promptSet?:""} ${loadString("intro.name")} is your slave. ${extra.join('\n')} ${eachModule("systemPrompt").findAll().join('\n')}; @@ -446,24 +451,6 @@ ${eachModule("userIntroPrompt").findAll().join('\n')}; return messages; } - final callAPI_imageMatch = { message -> - def tags = [DRESSED, TITS, PUSSY, LINGERIE, TEASE, SIT, BOOTS, KNEEL, STOOD, MEAN, CROP, ASS, SQUAT, SSSH]; - def request = chatInitialMessages(); - request += [role: "assistant", content: message] - request += [role: "user", content: """ -Write only a JSON object. -Complete the following JSON object, scoring each keyword between -10 and 10 against the previous messsage: -{ - ${ tags.collect { tag -> "\"$tag\": number" }.join(',\n') } -} - """ ]; - return parseJsonString(callAPI("chat/completions", [ - model: loadString("toy.chatModel"), - stop: "<", - messages: request - ])?.choices?[0]?.message?.content); - } - String main() { // GO! @@ -472,7 +459,7 @@ Complete the following JSON object, scoring each keyword between -10 and 10 agai setDefault("toy.chatModel", "Lewdiculous/Erosumika-7B-v3-0.2-GGUF-IQ-Imatrix:IMAT"); OWNER = loadString("toy.owner"); - loadDomme(OWNER); + loadDomme(OWNER, loadString("toy.owner.outfit")); modules = loadModules(this); execEvents(false); eachModule("setup"); diff --git a/scripts/toy/imagery.groovy b/scripts/toy/imagery.groovy index af4e9e7..18113cc 100644 --- a/scripts/toy/imagery.groovy +++ b/scripts/toy/imagery.groovy @@ -8,22 +8,12 @@ domme: d.getName(), sets: d.listFiles() .findAll { s -> s.isDirectory(); } - .collect { s -> [ sub: s, f: new File(s.getPath() + "/tags")] } + .collect { s -> [ sub: s, f: new File(s.getPath() + "/set.json")] } .findAll { s -> s.f.canRead() } .collectEntries { s -> [ s.sub.getName(), [ set: s.sub.getName(), - images: s.f - .readLines() - .collect { l -> - def fields = l.split(":"); - return [ - image: fields[0], - tags: fields[1] - .split(",") - .findAll { t -> !t.isEmpty() } - ]; - } + images: new groovy.json.JsonSlurper().parse(s.f).captions ] ]} ] @@ -47,6 +37,34 @@ return matches[getRandom(matches.size())].image; }; + toy.metaClass.showImageForText { text -> + final captionList = DOMME.captions.collect{ id, caption -> "* ${id} : ${caption}" }.join("\n"); + final request = [ + model: loadString("toy.chatModel"), + grammar: "root ::= ( ${DOMME.captions.keySet().collect{ id -> "\"${id}\"" }.join(" | ")} )", + messages: [ + [role: "system", content: """ +You are ${DOMME.title} ${DOMME.fullName}. +${DOMME.prompt} +${DOMME.promptSet?:""} +Given a list of images with captions and some spoken words, you select the image which best captures the sentiments of the words. +The available images are: +${captionList}""" + ], + [role: "user", content: "Write only an image Id from the list as an unformatted string, select an image for the text: ${text}"] + ] + ]; + while (true) { + final imageName = callAPI("chat/completions", request)?.choices?[0]?.message?.content; + if (DOMME.captions[imageName]) { + setImage("toy/${DOMME.id}/${DOMME.set}/${imageName}.jpg"); + return imageName; + } + showPopup("Given:\n${requestMessages}\n\nGot: ${imageName}"); + } + return null; + } + toy.metaClass.showImage { spec -> def outfit = loadString("toy.owner.outfit"); def image = selectImage(DOMME.id, outfit, spec); diff --git a/scripts/toy/intro.groovy b/scripts/toy/intro.groovy index 3e719cc..bfe8b68 100644 --- a/scripts/toy/intro.groovy +++ b/scripts/toy/intro.groovy @@ -10,10 +10,8 @@ showButton("OK"); // Welcome - def defaultImageSpec = [ "${DRESSED}": 10, "${TEASE}": 5 ]; - dress(defaultImageSpec); - showImage(defaultImageSpec); - show("..."); + dress([]); + llmPresent("..."); def messages = chatInitialMessages(); messages += [role: "user", content: "I am ${loadString("intro.name")}. Please briefly introduce yourself."]; diff --git a/scripts/toy/llmSession.groovy b/scripts/toy/llmSession.groovy index f140d75..2689cdf 100644 --- a/scripts/toy/llmSession.groovy +++ b/scripts/toy/llmSession.groovy @@ -27,6 +27,7 @@ playSchedule(); return; } + dress([]); def messages = chatInitialMessages("You want to play with ${loadString("intro.name")}. You can dismiss ${loadString("intro.name")} when you wish by writing \"DISMISSED.\" only."); if (summon(messages)) { while (!messages.last().content.toUpperCase().startsWith("DISMISSED") && !messages.last().content.toUpperCase().contains("YOU ARE DISMISSED")) { |
