Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Sources/Services/SpeechToTextService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,16 @@ internal class SpeechToTextService {

let transcriptionURL = openAITranscriptionEndpoint

// Get model name from UserDefaults, defaulting to "whisper-1"
let modelName = UserDefaults.standard.string(forKey: "openAIModel")?.trimmingCharacters(in: .whitespacesAndNewlines)
let model = (modelName?.isEmpty == false) ? modelName! : "whisper-1"

return try await withCheckedThrowingContinuation { continuation in
AF.upload(
multipartFormData: { multipartFormData in
multipartFormData.append(audioURL, withName: "file")
// Azure deployments already specify the model, but it doesn't hurt to include
multipartFormData.append("whisper-1".data(using: .utf8)!, withName: "model")
// Use configured model or default to whisper-1
multipartFormData.append(model.data(using: .utf8)!, withName: "model")
},
to: transcriptionURL,
headers: headers
Expand Down
22 changes: 21 additions & 1 deletion Sources/Views/Dashboard/DashboardProvidersView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ internal struct DashboardProvidersView: View {
@AppStorage("hasSetupParakeet") var hasSetupParakeet = false
@AppStorage("hasSetupLocalLLM") var hasSetupLocalLLM = false
@AppStorage("openAIBaseURL") var openAIBaseURL = ""
@AppStorage("openAIModel") var openAIModel = "whisper-1"
@AppStorage("geminiBaseURL") var geminiBaseURL = ""
@AppStorage("maxModelStorageGB") var maxModelStorageGB = 5.0

Expand Down Expand Up @@ -784,7 +785,26 @@ internal struct DashboardProvidersView: View {
.stroke(DashboardTheme.rule, lineWidth: 1)
)
}


VStack(alignment: .leading, spacing: DashboardTheme.Spacing.xs) {
Text("OpenAI Model")
.font(DashboardTheme.Fonts.sans(11, weight: .medium))
.foregroundStyle(DashboardTheme.inkMuted)

TextField("whisper-1", text: $openAIModel)
.textFieldStyle(.plain)
.font(DashboardTheme.Fonts.mono(12, weight: .regular))
.padding(DashboardTheme.Spacing.sm)
.background(
RoundedRectangle(cornerRadius: 4)
.fill(DashboardTheme.pageBg)
)
.overlay(
RoundedRectangle(cornerRadius: 4)
.stroke(DashboardTheme.rule, lineWidth: 1)
)
}

VStack(alignment: .leading, spacing: DashboardTheme.Spacing.xs) {
Text("Gemini")
.font(DashboardTheme.Fonts.sans(11, weight: .medium))
Expand Down