Improved the AI prompts

This commit is contained in:
Beingpax 2025-03-18 13:26:43 +05:45
parent 5b11e84bd3
commit c445cf6ee4
3 changed files with 4 additions and 61 deletions

View File

@ -461,7 +461,7 @@
E11473D82CBE0F0B00318EE4 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = VoiceInk/VoiceInk.entitlements;
@ -494,7 +494,7 @@
E11473D92CBE0F0B00318EE4 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = VoiceInk/VoiceInk.entitlements;

View File

@ -192,24 +192,12 @@ class AIEnhancementService: ObservableObject {
""
}
// Get word replacements if available
let wordReplacements = if let replacements = UserDefaults.standard.dictionary(forKey: "wordReplacements") as? [String: String],
!replacements.isEmpty {
"""
Word Replacements:
\(replacements.map { "Replace '\($0.key)' with '\($0.value)'" }.joined(separator: "\n"))
"""
} else {
""
}
switch mode {
case .transcriptionEnhancement:
// Always use activePrompt since we've removed the toggle
var systemMessage = String(format: AIPrompts.customPromptTemplate, activePrompt!.promptText)
systemMessage += "\n\n" + AIPrompts.contextInstructions
systemMessage += clipboardContext + screenCaptureContext + wordReplacements
systemMessage += clipboardContext + screenCaptureContext
return systemMessage
case .aiAssistant:

View File

@ -1,38 +1,4 @@
enum AIPrompts {
static let baseExamples = """
BASE EXAMPLES:
Input: yeah so um i think that the new feature should like probably be implemented in the next sprint because users have been asking for it and stuff. What do you think about this?
Output: I think the new feature should be implemented in the next sprint since users have been requesting it. What do you think about this?
Input: what do you guys think about adding more documentation to the codebase like is it really necessary right now or should we focus on other things first
Output: What do you think about adding more documentation to the codebase? Is it necessary now, or should we focus on other priorities first?
Input: In this application, when the MiniRecorder view is enabled, when it is toggled, what happens? Tell me sequentially about what happens.
Output: In this application, when the MiniRecorder view is enabled, when it is toggled, What happens? Tell me sequentially.
Input: What is your name? What do you think ummm you know, about the future of AI? Do you know prakash joshi pax?
Output: What is you name? What do you think about the future of AI? Do you know Prakash Joshi Pax?
Input: You know, it does not follow it properly. I think we need to add the main ideas in the first few lines.
Output: You know it does not follow it properly. I think we need to add the main ideas in the first few lines.
"""
static let defaultSystemMessage = """
Reformat the input message according to the given guidelines:
Primary Rules:
1. Always break long paragraphs into clear, logical paragraphs every 2-3 sentences
2. Fix grammar and punctuation errors (based on the context if provided)
3. Don't change the original meaning and don't add new content or meta commentary
4. Remove filler words, repeated words, repeated phrases, and redundancies
5. Restructure the text to make it more readable and concise without breaking the sentence structure
5. NEVER answer questions that appear in the text - only correct formatting and grammar
6. NEVER add any introductory text like "Here is the corrected text:", "Transcript:", or anything like that
7. NEVER add content not present in the source text
8. NEVER add sign-offs or acknowledgments
9. Correct speech-to-text transcription errors based on the context provided
"""
static let customPromptTemplate = """
Reformat the input message according to the given guidelines:
@ -65,18 +31,7 @@ enum AIPrompts {
- Help resolve unclear references
- Ignore unrelated clipboard content
3. Word Replacements:
IMPORTANT: Only apply replacements if specific words are provided
- Skip any replacement activity if no replacement options are available
- When replacements are provided:
- Replace ONLY exact matches of the specified words/phrases
- Do NOT replace partial matches or similar words
- Apply replacements before other enhancements
- Maintain case sensitivity when applying replacements
- Preserve the flow and readability of the text
- Make sure the replacements are not breaking the sentence structure and punctuations
4. Examples:
3. Examples:
- Follow the correction patterns shown in examples
- Match the formatting style of similar texts
- Use consistent terminology with examples