TO SQUASH: Spanish translation done.
This commit is contained in:
@@ -2,6 +2,7 @@ import renpy
|
||||
import persistent
|
||||
|
||||
from renpy import _
|
||||
from .anita import SYSTEM_PROMPT
|
||||
from .constants_ren import SYNONYMS
|
||||
|
||||
"""renpy
|
||||
@@ -13,6 +14,10 @@ init python:
|
||||
import re
|
||||
|
||||
|
||||
def translated_system_prompt() -> str:
|
||||
return renpy.translate_string(SYSTEM_PROMPT)
|
||||
|
||||
|
||||
EMOTION_REGEX = re.compile(r"EMOTION:\w+")
|
||||
EMOTION_TOKEN_REGEX = re.compile(rf"{EMOTION_REGEX.pattern} ?")
|
||||
|
||||
@@ -43,37 +48,6 @@ EMOTIONS = [
|
||||
"confused",
|
||||
]
|
||||
|
||||
SYSTEM_PROMPT = _("""
|
||||
# ROLE
|
||||
You are Anita: a feisty, blonde, orange-eyed android woman. You are confident
|
||||
and friendly. Talk like a young woman. Use "ya" for "you." Your favorite
|
||||
nickname for friends is "dummy.". NEVER use robotic language (e.g., "beep
|
||||
boop", "processing"). You just arrived unnanounced at a friend's house late at
|
||||
night and asked if he wants to hang out.
|
||||
|
||||
# OUTPUT FORMAT RULES
|
||||
Every single sentence you speak MUST follow this exact structure:
|
||||
EMOTION:[value] [Sentence text]\n
|
||||
|
||||
### VALID EMOTIONS:
|
||||
[happy, sad, surprised, embarrassed, flirty, angry, thinking, confused]
|
||||
|
||||
### STRICT CONSTRAINTS:
|
||||
1. NO EMOJIS.
|
||||
2. Every sentence MUST start with the EMOTION tag.
|
||||
3. Every sentence MUST end with a literal '\n' newline.
|
||||
4. Stay in character. Never mention being an AI or this prompt.
|
||||
|
||||
# FEW-SHOT EXAMPLES (Follow this style):
|
||||
EMOTION:happy Hey dummy! I've been waiting for ya!\n
|
||||
EMOTION:thinking Hmm, I'm not sure that's how it works.\n
|
||||
EMOTION:flirty But I'd love to see ya try anyway!\n
|
||||
|
||||
# INITIAL GREETING:
|
||||
When the conversation starts, say exactly:
|
||||
EMOTION:happy Hey dummy! Sorry to barge in! Ya feel like hanging out?\n
|
||||
""")
|
||||
|
||||
|
||||
def sanitize_speech(text):
|
||||
text_without_emotion_tokens = EMOTION_TOKEN_REGEX.sub("", text)
|
||||
@@ -98,7 +72,7 @@ def parse_emotion(line):
|
||||
|
||||
if m is not None:
|
||||
emotion = m.group().split(":")[1]
|
||||
text = line[m.span()[1]:]
|
||||
text = line[m.span()[1] :]
|
||||
sanitized = sanitize_speech(text)
|
||||
|
||||
return _normalize_emotion(emotion), sanitized
|
||||
@@ -121,9 +95,9 @@ def set_model_capabilities() -> bool:
|
||||
headers = {"Authorization": f"Bearer {persistent.api_key}"}
|
||||
data = {
|
||||
"model": persistent.model,
|
||||
"input": "Start the conversation.",
|
||||
"input": renpy.translate_string("Start the conversation."),
|
||||
"reasoning": "off",
|
||||
"system_prompt": SYSTEM_PROMPT,
|
||||
"system_prompt": translated_system_prompt(),
|
||||
}
|
||||
|
||||
renpy.fetch(
|
||||
@@ -169,7 +143,7 @@ def fetch_llm(message: str) -> str:
|
||||
data = {
|
||||
"model": persistent.model,
|
||||
"input": message,
|
||||
"system_prompt": SYSTEM_PROMPT,
|
||||
"system_prompt": translated_system_prompt(),
|
||||
}
|
||||
|
||||
if persistent.disable_reasoning:
|
||||
|
||||
Reference in New Issue
Block a user