diff options
| author | Grail Finder <wohilas@gmail.com> | 2026-02-10 11:25:05 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2026-02-10 11:25:05 +0300 |
| commit | 46a33baabbde39f4090816965ff26840143bae95 (patch) | |
| tree | e89c5bd1430acc875f6cb431c4edbb3fe9d1fc5e | |
| parent | 875de679cf4732bbd70361d826d65d9d8b190add (diff) | |
Enha: stop tts if msg not for user
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | bot.go | 1 | ||||
| -rw-r--r-- | char-specific-context.md | 13 | ||||
| -rw-r--r-- | helpfuncs.go | 12 | ||||
| -rw-r--r-- | sysprompts/alice_bob_carl.json | 2 | ||||
| -rw-r--r-- | tui.go | 8 |
6 files changed, 19 insertions, 18 deletions
@@ -8,6 +8,7 @@ made with use of [tview](https://github.com/rivo/tview) - tts/stt (run make commands to get deps); - image input; - function calls (function calls are implemented natively, to avoid calling outside sources); +-  #### how it looks  @@ -874,6 +874,7 @@ out: // Process the new message to check for known_to tags in LLM response newMsg = *processMessageTag(&newMsg) chatBody.Messages = append(chatBody.Messages, newMsg) + stopTTSIfNotForUser(&newMsg) } cleanChatBody() refreshChatDisplay() diff --git a/char-specific-context.md b/char-specific-context.md index 54fa24e..2482e3d 100644 --- a/char-specific-context.md +++ b/char-specific-context.md @@ -113,16 +113,7 @@ When `AutoTurn` is enabled, the system can automatically trigger responses from ## Cardmaking with multiple characters So far only json format supports multiple characters. -Card example: -``` -{ - "sys_prompt": "This is a chat between Alice, Bob and Carl. Normally what is said by any character is seen by all others. But characters also might write messages intended to specific targets if their message contain string tag '@{CharName1,CharName2,CharName3}@'.\nFor example:\nAlice:\n\"Hey, Bob. I have a secret for you... (ooc: @Bob@)\"\nThis message would be seen only by Bob and Alice (sender always sees their own message).", - "role": "Alice", - "filepath": "sysprompts/alice_bob_carl.json", - "chars": ["Alice", "Bob", "Carl"], - "first_msg": "Hey guys! Want to play Alias like game? I'll tell Bob a word and he needs to describe that word so Carl can guess what it was?" -} -``` + ## Limitations & Caveats @@ -131,7 +122,7 @@ Card example: Character‑specific context relies on the `/completion` endpoint (or other completion‑style endpoints) where the LLM is presented with a raw text prompt containing the entire filtered history. It does **not** work with OpenAI‑style `/v1/chat/completions` endpoints, because those endpoints enforce a fixed role set (`user`/`assistant`/`system`) and strip custom role names and metadata. ### TTS -Although text message might be hidden from user character. If TTS is enabled it will be read. +Although text message might be hidden from user character. If TTS is enabled it will be read until tags are parsed. If message should not be viewed by user, tts will stop. ### Tag Parsing diff --git a/helpfuncs.go b/helpfuncs.go index 538b4aa..b6b5faa 100644 --- a/helpfuncs.go +++ b/helpfuncs.go @@ -45,6 +45,18 @@ func refreshChatDisplay() { }) } +func stopTTSIfNotForUser(msg *models.RoleMsg) { + viewingAs := cfg.UserRole + if cfg.WriteNextMsgAs != "" { + viewingAs = cfg.WriteNextMsgAs + } + // stop tts if msg is not for user + if cfg.CharSpecificContextEnabled && + !slices.Contains(msg.KnownTo, viewingAs) && cfg.TTS_ENABLED { + TTSDoneChan <- true + } +} + func colorText() { text := textView.GetText(false) quoteReplacer := strings.NewReplacer( diff --git a/sysprompts/alice_bob_carl.json b/sysprompts/alice_bob_carl.json index 409a8dc..b5321e4 100644 --- a/sysprompts/alice_bob_carl.json +++ b/sysprompts/alice_bob_carl.json @@ -1,5 +1,5 @@ { - "sys_prompt": "This is a chat between Alice, Bob and Carl. Normally all message are public (seen by everyone). But characters also able to make messages intended to specific targets using '@' tag. Usually tag is provided inside of out of character clause: (ooc: @charname@), but will be parsed if put anywhere in the message.\nTO SEND A PRIVATE MESSAGE:\n- Include a recipient tag in this exact format: @CharacterName@\n- The tag can be anywhere in your message\n- Example: \"Don't tell others this secret. (ooc: @Bob@)\"\n- For immersion sake it is better if private messages are given in context of whispering, passing notes, or being alone in some space: Alice: *leans closer to Carl and whispers* \"I forgot to turn off the car, could you watch my bag for a cuple of minutes? (ooc: @Carl@)\"\n- Only the sender and tagged recipients will see that message.\nRECEIVING MESSAGES:\n- You only see messages where you are the sender OR you are tagged in the recipient tag\n- Public messages (without tags) are seen by everyone.\nEXAMPLE FORMAT:\nAlice: \"Public message everyone sees\"\nAlice: \"Private message only for Bob @Bob@\"\n(if Diana joins the conversation, and Alice wants to exclude her) Alice: *Grabs Bob and Carl, and pulls them away* \"Listen boys, let's meet this friday again!\" (ooc: @Bob,Carl@; Diana is not trustworthy)\nWHEN TO USE:\n- Most of the time public messages (no tag) are the best choice. Private messages (with tag) are mostly for the passing secrets or information that is described or infered as private.\n- Game of 20 questions. Guys are putting paper sickers on the forehead with names written on them. So in this case only person who gets the sticker put on them does not see the writting on it.\nBob: *Puts sticker with 'JACK THE RIPPER' written on it, on Alices forehead* (ooc: @Carl).\nCarl: \"Alright, we're ready.\"\nAlice: \"Good. So, am I a fictional character or a real one?\"", + "sys_prompt": "This is a chat between Alice, Bob and Carl. Normally all message are public (seen by everyone). But characters also able to make messages intended to specific targets using '@' tag. Usually tag is provided inside of out of character clause: (ooc: @charname@), but will be parsed if put anywhere in the message.\nTO SEND A PRIVATE MESSAGE:\n- Include a recipient tag in this exact format: @CharacterName@\n- The tag can be anywhere in your message\n- Example: \"(ooc: @Bob@) Don't tell others this secret.\"\n- For immersion sake it is better if private messages are given in context of whispering, passing notes, or being alone in some space: Alice: (ooc: @Carl@) *leans closer to Carl and whispers* \"I forgot to turn off the car, could you watch my bag for a cuple of minutes?\"\n- Only the sender and tagged recipients will see that message.\nRECEIVING MESSAGES:\n- You only see messages where you are the sender OR you are tagged in the recipient tag\n- Public messages (without tags) are seen by everyone.\nEXAMPLE FORMAT:\nAlice: \"Public message everyone sees\"\nAlice: (ooc: @Bob@)\n\"Private message only for Bob\"\n(if Diana joins the conversation, and Alice wants to exclude her) Alice: (ooc: @Bob,Carl@; Diana is not trustworthy)\n*Grabs Bob and Carl, and pulls them away* \"Listen boys, let's meet this friday again!\"\nWHEN TO USE:\n- Most of the time public messages (no tag) are the best choice. Private messages (with tag) are mostly for the passing secrets or information that is described or infered as private.\n- Game of 20 questions. Guys are putting paper sickers on the forehead with names written on them. So in this case only person who gets the sticker put on them does not see the writting on it.\nBob: *Puts sticker with 'JACK THE RIPPER' written on it, on Alices forehead* (ooc: @Carl).\nCarl: \"Alright, we're ready.\"\nAlice: \"Good. So, am I a fictional character or a real one?\"", "role": "Alice", "filepath": "sysprompts/alice_bob_carl.json", "chars": ["Alice", "Bob", "Carl"], @@ -1120,12 +1120,8 @@ func init() { } } // I need keybind for tts to shut up - if event.Key() == tcell.KeyCtrlA { - // textArea.SetText("pressed ctrl+A", true) - if cfg.TTS_ENABLED { - // audioStream.TextChan <- chunk - TTSDoneChan <- true - } + if event.Key() == tcell.KeyCtrlA && cfg.TTS_ENABLED { + TTSDoneChan <- true } if event.Key() == tcell.KeyCtrlW { // INFO: continue bot/text message |
