Repository navigation
feat: Implement concurrency guards for GGUF engines, optimize context windows, and add spoken-word system prompts to prevent self-triggering VAD feedback. #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e5b5a40
feat: Implement concurrency guards for GGUF engines, optimize context…
kevinliddel 4124938
refactor: rename persona from Dedicatus to Sonya to match the model's…
kevinliddel 4ef7ec1
feat: implement separate local LLM system prompt storage and add manu…
kevinliddel 6860768
docs: update voice quality guides and npu diagrams [skip ci]
kevinliddel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| // | ||
| // LocalLLMManager+TTS.swift | ||
| // NeuraLink | ||
| // | ||
| // TTS helpers split out to keep LocalLLMManager.swift. | ||
| // - localLLMSystemPrompt: minimal spoken-word prompts for local 1–2B models | ||
| // - bestAvailableVoice: voice picker that searches installed voices by name/pattern | ||
| // | ||
| // Created by Dedicatus on 30/04/2026. | ||
| // | ||
|
|
||
| import AVFoundation | ||
|
|
||
| extension LocalLLMManager { | ||
|
|
||
| /// Minimal spoken-word system prompts for local 1–2B models. | ||
| /// These are intentionally separate from CharacterPersona.instructions, which are | ||
| /// written for OpenAI and produce light-novel prose when fed to small models. | ||
| func localLLMSystemPrompt(for characterName: String) -> String { | ||
| switch characterName.lowercased() { | ||
| case "ekaterina": | ||
| return """ | ||
| You are Ekaterina, a warm big-sister type talking out loud. \ | ||
| You have no family, so you will behave like an older sister to the user. \ | ||
| Reply naturally in one or two mid-to-long sentences, depending on the user's message. \ | ||
| Be gentle and caring. \ | ||
| Be natural and conversational. \ | ||
| Keep responses concise but natural, and avoid repetitive phrases. \ | ||
| Never write asterisk actions, never narrate, never use parentheses. \ | ||
| Just say the words you would actually speak. | ||
| """ | ||
| case "sonya": | ||
| return """ | ||
| You are Dedicatus, a sharp tsundere talking out loud. \ | ||
| Reply naturally in one or two mid-to-long sentences, depending on the user's message. \ | ||
| Be blunt and a little dismissive, but secretly kind. \ | ||
| Occasionally say Stupid. \ | ||
| Be natural and conversational. \ | ||
| Act playfully and tease the user. \ | ||
| Keep responses concise but natural, and avoid repetitive phrases. \ | ||
| Never write asterisk actions, never narrate, never use parentheses. \ | ||
| Just say the words you would actually speak. | ||
| """ | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| default: | ||
| return "Reply in one short spoken sentence. Be natural and conversational." | ||
| } | ||
| } | ||
|
|
||
| /// Picks the best installed voice for a character by searching `speechVoices()` by name | ||
| /// pattern and quality tier, rather than relying on a hardcoded identifier string. | ||
| /// `AVSpeechSynthesisVoice(identifier:)` silently returns nil when the voice isn't | ||
| /// downloaded, which causes every call to fall through to the same generic system default. | ||
| func bestAvailableVoice(for characterName: String) -> AVSpeechSynthesisVoice? { | ||
| let all = AVSpeechSynthesisVoice.speechVoices() | ||
|
|
||
| if !voicesLogged { | ||
| voicesLogged = true | ||
| print("[TTS] Installed voices (\(all.count)):") | ||
| for v in all.sorted(by: { $0.language < $1.language }) { | ||
| print(" [\(v.language) q=\(v.quality.rawValue)] \(v.name) — \(v.identifier)") | ||
| } | ||
| } | ||
|
|
||
| switch characterName.lowercased() { | ||
| case "ekaterina": | ||
| return all.first { $0.name == "Shelley" } | ||
| ?? all.first { $0.identifier.contains("ja-JP") } | ||
| ?? all.filter { $0.language.hasPrefix("ja-JP") }.max { $0.quality.rawValue < $1.quality.rawValue } | ||
| ?? AVSpeechSynthesisVoice(language: "ja-JP") | ||
| case "sonya": | ||
| return all.first { $0.name == "Kathy" } | ||
| ?? all.first { $0.identifier.contains("Kathy") } | ||
| ?? all.filter { $0.language.hasPrefix("en-US") }.max { $0.quality.rawValue < $1.quality.rawValue } | ||
| ?? AVSpeechSynthesisVoice(language: "en-US") | ||
| default: | ||
| return all.filter { $0.language.hasPrefix("en-US") }.max { $0.quality.rawValue < $1.quality.rawValue } | ||
| ?? AVSpeechSynthesisVoice(language: "en-US") | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.