Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

Fix build issues

grohith32747bc9f09d112
diff --git a/Sources/Fluid/Networking/FunctionCallingProvider.swift b/Sources/Fluid/Networking/FunctionCallingProvider.swift
index f81dd49d..0a96bec7 100644
--- a/Sources/Fluid/Networking/FunctionCallingProvider.swift
+++ b/Sources/Fluid/Networking/FunctionCallingProvider.swift
@@ -20,6 +20,14 @@ final class FunctionCallingProvider {
let tool_call_id: String?
let name: String?
+ enum CodingKeys: String, CodingKey {
+ case role
+ case content
+ case tool_calls
+ case tool_call_id
+ case name
+ }
+
init(
role: String,
content: String?,
@@ -218,8 +226,7 @@ final class FunctionCallingProvider {
let body = ChatRequest(
model: model,
messages: messages,
- temperature: isReasoningModel ? nil : 0.2, // Don't send temperature for reasoning models
- tools: tools,
+ temperature: isReasoningModel ? nil : 0.2,
tools: tools,
tool_choice: tools.isEmpty ? nil : "auto"
)
@@ -280,7 +287,8 @@ final class FunctionCallingProvider {
let message = choice.message
// Check if LLM wants to call tools
- if let toolCalls = message.tool_calls, !toolCalls.isEmpty {
+ let toolCalls = message.tool_calls
+ if toolCalls.isEmpty == false {
DebugLogger.shared.info(
"🎯 LLM decided to call \(toolCalls.count) tools",
source: "FunctionCallingProvider"
@@ -362,8 +370,8 @@ final class FunctionCallingProvider {
let body = ChatRequest(
model: model,
messages: messages,
- temperature: isReasoningModel ? nil : 0.2, // Don't send temperature for reasoning models
- tools: nil,
+ temperature: isReasoningModel ? nil : 0.2,
+ tools: [],
tool_choice: nil
)
@@ -400,7 +408,8 @@ final class FunctionCallingProvider {
// If the model tries to call tools again despite tool_choice being "none",
// just extract the text content or return a generic message
- if let toolCalls = choice.message.tool_calls, !toolCalls.isEmpty {
+ let toolCalls = choice.message.tool_calls
+ if !toolCalls.isEmpty {
DebugLogger.shared
.warning(
"Model tried to call tools in final response (tool_choice was 'none'). Ignoring tool calls.",
diff --git a/Sources/Fluid/Services/TextSelectionService.swift b/Sources/Fluid/Services/TextSelectionService.swift
index 425b3052..eededbd1 100644
--- a/Sources/Fluid/Services/TextSelectionService.swift
+++ b/Sources/Fluid/Services/TextSelectionService.swift
@@ -47,8 +47,9 @@ final class TextSelectionService {
&focusedElement
)
- if result == .success, let element = focusedElement as? AXUIElement {
- return element
+ if result == .success, let focusedElement {
+ guard CFGetTypeID(focusedElement) == AXUIElementGetTypeID() else { return nil }
+ return unsafeBitCast(focusedElement, to: AXUIElement.self)
}
return nil
@@ -62,8 +63,9 @@ final class TextSelectionService {
&focusedElement
)
- if result == .success, let element = focusedElement as? AXUIElement {
- return element
+ if result == .success, let focusedElement {
+ guard CFGetTypeID(focusedElement) == AXUIElementGetTypeID() else { return nil }
+ return unsafeBitCast(focusedElement, to: AXUIElement.self)
}
return nil
diff --git a/Sources/Fluid/Services/TypingService.swift b/Sources/Fluid/Services/TypingService.swift
index 6c9fad2a..b3f018c6 100644
--- a/Sources/Fluid/Services/TypingService.swift
+++ b/Sources/Fluid/Services/TypingService.swift
@@ -156,8 +156,9 @@ final class TypingService {
&focusedElement
)
- if result == .success, let element = focusedElement as? AXUIElement {
- let axElement = element
+ if result == .success, let focusedElement {
+ guard CFGetTypeID(focusedElement) == AXUIElementGetTypeID() else { return nil }
+ let axElement = unsafeBitCast(focusedElement, to: AXUIElement.self)
if let role = getElementAttribute(axElement, kAXRoleAttribute as CFString) {
log("[TypingService] Found focused element with role: \(role)")
return axElement
@@ -218,8 +219,9 @@ final class TypingService {
&focusedElement
)
- if result == .success, let element = focusedElement as? AXUIElement {
- let axElement = element
+ if result == .success, let focusedElement {
+ guard CFGetTypeID(focusedElement) == AXUIElementGetTypeID() else { return nil }
+ let axElement = unsafeBitCast(focusedElement, to: AXUIElement.self)
if let role = getElementAttribute(axElement, kAXRoleAttribute as CFString) {
log("[TypingService] Found app-level focused element with role: \(role)")
return axElement
diff --git a/Sources/Fluid/UI/MeetingTranscriptionView.swift b/Sources/Fluid/UI/MeetingTranscriptionView.swift
index beb32778..c9cc830d 100644
--- a/Sources/Fluid/UI/MeetingTranscriptionView.swift
+++ b/Sources/Fluid/UI/MeetingTranscriptionView.swift
@@ -371,7 +371,7 @@ struct TranscriptionDocument: FileDocument {
}
init(configuration: ReadConfiguration) throws {
- throw CocoaError(.fileReadUnsupported)
+ throw CocoaError(.fileReadUnknown)
}
func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper {