Handy/src-tauri/swift/apple_intelligence_bridge.h
Chirag Agggarwal bfecade869
Apple intel integration (#391)
* feat: add Apple Intelligence post-processing provider

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>

* feat: guide apple intelligence output

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>

* fix(build): add fallback stub for Apple Intelligence on older SDKs

- Checks if 'FoundationModels.framework' is present in the macOS SDK.
- If missing, compiles a stub Swift file that returns 'unavailable' errors instead of failing the build.
- Prevents build errors on older Xcode versions (or macOS versions < 26.0) where the macros are not supported.

* fix(ui): hide Apple Intelligence option when unavailable

- Checks for runtime availability of Apple Intelligence (via 'check_apple_intelligence_availability') in 'settings.rs'.
- Only adds the Apple Intelligence provider to the default settings if it is actually available on the device.
- Ensures the option does not appear in the UI for unsupported Macs (e.g., Intel or older macOS versions), even if the app was built with support enabled.

* move some files around as well as some ui text

* format

---------

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: CJ Pais <cj@cjpais.com>
2025-12-09 21:04:24 +07:00

29 lines
No EOL
741 B
C

#ifndef apple_intelligence_bridge_h
#define apple_intelligence_bridge_h
// C-compatible function declarations for Swift bridge
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
char* response;
int success; // 0 for failure, 1 for success
char* error_message; // Only valid when success = 0
} AppleLLMResponse;
// Check if Apple Intelligence is available on the device
int is_apple_intelligence_available(void);
// Process text using Apple's on-device LLM
AppleLLMResponse* process_text_with_apple_llm(const char* prompt, int max_tokens);
// Free memory allocated by the Apple LLM response
void free_apple_llm_response(AppleLLMResponse* response);
#ifdef __cplusplus
}
#endif
#endif /* apple_intelligence_bridge_h */