Skip to content

Commit

Permalink
Added transcription, added search result optimization, fixed lengthy …
Browse files Browse the repository at this point in the history
…task popover, fixed Chinese, Simplified translations
  • Loading branch information
johnbean393 committed Oct 19, 2024
1 parent 8b047db commit 7384622
Show file tree
Hide file tree
Showing 14 changed files with 544 additions and 34 deletions.
12 changes: 12 additions & 0 deletions Sidekick.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
20A8B6592CB26E4800B756FD /* SimilaritySearchKitDistilbert in Frameworks */ = {isa = PBXBuildFile; productRef = 20A8B6582CB26E4800B756FD /* SimilaritySearchKitDistilbert */; };
20A8B65B2CB2709100B756FD /* Resources.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20A8B65A2CB2709100B756FD /* Resources.swift */; };
20A8B65D2CB2829500B756FD /* ProfileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20A8B65C2CB2829500B756FD /* ProfileManager.swift */; };
20B4D6AF2CC3C12C00817E15 /* SpeechRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20B4D6AE2CC3C12C00817E15 /* SpeechRecognizer.swift */; };
20B4D6B12CC3D72700817E15 /* Extension+IndexItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20B4D6B02CC3D72700817E15 /* Extension+IndexItem.swift */; };
20B97CA82CAFE830009A0A5D /* FSKit-macOS in Frameworks */ = {isa = PBXBuildFile; productRef = 20B97CA72CAFE830009A0A5D /* FSKit-macOS */; };
20B97CAB2CAFE861009A0A5D /* ExtractKit-macOS in Frameworks */ = {isa = PBXBuildFile; productRef = 20B97CAA2CAFE861009A0A5D /* ExtractKit-macOS */; };
20B97CB32CAFE86C009A0A5D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 20B97CAC2CAFE86C009A0A5D /* Preview Assets.xcassets */; };
Expand Down Expand Up @@ -223,6 +225,8 @@
2099BDB12CB828A500E02732 /* PopoverButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopoverButton.swift; sourceTree = "<group>"; };
20A8B65A2CB2709100B756FD /* Resources.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Resources.swift; sourceTree = "<group>"; };
20A8B65C2CB2829500B756FD /* ProfileManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileManager.swift; sourceTree = "<group>"; };
20B4D6AE2CC3C12C00817E15 /* SpeechRecognizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpeechRecognizer.swift; sourceTree = "<group>"; };
20B4D6B02CC3D72700817E15 /* Extension+IndexItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+IndexItem.swift"; sourceTree = "<group>"; };
20B97CAC2CAFE86C009A0A5D /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
20B97CAE2CAFE86C009A0A5D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
20B97CAF2CAFE86C009A0A5D /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -540,6 +544,7 @@
20B97CEA2CB00912009A0A5D /* Extension+URL.swift */,
204C79572CB769A400EED58E /* Extension+View.swift */,
208388EE2CBF86A100C2A9F8 /* Extension+UserDefaults.swift */,
20B4D6B02CC3D72700817E15 /* Extension+IndexItem.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -613,6 +618,7 @@
2004D7632CBC9DA2009F294E /* ConversationState.swift */,
20571F6E2CBCE8F7004F3344 /* TasksController.swift */,
208388D92CBF4DF500C2A9F8 /* TavilySearch.swift */,
20B4D6AE2CC3C12C00817E15 /* SpeechRecognizer.swift */,
);
path = "Data Models";
sourceTree = "<group>";
Expand Down Expand Up @@ -816,6 +822,7 @@
files = (
20573F362CB53878004C19FE /* CircleMenuStyle.swift in Sources */,
20571F842CBD71C9004F3344 /* SystemPromptEditor.swift in Sources */,
20B4D6B12CC3D72700817E15 /* Extension+IndexItem.swift in Sources */,
20FE94D82CB96D3A006E9F06 /* ConversationResourceButton.swift in Sources */,
20573F1F2CB5274E004C19FE /* MessagesView.swift in Sources */,
20B97CE72CB0066A009A0A5D /* Extension+String.swift in Sources */,
Expand Down Expand Up @@ -891,6 +898,7 @@
20B9E60E2CB1414100BA0AD2 /* DockMenuCommands.swift in Sources */,
20B9E6112CB142FD00BA0AD2 /* DebugCommands.swift in Sources */,
20573F252CB52EB6004C19FE /* CopyButton.swift in Sources */,
20B4D6AF2CC3C12C00817E15 /* SpeechRecognizer.swift in Sources */,
2099BDA32CB7EB0200E02732 /* CapsuleButtonStyle.swift in Sources */,
204C79562CB765D700EED58E /* ProfileSelectionMenu.swift in Sources */,
20A8B65B2CB2709100B756FD /* Resources.swift in Sources */,
Expand Down Expand Up @@ -1083,6 +1091,8 @@
INFOPLIST_FILE = Sidekick/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "Sidekick needs access to the microphone for transcription.";
INFOPLIST_KEY_NSSpeechRecognitionUsageDescription = "Sidekick needs access to speech recognition services for transcription.";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
Expand Down Expand Up @@ -1114,6 +1124,8 @@
INFOPLIST_FILE = Sidekick/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "Sidekick needs access to the microphone for transcription.";
INFOPLIST_KEY_NSSpeechRecognitionUsageDescription = "Sidekick needs access to speech recognition services for transcription.";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
Expand Down
34 changes: 34 additions & 0 deletions Sidekick/Extensions/Extension+IndexItem.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// Extension+IndexItem.swift
// Sidekick
//
// Created by Bean John on 10/19/24.
//

import Foundation
import SimilaritySearchKit

public extension IndexItem {

/// Computed property returning the result's source's URL
var sourceUrl: URL? {
guard let source: String = self.metadata["source"] else { return nil }
return URL(string: source)
}

/// Computed property returning the result's source's URL text
var sourceUrlText: String? {
if sourceUrl?.isWebURL ?? false {
return sourceUrl?.absoluteString
}
return sourceUrl?.posixPath
}


/// Computed property returning the result's source's index
var itemIndex: Int? {
guard let itemIndex: String = self.metadata["itemIndex"] else { return nil }
return Int(itemIndex)
}

}
5 changes: 3 additions & 2 deletions Sidekick/Extensions/Extension+SimilarityIndex.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ public extension SimilarityIndex {

/// Function to search similarity index
func search(
query: String
query: String,
maxResults: Int
) async -> [Sidekick.SearchResult] {
// Search
let results: [SimilaritySearchKit.SearchResult] = await self.search(
query,
top: 6,
top: maxResults,
metric: CosineSimilarity()
)
// Set similarity threshhold
Expand Down
11 changes: 5 additions & 6 deletions Sidekick/Info.plist
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>

120 changes: 120 additions & 0 deletions Sidekick/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,26 @@
}
}
},
"Controls the number of search results from profile resources fed to the chatbot. The more results, the slower the chatbot will respond." : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "控制输入​​到聊天机器人的个人资料资源的搜索结果数量。结果越多,聊天机器人的响应速度就越慢。"
}
}
}
},
"Controls whether context of a search result is given to the chatbot. Turning this on will reduce the number of search results, but will increase the length of each search result." : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "控制是否向聊天机器人提供搜索结果的上下文。启用此功能将使搜索结果数量减少,但每个搜索结果的长度将增加。"
}
}
}
},
"Controls whether this profile searches the web before answering. Note that when enabled, this feature may lead to slower responses." : {
"localizations" : {
"zh-Hans" : {
Expand Down Expand Up @@ -226,6 +246,16 @@
}
}
},
"Default" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "默认"
}
}
}
},
"Delete" : {
"localizations" : {
"zh-Hans" : {
Expand Down Expand Up @@ -457,6 +487,16 @@
}
}
},
"Less" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "偏少"
}
}
}
},
"Link or URL" : {
"localizations" : {
"zh-Hans" : {
Expand Down Expand Up @@ -523,6 +563,26 @@
}
}
},
"More" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "偏多"
}
}
}
},
"Most" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "最多"
}
}
}
},
"Name" : {
"localizations" : {
"zh-Hans" : {
Expand Down Expand Up @@ -663,6 +723,16 @@
}
}
},
"Processing..." : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "正在处理…"
}
}
}
},
"References:" : {
"localizations" : {
"zh-Hans" : {
Expand Down Expand Up @@ -703,6 +773,16 @@
}
}
},
"Resources Search" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "资源搜索"
}
}
}
},
"Resources: %lld" : {
"localizations" : {
"zh-Hans" : {
Expand Down Expand Up @@ -753,6 +833,46 @@
}
}
},
"Search Result Context" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "搜索结果上下文"
}
}
}
},
"Search Results" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "搜索结果"
}
}
}
},
"Searching in resources and on the web..." : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "正在资源中和网络上搜索…"
}
}
}
},
"Searching in resources..." : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "正在资源中搜索…"
}
}
}
},
"Select" : {
"localizations" : {
"zh-Hans" : {
Expand Down
Loading

0 comments on commit 7384622

Please sign in to comment.