Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a770e059d | |||
| b4027f260d | |||
| 58c407d16b | |||
| e973efe2b3 | |||
| 447214ded4 | |||
| f2945061ca | |||
| d3b668bbfe |
32
.github/workflows/build.yml
vendored
Normal file
32
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
name: Build
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
jobs:
|
||||||
|
arm64_ventura:
|
||||||
|
runs-on: macos-13
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
brew fetch --force --bottle-tag=arm64_ventura sdl2
|
||||||
|
brew install $(brew --cache --bottle-tag=arm64_ventura sdl2)
|
||||||
|
sudo mkdir -p /opt/homebrew/lib
|
||||||
|
sudo ln -s /usr/local/lib/libSDL2.a /opt/homebrew/lib/libSDL2.a
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
path: cheetah
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: ggerganov/whisper.cpp
|
||||||
|
ref: v1.3.0
|
||||||
|
path: whisper.cpp
|
||||||
|
- run: |
|
||||||
|
cd cheetah
|
||||||
|
xcodebuild -scheme Cheetah -configuration Release -destination generic/platform=macOS -derivedDataPath build
|
||||||
|
cd build/Build/Products/Release
|
||||||
|
zip -r Cheetah.zip Cheetah.app
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: Cheetah
|
||||||
|
path: cheetah/build/Build/Products/Release/Cheetah.zip
|
||||||
32
.github/workflows/release.yml
vendored
Normal file
32
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
name: Release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*.*'
|
||||||
|
- 'v*.*.*'
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
uses: ./.github/workflows/build.yml
|
||||||
|
release:
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: Cheetah
|
||||||
|
- uses: actions/create-release@v1
|
||||||
|
id: create_release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref }}
|
||||||
|
release_name: ${{ github.ref }}
|
||||||
|
draft: true
|
||||||
|
- uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./Cheetah.zip
|
||||||
|
asset_name: Cheetah.zip
|
||||||
|
asset_content_type: application/zip
|
||||||
@ -35,6 +35,8 @@
|
|||||||
37AE7AC629A6E9C400C45FF6 /* stream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AE7AC529A6E9C400C45FF6 /* stream.cpp */; };
|
37AE7AC629A6E9C400C45FF6 /* stream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AE7AC529A6E9C400C45FF6 /* stream.cpp */; };
|
||||||
37AE7AC929A6F7F200C45FF6 /* stream.h in Headers */ = {isa = PBXBuildFile; fileRef = 37AE7AC729A6EC2F00C45FF6 /* stream.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
37AE7AC929A6F7F200C45FF6 /* stream.h in Headers */ = {isa = PBXBuildFile; fileRef = 37AE7AC729A6EC2F00C45FF6 /* stream.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
37AE7ACA29A70CE900C45FF6 /* whisper.h in Headers */ = {isa = PBXBuildFile; fileRef = 37AE7AB129A5AAD400C45FF6 /* whisper.h */; };
|
37AE7ACA29A70CE900C45FF6 /* whisper.h in Headers */ = {isa = PBXBuildFile; fileRef = 37AE7AB129A5AAD400C45FF6 /* whisper.h */; };
|
||||||
|
37B2997D29F9756F00971690 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 37B2997C29F9756F00971690 /* Sparkle */; };
|
||||||
|
37B2997F29F9757700971690 /* Sparkle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B2997E29F9757700971690 /* Sparkle.swift */; };
|
||||||
37B3A50629CE15AC0029821F /* OpenAIEndpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B3A4FD29CE15AC0029821F /* OpenAIEndpoint.swift */; };
|
37B3A50629CE15AC0029821F /* OpenAIEndpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B3A4FD29CE15AC0029821F /* OpenAIEndpoint.swift */; };
|
||||||
37B3A50729CE15AC0029821F /* OpenAISwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B3A4FE29CE15AC0029821F /* OpenAISwift.swift */; };
|
37B3A50729CE15AC0029821F /* OpenAISwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B3A4FE29CE15AC0029821F /* OpenAISwift.swift */; };
|
||||||
37B3A51C29CE16330029821F /* ImageGeneration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B3A51629CE16330029821F /* ImageGeneration.swift */; };
|
37B3A51C29CE16330029821F /* ImageGeneration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B3A51629CE16330029821F /* ImageGeneration.swift */; };
|
||||||
@ -166,6 +168,7 @@
|
|||||||
37AE7ABF29A6E96A00C45FF6 /* common.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = common.cpp; path = ../../whisper.cpp/examples/common.cpp; sourceTree = "<group>"; };
|
37AE7ABF29A6E96A00C45FF6 /* common.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = common.cpp; path = ../../whisper.cpp/examples/common.cpp; sourceTree = "<group>"; };
|
||||||
37AE7AC529A6E9C400C45FF6 /* stream.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = stream.cpp; sourceTree = "<group>"; };
|
37AE7AC529A6E9C400C45FF6 /* stream.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = stream.cpp; sourceTree = "<group>"; };
|
||||||
37AE7AC729A6EC2F00C45FF6 /* stream.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stream.h; sourceTree = "<group>"; };
|
37AE7AC729A6EC2F00C45FF6 /* stream.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stream.h; sourceTree = "<group>"; };
|
||||||
|
37B2997E29F9757700971690 /* Sparkle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sparkle.swift; sourceTree = "<group>"; };
|
||||||
37B3A4FD29CE15AC0029821F /* OpenAIEndpoint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenAIEndpoint.swift; sourceTree = "<group>"; };
|
37B3A4FD29CE15AC0029821F /* OpenAIEndpoint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenAIEndpoint.swift; sourceTree = "<group>"; };
|
||||||
37B3A4FE29CE15AC0029821F /* OpenAISwift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenAISwift.swift; sourceTree = "<group>"; };
|
37B3A4FE29CE15AC0029821F /* OpenAISwift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenAISwift.swift; sourceTree = "<group>"; };
|
||||||
37B3A51629CE16330029821F /* ImageGeneration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageGeneration.swift; sourceTree = "<group>"; };
|
37B3A51629CE16330029821F /* ImageGeneration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageGeneration.swift; sourceTree = "<group>"; };
|
||||||
@ -198,6 +201,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
37B2997D29F9756F00971690 /* Sparkle in Frameworks */,
|
||||||
37B4C27729BD7D9F00E83465 /* CheetahIPC.framework in Frameworks */,
|
37B4C27729BD7D9F00E83465 /* CheetahIPC.framework in Frameworks */,
|
||||||
37AE7A9529A5A9C200C45FF6 /* LibWhisper.framework in Frameworks */,
|
37AE7A9529A5A9C200C45FF6 /* LibWhisper.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
@ -273,6 +277,7 @@
|
|||||||
376437B929A854F500297AC6 /* ConversationAnalyzer.swift */,
|
376437B929A854F500297AC6 /* ConversationAnalyzer.swift */,
|
||||||
37951C0D29BCD71000C61AC5 /* ModelDownloader.swift */,
|
37951C0D29BCD71000C61AC5 /* ModelDownloader.swift */,
|
||||||
37B4C27929BD9F8700E83465 /* BrowserExtension.swift */,
|
37B4C27929BD9F8700E83465 /* BrowserExtension.swift */,
|
||||||
|
37B2997E29F9757700971690 /* Sparkle.swift */,
|
||||||
37AE7A7629A5A8B400C45FF6 /* Assets.xcassets */,
|
37AE7A7629A5A8B400C45FF6 /* Assets.xcassets */,
|
||||||
37AE7A7B29A5A8B400C45FF6 /* Cheetah.entitlements */,
|
37AE7A7B29A5A8B400C45FF6 /* Cheetah.entitlements */,
|
||||||
37AE7A7829A5A8B400C45FF6 /* Preview Content */,
|
37AE7A7829A5A8B400C45FF6 /* Preview Content */,
|
||||||
@ -429,6 +434,7 @@
|
|||||||
);
|
);
|
||||||
name = Cheetah;
|
name = Cheetah;
|
||||||
packageProductDependencies = (
|
packageProductDependencies = (
|
||||||
|
37B2997C29F9756F00971690 /* Sparkle */,
|
||||||
);
|
);
|
||||||
productName = Cheetah;
|
productName = Cheetah;
|
||||||
productReference = 37AE7A6F29A5A8B300C45FF6 /* Cheetah.app */;
|
productReference = 37AE7A6F29A5A8B300C45FF6 /* Cheetah.app */;
|
||||||
@ -506,6 +512,7 @@
|
|||||||
);
|
);
|
||||||
mainGroup = 37AE7A6629A5A8B300C45FF6;
|
mainGroup = 37AE7A6629A5A8B300C45FF6;
|
||||||
packageReferences = (
|
packageReferences = (
|
||||||
|
37B2997B29F9756F00971690 /* XCRemoteSwiftPackageReference "Sparkle" */,
|
||||||
);
|
);
|
||||||
productRefGroup = 37AE7A7029A5A8B300C45FF6 /* Products */;
|
productRefGroup = 37AE7A7029A5A8B300C45FF6 /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
@ -568,6 +575,7 @@
|
|||||||
37951C0E29BCD71000C61AC5 /* ModelDownloader.swift in Sources */,
|
37951C0E29BCD71000C61AC5 /* ModelDownloader.swift in Sources */,
|
||||||
37AE7A7529A5A8B300C45FF6 /* ContentView.swift in Sources */,
|
37AE7A7529A5A8B300C45FF6 /* ContentView.swift in Sources */,
|
||||||
37B3A51C29CE16330029821F /* ImageGeneration.swift in Sources */,
|
37B3A51C29CE16330029821F /* ImageGeneration.swift in Sources */,
|
||||||
|
37B2997F29F9757700971690 /* Sparkle.swift in Sources */,
|
||||||
37B3A51E29CE16330029821F /* Command.swift in Sources */,
|
37B3A51E29CE16330029821F /* Command.swift in Sources */,
|
||||||
376437BA29A854F500297AC6 /* ConversationAnalyzer.swift in Sources */,
|
376437BA29A854F500297AC6 /* ConversationAnalyzer.swift in Sources */,
|
||||||
37B4C27D29C1202C00E83465 /* NSTextFieldWrapper.swift in Sources */,
|
37B4C27D29C1202C00E83465 /* NSTextFieldWrapper.swift in Sources */,
|
||||||
@ -635,7 +643,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_ENTITLEMENTS = ExtensionHelper/ExtensionHelper.entitlements;
|
CODE_SIGN_ENTITLEMENTS = ExtensionHelper/ExtensionHelper.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
DEVELOPMENT_TEAM = 5JL49Y835V;
|
DEVELOPMENT_TEAM = "";
|
||||||
ENABLE_HARDENED_RUNTIME = NO;
|
ENABLE_HARDENED_RUNTIME = NO;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
@ -651,7 +659,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_ENTITLEMENTS = ExtensionHelper/ExtensionHelper.entitlements;
|
CODE_SIGN_ENTITLEMENTS = ExtensionHelper/ExtensionHelper.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
DEVELOPMENT_TEAM = 5JL49Y835V;
|
DEVELOPMENT_TEAM = "";
|
||||||
ENABLE_HARDENED_RUNTIME = NO;
|
ENABLE_HARDENED_RUNTIME = NO;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
@ -666,6 +674,7 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
ARCHS = arm64;
|
||||||
CLANG_ANALYZER_NONNULL = YES;
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
@ -715,7 +724,6 @@
|
|||||||
MACOSX_DEPLOYMENT_TARGET = 13.1;
|
MACOSX_DEPLOYMENT_TARGET = 13.1;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
@ -726,6 +734,7 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
ARCHS = arm64;
|
||||||
CLANG_ANALYZER_NONNULL = YES;
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
@ -770,7 +779,6 @@
|
|||||||
MACOSX_DEPLOYMENT_TARGET = 13.1;
|
MACOSX_DEPLOYMENT_TARGET = 13.1;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||||
@ -786,9 +794,9 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Cheetah/Cheetah.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Cheetah/Cheetah.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 2;
|
CURRENT_PROJECT_VERSION = 4;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"Cheetah/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"Cheetah/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = 5JL49Y835V;
|
DEVELOPMENT_TEAM = "";
|
||||||
ENABLE_HARDENED_RUNTIME = NO;
|
ENABLE_HARDENED_RUNTIME = NO;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
@ -799,7 +807,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.1;
|
MARKETING_VERSION = 1.3;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = org.phrack.Cheetah;
|
PRODUCT_BUNDLE_IDENTIFIER = org.phrack.Cheetah;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
@ -816,9 +824,9 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Cheetah/Cheetah.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Cheetah/Cheetah.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 2;
|
CURRENT_PROJECT_VERSION = 4;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"Cheetah/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"Cheetah/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = 5JL49Y835V;
|
DEVELOPMENT_TEAM = "";
|
||||||
ENABLE_HARDENED_RUNTIME = NO;
|
ENABLE_HARDENED_RUNTIME = NO;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
@ -829,7 +837,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.1;
|
MARKETING_VERSION = 1.3;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = org.phrack.Cheetah;
|
PRODUCT_BUNDLE_IDENTIFIER = org.phrack.Cheetah;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
@ -845,11 +853,15 @@
|
|||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DEVELOPMENT_TEAM = 5JL49Y835V;
|
DEVELOPMENT_TEAM = "";
|
||||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
DYLIB_CURRENT_VERSION = 1;
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
HEADER_SEARCH_PATHS = (
|
||||||
|
/opt/homebrew/include/SDL2,
|
||||||
|
/usr/local/include/SDL2,
|
||||||
|
);
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
@ -859,13 +871,23 @@
|
|||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
OTHER_CFLAGS = (
|
OTHER_CFLAGS = (
|
||||||
"-I/opt/homebrew/include/SDL2",
|
|
||||||
"-D_THREAD_SAFE",
|
"-D_THREAD_SAFE",
|
||||||
"-DGGML_USE_ACCELERATE",
|
"-DGGML_USE_ACCELERATE",
|
||||||
);
|
);
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
"-L/opt/homebrew/lib",
|
/opt/homebrew/lib/libSDL2.a,
|
||||||
"-lSDL2",
|
"-l",
|
||||||
|
iconv,
|
||||||
|
"-weak_framework",
|
||||||
|
CoreHaptics,
|
||||||
|
"-weak_framework",
|
||||||
|
GameController,
|
||||||
|
"-weak_framework",
|
||||||
|
ForceFeedback,
|
||||||
|
"-weak_framework",
|
||||||
|
Carbon,
|
||||||
|
"-weak_framework",
|
||||||
|
AppKit,
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = org.phrack.LibWhisper;
|
PRODUCT_BUNDLE_IDENTIFIER = org.phrack.LibWhisper;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
@ -886,11 +908,15 @@
|
|||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DEVELOPMENT_TEAM = 5JL49Y835V;
|
DEVELOPMENT_TEAM = "";
|
||||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
DYLIB_CURRENT_VERSION = 1;
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
HEADER_SEARCH_PATHS = (
|
||||||
|
/opt/homebrew/include/SDL2,
|
||||||
|
/usr/local/include/SDL2,
|
||||||
|
);
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
@ -900,13 +926,23 @@
|
|||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
OTHER_CFLAGS = (
|
OTHER_CFLAGS = (
|
||||||
"-I/opt/homebrew/include/SDL2",
|
|
||||||
"-D_THREAD_SAFE",
|
"-D_THREAD_SAFE",
|
||||||
"-DGGML_USE_ACCELERATE",
|
"-DGGML_USE_ACCELERATE",
|
||||||
);
|
);
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
"-L/opt/homebrew/lib",
|
/opt/homebrew/lib/libSDL2.a,
|
||||||
"-lSDL2",
|
"-l",
|
||||||
|
iconv,
|
||||||
|
"-weak_framework",
|
||||||
|
CoreHaptics,
|
||||||
|
"-weak_framework",
|
||||||
|
GameController,
|
||||||
|
"-weak_framework",
|
||||||
|
ForceFeedback,
|
||||||
|
"-weak_framework",
|
||||||
|
Carbon,
|
||||||
|
"-weak_framework",
|
||||||
|
AppKit,
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = org.phrack.LibWhisper;
|
PRODUCT_BUNDLE_IDENTIFIER = org.phrack.LibWhisper;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
@ -926,7 +962,7 @@
|
|||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DEVELOPMENT_TEAM = 5JL49Y835V;
|
DEVELOPMENT_TEAM = "";
|
||||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
DYLIB_CURRENT_VERSION = 1;
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
@ -958,7 +994,7 @@
|
|||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DEVELOPMENT_TEAM = 5JL49Y835V;
|
DEVELOPMENT_TEAM = "";
|
||||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
DYLIB_CURRENT_VERSION = 1;
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
@ -1030,6 +1066,25 @@
|
|||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
|
/* Begin XCRemoteSwiftPackageReference section */
|
||||||
|
37B2997B29F9756F00971690 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
|
||||||
|
isa = XCRemoteSwiftPackageReference;
|
||||||
|
repositoryURL = "https://github.com/sparkle-project/Sparkle";
|
||||||
|
requirement = {
|
||||||
|
kind = upToNextMajorVersion;
|
||||||
|
minimumVersion = 2.0.0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/* End XCRemoteSwiftPackageReference section */
|
||||||
|
|
||||||
|
/* Begin XCSwiftPackageProductDependency section */
|
||||||
|
37B2997C29F9756F00971690 /* Sparkle */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 37B2997B29F9756F00971690 /* XCRemoteSwiftPackageReference "Sparkle" */;
|
||||||
|
productName = Sparkle;
|
||||||
|
};
|
||||||
|
/* End XCSwiftPackageProductDependency section */
|
||||||
};
|
};
|
||||||
rootObject = 37AE7A6729A5A8B300C45FF6 /* Project object */;
|
rootObject = 37AE7A6729A5A8B300C45FF6 /* Project object */;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"pins" : [
|
||||||
|
{
|
||||||
|
"identity" : "sparkle",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/sparkle-project/Sparkle",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "7907f058bcef1132c9b4af6c049cac598330a5f9",
|
||||||
|
"version" : "2.4.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version" : 2
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ import SwiftUI
|
|||||||
import Combine
|
import Combine
|
||||||
import LibWhisper
|
import LibWhisper
|
||||||
import CheetahIPC
|
import CheetahIPC
|
||||||
|
import Sparkle
|
||||||
|
|
||||||
enum AnswerRequest {
|
enum AnswerRequest {
|
||||||
case none
|
case none
|
||||||
@ -45,6 +46,8 @@ struct CheetahApp: App {
|
|||||||
|
|
||||||
var extensionState = BrowserExtensionState()
|
var extensionState = BrowserExtensionState()
|
||||||
|
|
||||||
|
let updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)
|
||||||
|
|
||||||
func start() async {
|
func start() async {
|
||||||
viewModel.devices = try! CaptureDevice.devices
|
viewModel.devices = try! CaptureDevice.devices
|
||||||
|
|
||||||
@ -118,6 +121,9 @@ struct CheetahApp: App {
|
|||||||
.windowResizability(.contentSize)
|
.windowResizability(.contentSize)
|
||||||
.windowStyle(.hiddenTitleBar)
|
.windowStyle(.hiddenTitleBar)
|
||||||
.commands {
|
.commands {
|
||||||
|
CommandGroup(after: .appInfo) {
|
||||||
|
CheckForUpdatesView(updater: updaterController.updater)
|
||||||
|
}
|
||||||
CommandGroup(replacing: .appSettings) {
|
CommandGroup(replacing: .appSettings) {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
viewModel.authToken = nil
|
viewModel.authToken = nil
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict/>
|
<dict>
|
||||||
|
<key>SUFeedURL</key>
|
||||||
|
<string>https://cheetah-sw-update.leetcodemafia.com/appcast.xml</string>
|
||||||
|
<key>SUPublicEDKey</key>
|
||||||
|
<string>30J/+sJRxhziFhK63Xe6OY5kjwF5tG7klmntA0XIGNM=</string>
|
||||||
|
<key>SUEnableSystemProfiling</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
32
Cheetah/Sparkle.swift
Normal file
32
Cheetah/Sparkle.swift
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import SwiftUI
|
||||||
|
import Sparkle
|
||||||
|
|
||||||
|
// This view model class publishes when new updates can be checked by the user
|
||||||
|
final class CheckForUpdatesViewModel: ObservableObject {
|
||||||
|
@Published var canCheckForUpdates = false
|
||||||
|
|
||||||
|
init(updater: SPUUpdater) {
|
||||||
|
updater.publisher(for: \.canCheckForUpdates)
|
||||||
|
.assign(to: &$canCheckForUpdates)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is the view for the Check for Updates menu item
|
||||||
|
// Note this intermediate view is necessary for the disabled state on the menu item to work properly before Monterey.
|
||||||
|
// See https://stackoverflow.com/questions/68553092/menu-not-updating-swiftui-bug for more info
|
||||||
|
struct CheckForUpdatesView: View {
|
||||||
|
@ObservedObject private var checkForUpdatesViewModel: CheckForUpdatesViewModel
|
||||||
|
private let updater: SPUUpdater
|
||||||
|
|
||||||
|
init(updater: SPUUpdater) {
|
||||||
|
self.updater = updater
|
||||||
|
|
||||||
|
// Create our view model for our CheckForUpdatesView
|
||||||
|
self.checkForUpdatesViewModel = CheckForUpdatesViewModel(updater: updater)
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Button("Check for Updates…", action: updater.checkForUpdates)
|
||||||
|
.disabled(!checkForUpdatesViewModel.canCheckForUpdates)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -78,6 +78,7 @@ struct CoachView: View {
|
|||||||
.font(.footnote.italic())
|
.font(.footnote.italic())
|
||||||
}
|
}
|
||||||
ScrollView {
|
ScrollView {
|
||||||
|
if answer != "" {
|
||||||
NSTextFieldWrapper(text: $answer, selectedRange: $answerSelection)
|
NSTextFieldWrapper(text: $answer, selectedRange: $answerSelection)
|
||||||
.onChange(of: viewModel.answer) {
|
.onChange(of: viewModel.answer) {
|
||||||
if let newAnswer = $0 {
|
if let newAnswer = $0 {
|
||||||
@ -85,15 +86,19 @@ struct CoachView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(maxHeight: 600)
|
|
||||||
if let solution = viewModel.codeAnswer {
|
if let solution = viewModel.codeAnswer {
|
||||||
|
HStack {
|
||||||
Text(solution)
|
Text(solution)
|
||||||
.textSelection(.enabled)
|
.textSelection(.enabled)
|
||||||
.font(.footnote)
|
.font(.footnote)
|
||||||
.monospaced()
|
.monospaced()
|
||||||
}
|
.lineSpacing(1.2)
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.frame(maxHeight: 600)
|
||||||
|
}
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,7 +37,7 @@ struct ContentView_Previews: PreviewProvider {
|
|||||||
let viewModel = AppViewModel()
|
let viewModel = AppViewModel()
|
||||||
viewModel.devices = [CaptureDevice(id: 0, name: "Audio Loopback Device")]
|
viewModel.devices = [CaptureDevice(id: 0, name: "Audio Loopback Device")]
|
||||||
viewModel.buttonsAlwaysEnabled = true
|
viewModel.buttonsAlwaysEnabled = true
|
||||||
viewModel.authToken = ""
|
viewModel.authToken = "x"
|
||||||
viewModel.downloadState = .completed
|
viewModel.downloadState = .completed
|
||||||
viewModel.transcript = "So how would we break this app down into components?"
|
viewModel.transcript = "So how would we break this app down into components?"
|
||||||
viewModel.answer = """
|
viewModel.answer = """
|
||||||
|
|||||||
134
LICENSE-3RD-PARTY
Normal file
134
LICENSE-3RD-PARTY
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
Copyright (c) 2006-2013 Andy Matuschak.
|
||||||
|
Copyright (c) 2009-2013 Elgato Systems GmbH.
|
||||||
|
Copyright (c) 2011-2014 Kornel Lesiński.
|
||||||
|
Copyright (c) 2015-2017 Mayur Pawashe.
|
||||||
|
Copyright (c) 2014 C.W. Betts.
|
||||||
|
Copyright (c) 2014 Petroules Corporation.
|
||||||
|
Copyright (c) 2014 Big Nerd Ranch.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
=================
|
||||||
|
EXTERNAL LICENSES
|
||||||
|
=================
|
||||||
|
|
||||||
|
bspatch.c and bsdiff.c, from bsdiff 4.3 <http://www.daemonology.net/bsdiff/>:
|
||||||
|
|
||||||
|
Copyright 2003-2005 Colin Percival
|
||||||
|
All rights reserved
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted providing that the following conditions
|
||||||
|
are met:
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
sais.c and sais.c, from sais-lite (2010/08/07) <https://sites.google.com/site/yuta256/sais>:
|
||||||
|
|
||||||
|
The sais-lite copyright is as follows:
|
||||||
|
|
||||||
|
Copyright (c) 2008-2010 Yuta Mori All Rights Reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation
|
||||||
|
files (the "Software"), to deal in the Software without
|
||||||
|
restriction, including without limitation the rights to use,
|
||||||
|
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
Portable C implementation of Ed25519, from https://github.com/orlp/ed25519
|
||||||
|
|
||||||
|
Copyright (c) 2015 Orson Peters <orsonpeters@gmail.com>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied warranty. In no event will the
|
||||||
|
authors be held liable for any damages arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose, including commercial
|
||||||
|
applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not claim that you wrote the
|
||||||
|
original software. If you use this software in a product, an acknowledgment in the product
|
||||||
|
documentation would be appreciated but is not required.
|
||||||
|
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be misrepresented as
|
||||||
|
being the original software.
|
||||||
|
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
SUSignatureVerifier.m:
|
||||||
|
|
||||||
|
Copyright (c) 2011 Mark Hamlin.
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted providing that the following conditions
|
||||||
|
are met:
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
@ -17,7 +17,6 @@ public struct OpenAI<T: Payload>: Codable {
|
|||||||
|
|
||||||
public struct ErrorResult: Codable, Error {
|
public struct ErrorResult: Codable, Error {
|
||||||
public let message: String
|
public let message: String
|
||||||
public let code: String
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct TextResult: Payload {
|
public struct TextResult: Payload {
|
||||||
|
|||||||
@ -9,6 +9,15 @@ public enum OpenAIError: Error {
|
|||||||
case decodingError(error: Error)
|
case decodingError(error: Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension OpenAIError: LocalizedError {
|
||||||
|
public var errorDescription: String? {
|
||||||
|
switch self {
|
||||||
|
case .genericError(let error), .decodingError(let error):
|
||||||
|
return error.localizedDescription
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class OpenAISwift {
|
public class OpenAISwift {
|
||||||
fileprivate(set) var token: String?
|
fileprivate(set) var token: String?
|
||||||
fileprivate let config: Config
|
fileprivate let config: Config
|
||||||
@ -132,6 +141,9 @@ extension OpenAISwift {
|
|||||||
let res = try JSONDecoder().decode(OpenAI<MessageResult>.self, from: success)
|
let res = try JSONDecoder().decode(OpenAI<MessageResult>.self, from: success)
|
||||||
completionHandler(.success(res))
|
completionHandler(.success(res))
|
||||||
} catch {
|
} catch {
|
||||||
|
if let resp = String(data: success, encoding: .utf8) {
|
||||||
|
print("Failed to decode response:\n", resp)
|
||||||
|
}
|
||||||
completionHandler(.failure(.decodingError(error: error)))
|
completionHandler(.failure(.decodingError(error: error)))
|
||||||
}
|
}
|
||||||
case .failure(let failure):
|
case .failure(let failure):
|
||||||
|
|||||||
Reference in New Issue
Block a user