Skip to content

Commit

Permalink
Fixed keyboard overlapping of settings items
Browse files Browse the repository at this point in the history
  • Loading branch information
guinmoon committed Nov 19, 2024
1 parent 7794bfa commit eb5aca2
Show file tree
Hide file tree
Showing 5 changed files with 291 additions and 283 deletions.
4 changes: 2 additions & 2 deletions LLMFarm.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 12;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_ASSET_PATHS = "\"LLMFarm/Preview Content\"";
DEVELOPMENT_TEAM = C66ZA422A7;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down Expand Up @@ -1036,7 +1036,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 12;
CURRENT_PROJECT_VERSION = 14;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_ASSET_PATHS = "\"LLMFarm/Preview Content\"";
DEVELOPMENT_TEAM = C66ZA422A7;
Expand Down
1 change: 1 addition & 0 deletions LLMFarm/Settings/ChatSettings/BasicSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ struct BasicSettingsView: View {


var body: some View {

HStack{

Picker("", selection: $model_icon) {
Expand Down
111 changes: 57 additions & 54 deletions LLMFarm/Settings/ChatSettings/ChatSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ struct ChatSettingsView: View {
HStack(spacing: 0){

ChatSettingTabs(index:$tabIndex,edit_chat_dialog:$edit_chat_dialog)
.edgesIgnoringSafeArea(.all)
// now were going to create main view....

GeometryReader{ g in
Expand All @@ -464,59 +465,61 @@ struct ChatSettingsView: View {
// changing tabs based on tabs...
switch tabIndex{
case 0:
GroupBox(label:
// Label("Basic Settings", systemImage: "building.columns")
Text("Basic Settings")
) {
BasicSettingsView(chat_title: $chat_title,
model_icon: $chat_icon,
model_icons: $chat_icons,
model_inferences: $model_inferences,
ggjt_v3_inferences: $ggjt_v3_inferences,
model_inference: $model_inference,
ggjt_v3_inference: $ggjt_v3_inference,
model_inference_inner: $model_inference_inner,
model_settings_template: $chat_settings_template,
model_setting_templates: $chat_setting_templates,
applying_template: $applying_template,
apply_setting_template: apply_setting_template)
}
GroupBox(label:
Text("Model")
) {
ModelSettingsView(model_file_url: $model_file_url,
model_file_path: $model_file_path,
model_title: $chat_title,
clip_model_file_url: $clip_model_file_url,
clip_model_file_path: $clip_model_file_path,
clip_model_title: $clip_model_title,
lora_file_url: $lora_file_url,
lora_file_path: $lora_file_path,
lora_title: $lora_title,
lora_file_scale: $lora_file_scale,
add_chat_dialog: $add_chat_dialog,
edit_chat_dialog: $edit_chat_dialog,
toggleSettings: $toggleSettings,
models_previews: $models_previews,
loras_previews: $loras_previews,
has_lora: $has_lora,
has_clip: $has_clip)
}
GroupBox(label:
Text("Prediction settings")
) {
PredictionSettingsView(model_context: $model_context,
model_n_batch: $model_n_batch,
n_predict: $n_predict,
numberOfThreads: $numberOfThreads,
use_metal: $use_metal,
use_clip_metal: $use_clip_metal,
mlock: $mlock,
mmap: $mmap,
flash_attn: $flash_attn,
model_inference: $model_inference,
model_inference_inner: $model_inference_inner,
has_clip: $has_clip)
ScrollView{
GroupBox(label:
// Label("Basic Settings", systemImage: "building.columns")
Text("Basic Settings")
) {
BasicSettingsView(chat_title: $chat_title,
model_icon: $chat_icon,
model_icons: $chat_icons,
model_inferences: $model_inferences,
ggjt_v3_inferences: $ggjt_v3_inferences,
model_inference: $model_inference,
ggjt_v3_inference: $ggjt_v3_inference,
model_inference_inner: $model_inference_inner,
model_settings_template: $chat_settings_template,
model_setting_templates: $chat_setting_templates,
applying_template: $applying_template,
apply_setting_template: apply_setting_template)
}
GroupBox(label:
Text("Model")
) {
ModelSettingsView(model_file_url: $model_file_url,
model_file_path: $model_file_path,
model_title: $chat_title,
clip_model_file_url: $clip_model_file_url,
clip_model_file_path: $clip_model_file_path,
clip_model_title: $clip_model_title,
lora_file_url: $lora_file_url,
lora_file_path: $lora_file_path,
lora_title: $lora_title,
lora_file_scale: $lora_file_scale,
add_chat_dialog: $add_chat_dialog,
edit_chat_dialog: $edit_chat_dialog,
toggleSettings: $toggleSettings,
models_previews: $models_previews,
loras_previews: $loras_previews,
has_lora: $has_lora,
has_clip: $has_clip)
}
GroupBox(label:
Text("Prediction settings")
) {
PredictionSettingsView(model_context: $model_context,
model_n_batch: $model_n_batch,
n_predict: $n_predict,
numberOfThreads: $numberOfThreads,
use_metal: $use_metal,
use_clip_metal: $use_clip_metal,
mlock: $mlock,
mmap: $mmap,
flash_attn: $flash_attn,
model_inference: $model_inference,
model_inference_inner: $model_inference_inner,
has_clip: $has_clip)
}
}
case 1:
PromptSettingsView(prompt_format: $prompt_format,
Expand Down Expand Up @@ -589,7 +592,7 @@ struct ChatSettingsView: View {
#endif
}
}
.edgesIgnoringSafeArea(.all)
// .edgesIgnoringSafeArea(.all)
}
}

Expand Down
146 changes: 74 additions & 72 deletions LLMFarm/Settings/ChatSettings/PromptSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,85 +19,87 @@ struct PromptSettingsView: View {
@Binding var model_inference:String

var body: some View {
GroupBox(label:
Text("Prompt Format")
) {
VStack {
// Text("Format:")
// .frame(maxWidth: .infinity, alignment: .leading)
TextEditor(text: $prompt_format)
.frame(minHeight: 30)
// TextField("prompt..", text: $prompt_format, axis: .vertical)
// .lineLimit(2)
// .textFieldStyle(.roundedBorder)
// .frame( alignment: .leading)
// .multilineTextAlignment(.trailing)
// .textFieldStyle(.plain)
}
.padding(.top, 8)
.padding(.horizontal, 1)
}.frame(minHeight: 200)

GroupBox(label:
Text("Options")
) {
VStack {
Text("Reverse prompts:")
.frame(maxWidth: .infinity, alignment: .leading)
ScrollView{
GroupBox(label:
Text("Prompt Format")
) {
VStack {
// Text("Format:")
// .frame(maxWidth: .infinity, alignment: .leading)
TextEditor(text: $prompt_format)
.frame(minHeight: 30)
// TextField("prompt..", text: $prompt_format, axis: .vertical)
// .lineLimit(2)
// .textFieldStyle(.roundedBorder)
// .frame( alignment: .leading)
// .multilineTextAlignment(.trailing)
// .textFieldStyle(.plain)
}
.padding(.top, 8)
.padding(.horizontal, 1)
}.frame(minHeight: 200)

GroupBox(label:
Text("Options")
) {
VStack {
Text("Reverse prompts:")
.frame(maxWidth: .infinity, alignment: .leading)
#if os(macOS)
DidEndEditingTextField(text: $reverse_prompt, didEndEditing: { newName in})
.frame( alignment: .leading)
DidEndEditingTextField(text: $reverse_prompt, didEndEditing: { newName in})
.frame( alignment: .leading)
#else
TextField("prompt..", text: $reverse_prompt, axis: .vertical)
.lineLimit(2)
.textFieldStyle(.roundedBorder)
.frame( alignment: .leading)
TextField("prompt..", text: $reverse_prompt, axis: .vertical)
.lineLimit(2)
.textFieldStyle(.roundedBorder)
.frame( alignment: .leading)
#endif
// .multilineTextAlignment(.trailing)
// .textFieldStyle(.plain)
}
.padding(.top, 8)
.padding(.horizontal, 5)

VStack {
Text("Skip tokens:")
.frame(maxWidth: .infinity, alignment: .leading)
// .multilineTextAlignment(.trailing)
// .textFieldStyle(.plain)
}
.padding(.top, 8)
.padding(.horizontal, 5)
VStack {
Text("Skip tokens:")
.frame(maxWidth: .infinity, alignment: .leading)
#if os(macOS)
DidEndEditingTextField(text: $skip_tokens, didEndEditing: { newName in})
.frame( alignment: .leading)
DidEndEditingTextField(text: $skip_tokens, didEndEditing: { newName in})
.frame( alignment: .leading)
#else
TextField("prompt..", text: $skip_tokens, axis: .vertical)
.lineLimit(2)
.textFieldStyle(.roundedBorder)
.frame( alignment: .leading)
TextField("prompt..", text: $skip_tokens, axis: .vertical)
.lineLimit(2)
.textFieldStyle(.roundedBorder)
.frame( alignment: .leading)
#endif
// .multilineTextAlignment(.trailing)
// .textFieldStyle(.plain)
}
.padding(.top, 8)
.padding(.horizontal, 5)

HStack {
Toggle("Special", isOn: $parse_special_tokens)
.frame(maxWidth: 120, alignment: .trailing)
.disabled(model_inference != "llama" )
Spacer()
}
.padding(.horizontal, 5)
.padding(.bottom, 4)

HStack {
Toggle("BOS", isOn: $add_bos_token)
.frame(maxWidth: 120, alignment: .trailing)
Toggle("EOS", isOn: $add_eos_token)
.frame(maxWidth: 120, alignment: .trailing)
Spacer()
}
.padding(.horizontal, 5)
.padding(.bottom, 4)

Divider()
// .multilineTextAlignment(.trailing)
// .textFieldStyle(.plain)
}
.padding(.top, 8)
.padding(.horizontal, 5)

HStack {
Toggle("Special", isOn: $parse_special_tokens)
.frame(maxWidth: 120, alignment: .trailing)
.disabled(model_inference != "llama" )
Spacer()
}
.padding(.horizontal, 5)
.padding(.bottom, 4)

HStack {
Toggle("BOS", isOn: $add_bos_token)
.frame(maxWidth: 120, alignment: .trailing)
Toggle("EOS", isOn: $add_eos_token)
.frame(maxWidth: 120, alignment: .trailing)
Spacer()
}
.padding(.horizontal, 5)
.padding(.bottom, 4)

Divider()
.padding(.top, 8)
}
}
}
}
Expand Down
Loading

0 comments on commit eb5aca2

Please sign in to comment.