Skip to content

Commit

Permalink
learn more links and UI tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrozanski committed Apr 10, 2023
1 parent b51e7f6 commit 5f2b16f
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct SourcesSettingsListView: View {
}
.frame(maxWidth: .infinity)
Divider()
.foregroundColor(Color(NSColor.separatorColor.cgColor))
.foregroundColor(Color(nsColor: NSColor.separatorColor))
}
}

Expand Down
2 changes: 1 addition & 1 deletion LlamaChat/ui/sources/AddSourceContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ struct AddSourceContentView: View {
}
}
}
.frame(width: 600, height: 400)
.frame(width: 620, height: 430)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct ConfigureLocalModelSelectFormatView: View {
Section {
Picker("Format", selection: sourceTypeBinding) {
Text("Select Format")
.foregroundColor(Color(NSColor.disabledControlTextColor.cgColor))
.foregroundColor(Color(nsColor: NSColor.disabledControlTextColor))
.tag(ConfigureLocalModelSourceType?(nil))
ForEach(ConfigureLocalModelSourceType.allCases) { source in
Text(source.label).tag(ConfigureLocalModelSourceType?(source))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct ConfigureLocalModelSizePickerView: View {
)
Picker("Model Size", selection: modelTypeBinding) {
Text(viewModel.label(for: .unknown))
.foregroundColor(unknownModelSizeAppearance.isDisabled ? Color(NSColor.disabledControlTextColor.cgColor) : nil)
.foregroundColor(unknownModelSizeAppearance.isDisabled ? Color(nsColor: NSColor.disabledControlTextColor) : nil)
.tag(ModelSize.unknown)
if !unknownModelSizeAppearance.isDisabled {
Divider()
Expand Down
17 changes: 17 additions & 0 deletions LlamaChat/ui/sources/type/SourceTypeSelectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@ struct SourceTypeSelectionRow: View {
Text(source.name)
.fontWeight(.bold)
Text(source.description)
if let learnMoreLink = source.learnMoreLink {
Text("Learn More")
.font(.footnote)
.foregroundColor(.blue)
.underline()
.onHover { isHovered in
// TODO: Use cursor rects to make this more robust.
if isHovered {
NSCursor.pointingHand.set()
} else {
NSCursor.arrow.set()
}
}
.onTapGesture {
NSWorkspace.shared.open(learnMoreLink)
}
}
}
.padding()
Spacer()
Expand Down
14 changes: 9 additions & 5 deletions LlamaChat/viewmodel/sources/SelectSourceTypeViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import Foundation
class SelectSourceTypeViewModel: ObservableObject {
typealias SelectSourceHandler = (ChatSourceType) -> Void

struct Source: Equatable {
struct Source {
let id: String
let type: ChatSourceType
let name: String
let description: String
let learnMoreLink: URL?
}

@Published var sources: [Source]
Expand All @@ -32,22 +33,25 @@ class SelectSourceTypeViewModel: ObservableObject {
return Source(
id: type.rawValue,
type: type,
name: "Llama",
description: "The OG Facebook LLaMA model"
name: "LLaMA",
description: "The original Facebook LLaMA Large Language Model",
learnMoreLink: URL(string: "https://github.com/facebookresearch/llama")
)
case .alpaca:
return Source(
id: type.rawValue,
type: type,
name: "Alpaca",
description: "Stanford's Alpaca model: a fine-tuned instruction-following LLaMA model"
description: "Stanford's Alpaca model: a fine-tuned instruction-following LLaMA model",
learnMoreLink: URL(string: "https://github.com/tatsu-lab/stanford_alpaca")
)
case .gpt4All:
return Source(
id: type.rawValue,
type: type,
name: "GPT4All",
description: "Nomic AI's assistant-style LLM based on LLaMA"
description: "Nomic AI's assistant-style LLM based on LLaMA",
learnMoreLink: URL(string: "https://github.com/nomic-ai/gpt4all")
)
}
}
Expand Down

0 comments on commit 5f2b16f

Please sign in to comment.