From 90eea0e2235b0df1b16660d7f3dc0afabfa4d6e3 Mon Sep 17 00:00:00 2001 From: Beingpax Date: Sat, 24 May 2025 13:30:12 +0545 Subject: [PATCH] Fix UI for OllamaModel list --- VoiceInk.xcodeproj/project.pbxproj | 8 +-- VoiceInk/Views/APIKeyManagementView.swift | 60 +++-------------------- 2 files changed, 11 insertions(+), 57 deletions(-) diff --git a/VoiceInk.xcodeproj/project.pbxproj b/VoiceInk.xcodeproj/project.pbxproj index 8322baf..2442f26 100644 --- a/VoiceInk.xcodeproj/project.pbxproj +++ b/VoiceInk.xcodeproj/project.pbxproj @@ -448,7 +448,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 128; + CURRENT_PROJECT_VERSION = 129; DEVELOPMENT_ASSET_PATHS = "\"VoiceInk/Preview Content\""; DEVELOPMENT_TEAM = V6J6A3VWY2; ENABLE_HARDENED_RUNTIME = YES; @@ -463,7 +463,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 14.0; - MARKETING_VERSION = 1.28; + MARKETING_VERSION = 1.29; PRODUCT_BUNDLE_IDENTIFIER = com.prakashjoshipax.VoiceInk; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -481,7 +481,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 128; + CURRENT_PROJECT_VERSION = 129; DEVELOPMENT_ASSET_PATHS = "\"VoiceInk/Preview Content\""; DEVELOPMENT_TEAM = V6J6A3VWY2; ENABLE_HARDENED_RUNTIME = YES; @@ -496,7 +496,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 14.0; - MARKETING_VERSION = 1.28; + MARKETING_VERSION = 1.29; PRODUCT_BUNDLE_IDENTIFIER = com.prakashjoshipax.VoiceInk; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; diff --git a/VoiceInk/Views/APIKeyManagementView.swift b/VoiceInk/Views/APIKeyManagementView.swift index f03091c..65bc0aa 100644 --- a/VoiceInk/Views/APIKeyManagementView.swift +++ b/VoiceInk/Views/APIKeyManagementView.swift @@ -165,62 +165,16 @@ struct APIKeyManagementView: View { .background(Color.orange.opacity(0.1)) .cornerRadius(8) } else { - ScrollView(.horizontal, showsIndicators: false) { - HStack(spacing: 12) { + Picker("", selection: $selectedOllamaModel) { ForEach(ollamaModels) { model in - VStack(alignment: .leading, spacing: 6) { - // Model Name and Status - HStack { - Text(model.name) - .font(.subheadline) - .bold() - - if model.name == selectedOllamaModel { - Image(systemName: "checkmark.circle.fill") - .foregroundColor(.green) - } - } - - // Model Details - VStack(alignment: .leading, spacing: 4) { - // Parameters - HStack(spacing: 4) { - Image(systemName: "cpu.fill") - .font(.caption2) - Text(model.details.parameter_size) - .font(.caption2) - } - .foregroundColor(.secondary) - - // Size - HStack(spacing: 4) { - Image(systemName: "externaldrive.fill") - .font(.caption2) - Text(formatSize(model.size)) - .font(.caption2) - } - .foregroundColor(.secondary) - } - } - .padding(12) - .frame(minWidth: 140) - .background( - RoundedRectangle(cornerRadius: 8) - .fill(model.name == selectedOllamaModel ? Color.accentColor.opacity(0.1) : Color.secondary.opacity(0.05)) - .overlay( - RoundedRectangle(cornerRadius: 8) - .stroke(model.name == selectedOllamaModel ? Color.accentColor : Color.clear, lineWidth: 1) - ) - ) - .onTapGesture { - selectedOllamaModel = model.name - aiService.updateSelectedOllamaModel(model.name) - } - } + Text(model.name).tag(model.name) } - .padding(.horizontal, 4) // Add padding for the first and last items - .padding(.vertical, 4) } + .onChange(of: selectedOllamaModel) { oldValue, newValue in + aiService.updateSelectedOllamaModel(newValue) + } + .labelsHidden() + .frame(maxWidth: .infinity) } // Refresh Button