Skip to content

Commit

Permalink
20240409
Browse files Browse the repository at this point in the history
  • Loading branch information
zhang-hongshen committed Apr 9, 2024
1 parent ea50dcc commit 2a025a2
Show file tree
Hide file tree
Showing 13 changed files with 429 additions and 211 deletions.
36 changes: 22 additions & 14 deletions ModelCraft.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
70271B3A2BC0455000E21A6E /* ollama in CopyFiles */ = {isa = PBXBuildFile; fileRef = 70271B382BC0452C00E21A6E /* ollama */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
70271B3C2BC046F300E21A6E /* KnowledgaBaseModelActor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70271B3B2BC046F300E21A6E /* KnowledgaBaseModelActor.swift */; };
70271B5E2BC1A97900E21A6E /* ModelStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70271B5D2BC1A97900E21A6E /* ModelStore.swift */; };
70271B782BC4412E00E21A6E /* SpeechRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70271B772BC4412E00E21A6E /* SpeechRecognizer.swift */; };
703422112BB6A38C00332E04 /* OllamaKit in Frameworks */ = {isa = PBXBuildFile; productRef = 703422102BB6A38C00332E04 /* OllamaKit */; };
703845832BB6674600E3128B /* Locale+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 703845822BB6674600E3128B /* Locale+.swift */; };
7041EA702BB2AACB00286AE3 /* EnvironmentValues+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7041EA6F2BB2AACB00286AE3 /* EnvironmentValues+.swift */; };
Expand Down Expand Up @@ -110,6 +111,7 @@
70271B382BC0452C00E21A6E /* ollama */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = ollama; sourceTree = "<group>"; };
70271B3B2BC046F300E21A6E /* KnowledgaBaseModelActor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KnowledgaBaseModelActor.swift; sourceTree = "<group>"; };
70271B5D2BC1A97900E21A6E /* ModelStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModelStore.swift; sourceTree = "<group>"; };
70271B772BC4412E00E21A6E /* SpeechRecognizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpeechRecognizer.swift; sourceTree = "<group>"; };
703845822BB6674600E3128B /* Locale+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Locale+.swift"; sourceTree = "<group>"; };
7041EA6F2BB2AACB00286AE3 /* EnvironmentValues+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EnvironmentValues+.swift"; sourceTree = "<group>"; };
7041EA712BB2AC8D00286AE3 /* ServerStatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerStatusView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -205,6 +207,20 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
70271B792BC4E2CC00E21A6E /* Models */ = {
isa = PBXGroup;
children = (
70C22FC72BAECD55002754C7 /* Default.swift */,
70E201842BAEC08900CFE1D7 /* SplashCodeSyntaxHighlighter.swift */,
70E201862BAEC0C700CFE1D7 /* TextOutputFormat.swift */,
70B13D032BBB1F3300A42F3C /* XMLFile.swift */,
70CE4D282BB83BF500E1DEE2 /* Pasteboard.swift */,
70271B3B2BC046F300E21A6E /* KnowledgaBaseModelActor.swift */,
70271B772BC4412E00E21A6E /* SpeechRecognizer.swift */,
);
path = Models;
sourceTree = "<group>";
};
706D729D2BB6B076004ACF35 /* Services */ = {
isa = PBXGroup;
children = (
Expand All @@ -231,13 +247,6 @@
path = SwiftData;
sourceTree = "<group>";
};
7097F9672BB0234E001A91E3 /* Utils */ = {
isa = PBXGroup;
children = (
);
path = Utils;
sourceTree = "<group>";
};
70A574AE2BB0997A008E3750 /* Views */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -371,21 +380,15 @@
70CE606F2BAD2D4600A2D0B0 /* ModelCraft.entitlements */,
7045BF462BB3FE0A00CE61D1 /* Info.plist */,
70CE60692BAD2D4500A2D0B0 /* ContentView.swift */,
70C22FC72BAECD55002754C7 /* Default.swift */,
70CE60672BAD2D4500A2D0B0 /* ModelCraftApp.swift */,
70CE4D282BB83BF500E1DEE2 /* Pasteboard.swift */,
70E201842BAEC08900CFE1D7 /* SplashCodeSyntaxHighlighter.swift */,
70E201862BAEC0C700CFE1D7 /* TextOutputFormat.swift */,
70B13D032BBB1F3300A42F3C /* XMLFile.swift */,
70CE606D2BAD2D4600A2D0B0 /* Assets.xcassets */,
70A574A92BB07264008E3750 /* Localizable.xcstrings */,
70C22FD52BAFD1AA002754C7 /* Components */,
70CE609A2BAD302000A2D0B0 /* Extension */,
70CE60C92BAD7A4700A2D0B0 /* Features */,
70271B792BC4E2CC00E21A6E /* Models */,
70CE60702BAD2D4600A2D0B0 /* Preview Content */,
706D729D2BB6B076004ACF35 /* Services */,
7097F9672BB0234E001A91E3 /* Utils */,
70271B3B2BC046F300E21A6E /* KnowledgaBaseModelActor.swift */,
);
path = ModelCraft;
sourceTree = "<group>";
Expand Down Expand Up @@ -660,6 +663,7 @@
7045BF452BB314E700CE61D1 /* Bundle+.swift in Sources */,
70B13D152BBC678400A42F3C /* KnowledgeBaseDetailGridView.swift in Sources */,
70C22FE92BAFD5CA002754C7 /* ImageButton.swift in Sources */,
70271B782BC4412E00E21A6E /* SpeechRecognizer.swift in Sources */,
70CE4D312BB9500000E1DEE2 /* KnowledgeBaseDetailView.swift in Sources */,
70CE60682BAD2D4500A2D0B0 /* ModelCraftApp.swift in Sources */,
);
Expand Down Expand Up @@ -833,6 +837,8 @@
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = ModelCraft/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "The app wants to access your microphone.";
INFOPLIST_KEY_NSSpeechRecognitionUsageDescription = "You can chat with models in the app.";
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
Expand Down Expand Up @@ -876,6 +882,8 @@
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = ModelCraft/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "The app wants to access your microphone.";
INFOPLIST_KEY_NSSpeechRecognitionUsageDescription = "You can chat with models in the app.";
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ extension KnowledgeBaseEdition {
extension KnowledgeBaseEdition {

func save() {
dismiss.callAsFunction()
dismiss()
Task {
await KnowledgaBaseModelActor(modelContainer: modelContext.container).insert(konwledgeBase)
}
Expand Down
11 changes: 11 additions & 0 deletions ModelCraft/Features/Model/LocalModelsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,23 @@ struct LocalModelsView: View {
sort: \ModelTask.createdAt,
order: .reverse)
private var deleteTasks: [ModelTask] = []
@Query(filter: ModelTask.predicateByType(.download),
sort: \ModelTask.createdAt,
order: .reverse)
private var downloadTasks: [ModelTask] = []

var body: some View {
List(selection: $selectedModelNames) {
ForEach(models, id: \.name) { model in
ListCell(model).tag(model.name)
}
ForEach(downloadTasks) { task in
HStack{
Label(task.modelName, systemImage: "shippingbox")
Spacer()
ModelDownloadProgress(task: task)
}.tag(task)
}.foregroundStyle(.secondary)
}
.contextMenu {
DeleteButton(action: { confirmationDialogPresented = true })
Expand Down
1 change: 1 addition & 0 deletions ModelCraft/Features/Model/ModelDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ extension ModelDetailView {
Button("Refresh", systemImage: "arrow.triangle.2.circlepath") {
fetchModels()
}

}
}
}
Expand Down
Loading

0 comments on commit 2a025a2

Please sign in to comment.