Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion TypeaheadAI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
2BCF84352A9DD90F00359841 /* HistoryManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF84342A9DD90F00359841 /* HistoryManager.swift */; };
2BCF843A2A9DE6DA00359841 /* GeneralSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF84392A9DE6DA00359841 /* GeneralSettingsView.swift */; };
2BD3821E2B2C4B2E00F96C19 /* CanSimulateEnter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BD3821D2B2C4B2E00F96C19 /* CanSimulateEnter.swift */; };
2BD97C7E2B69FF57002570C1 /* WhisperKit in Frameworks */ = {isa = PBXBuildFile; productRef = 2BD97C7D2B69FF57002570C1 /* WhisperKit */; };
2BDA45C32ABEE840006128BC /* MessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDA45C22ABEE840006128BC /* MessageView.swift */; };
2BDDB9892B27DDE100D52BF0 /* SwiftSoup in Frameworks */ = {isa = PBXBuildFile; productRef = 2BDDB9882B27DDE100D52BF0 /* SwiftSoup */; };
2BDDB98B2B27DDFF00D52BF0 /* String+XMLMarkdown.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDDB98A2B27DDFF00D52BF0 /* String+XMLMarkdown.swift */; };
Expand Down Expand Up @@ -294,6 +295,7 @@
buildActionMask = 2147483647;
files = (
2B4BDB892ACBED2100E55D78 /* SettingsAccess in Frameworks */,
2BD97C7E2B69FF57002570C1 /* WhisperKit in Frameworks */,
2BA3C2352AADAC5700537F95 /* llama in Frameworks */,
2B473E8C2AA860380042913D /* MenuBarExtraAccess in Frameworks */,
2BFC51552B38DAB200F3E559 /* LaunchAtLogin in Frameworks */,
Expand Down Expand Up @@ -687,6 +689,7 @@
2BDDB9882B27DDE100D52BF0 /* SwiftSoup */,
2BFC51542B38DAB200F3E559 /* LaunchAtLogin */,
2B3FF5342B50B70F00D7BE49 /* Sparkle */,
2BD97C7D2B69FF57002570C1 /* WhisperKit */,
);
productName = TypeaheadAI;
productReference = 2BA7F0752A9ABBA8003D38BA /* TypeaheadAI.app */;
Expand Down Expand Up @@ -736,7 +739,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1430;
LastUpgradeCheck = 1500;
LastUpgradeCheck = 1520;
TargetAttributes = {
2BA7F0742A9ABBA8003D38BA = {
CreatedOnToolsVersion = 14.3.1;
Expand Down Expand Up @@ -775,6 +778,7 @@
2BDDB9872B27DDE100D52BF0 /* XCRemoteSwiftPackageReference "SwiftSoup" */,
2BFC51532B38DAB200F3E559 /* XCRemoteSwiftPackageReference "LaunchAtLogin-Modern" */,
2B3FF5332B50B70F00D7BE49 /* XCRemoteSwiftPackageReference "Sparkle" */,
2B5CA39E2B69ED350070E01C /* XCRemoteSwiftPackageReference "whisperkit" */,
);
productRefGroup = 2BA7F0762A9ABBA8003D38BA /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -973,6 +977,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
Expand Down Expand Up @@ -1035,6 +1040,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
Expand Down Expand Up @@ -1317,6 +1323,14 @@
minimumVersion = 1.2.0;
};
};
2B5CA39E2B69ED350070E01C /* XCRemoteSwiftPackageReference "whisperkit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/argmaxinc/whisperkit";
requirement = {
branch = main;
kind = branch;
};
};
2B8CD4BC2B0AB13B003E0589 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/kchro3/swift-markdown-ui";
Expand Down Expand Up @@ -1411,6 +1425,11 @@
package = 2BA7F0AC2A9ABC47003D38BA /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */;
productName = KeyboardShortcuts;
};
2BD97C7D2B69FF57002570C1 /* WhisperKit */ = {
isa = XCSwiftPackageProductDependency;
package = 2B5CA39E2B69ED350070E01C /* XCRemoteSwiftPackageReference "whisperkit" */;
productName = WhisperKit;
};
2BDDB9882B27DDE100D52BF0 /* SwiftSoup */ = {
isa = XCSwiftPackageProductDependency;
package = 2BDDB9872B27DDE100D52BF0 /* XCRemoteSwiftPackageReference "SwiftSoup" */;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion TypeaheadAI/Traits/CanSimulateDictation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
// Created by Jeff Hara on 1/19/24.
//

import Foundation
import AudioToolbox
import Carbon.HIToolbox
import Foundation

protocol CanSimulateDictation {
func simulateDictation() async throws
Expand Down
11 changes: 8 additions & 3 deletions TypeaheadAI/WindowManagers/ModalManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class ModalManager: ObservableObject, CanSimulateDictation {
await self.showModal()
}

try await Task.sleep(for: .milliseconds(100))
await NSApp.activate(ignoringOtherApps: true)
try await Task.sleep(for: .milliseconds(200))

Expand Down Expand Up @@ -379,8 +380,10 @@ class ModalManager: ObservableObject, CanSimulateDictation {
}

messages[idx].text += text
if text.contains("\n") {
let chunks = messages[idx].text.split(separator: "\n", omittingEmptySubsequences: true)
if text.contains("\n") || text.contains(" ") {
// let chunks = messages[idx].text.split(separator: "\n", omittingEmptySubsequences: true)
let chunks = messages[idx].text.components(separatedBy: .whitespacesAndNewlines).filter { !$0.isEmpty }
print(chunks)

if text.trimmingCharacters(in: .whitespaces).hasSuffix("\n") {
// Case: If text looks like "bcd\n ", then chunks will look like ["abc", "bcd"]
Expand Down Expand Up @@ -752,7 +755,9 @@ class ModalManager: ObservableObject, CanSimulateDictation {

if bufferedPayload.mode == .text, let text = bufferedPayload.text {

if let lastChunk = text.split(separator: "\n", omittingEmptySubsequences: true).last {

let components = text.components(separatedBy: CharacterSet.whitespacesAndNewlines).filter { !$0.isEmpty }
if let lastChunk = components.last {
speaker.speak(String(lastChunk), withCallback: true)
}

Expand Down