├── .github └── workflows │ └── dart.yml ├── .gitignore ├── .metadata ├── .pre-push-config.yaml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── assets └── example │ ├── Screenshot_1684672351.png │ ├── Screenshot_1684672512.png │ ├── Screenshot_1684672715.png │ └── translate_ui.jpg ├── codemagic.yaml ├── coverage ├── coverage.json └── lcov.info ├── example ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── redev │ │ │ │ │ └── rx │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ ├── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h │ └── RunnerTests │ │ └── RunnerTests.swift ├── lib │ ├── constants.dart │ ├── generate_img_screen.dart │ └── main.dart ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ ├── main.cc │ ├── my_application.cc │ └── my_application.h ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Podfile │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ └── MainMenu.xib │ │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements ├── pubspec.lock ├── pubspec.yaml ├── test │ └── widget_test.dart ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── example_app └── openai_app │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── analysis_options.yaml │ ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── redevrx │ │ │ │ │ └── openai │ │ │ │ │ └── app │ │ │ │ │ └── openai_app │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ └── ic_launcher.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_adaptive_back.png │ │ │ │ └── ic_launcher_adaptive_fore.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_adaptive_back.png │ │ │ │ └── ic_launcher_adaptive_fore.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_adaptive_back.png │ │ │ │ └── ic_launcher_adaptive_fore.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_adaptive_back.png │ │ │ │ └── ic_launcher_adaptive_fore.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher_adaptive_back.png │ │ │ │ └── ic_launcher_adaptive_fore.png │ │ │ │ ├── values-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle │ ├── assets │ ├── animation │ │ ├── error_animation.json │ │ ├── robot_Setting_animation.json │ │ └── robot_loading_screen.json │ ├── icons │ │ ├── app_icon.png │ │ ├── ic_launcher.png │ │ ├── icon_send.png │ │ ├── openai_icon.png │ │ ├── send_icon.png │ │ └── user_icon.png │ └── images │ │ ├── generate_image.png │ │ ├── grammar_image.png │ │ ├── q_and_a.png │ │ ├── question_interview_image.png │ │ ├── robot_bg.jpg │ │ ├── robot_hello.jpg │ │ ├── robot_hello.png │ │ └── translate.png │ ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ ├── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-50x50@1x.png │ │ │ │ ├── Icon-App-50x50@2x.png │ │ │ │ ├── Icon-App-57x57@1x.png │ │ │ │ ├── Icon-App-57x57@2x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-72x72@1x.png │ │ │ │ ├── Icon-App-72x72@2x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h │ └── RunnerTests │ │ └── RunnerTests.swift │ ├── lib │ ├── bloc │ │ ├── openai │ │ │ ├── openai_bloc.dart │ │ │ └── openai_state.dart │ │ ├── select_version │ │ │ ├── select_version_bloc.dart │ │ │ └── select_version_state.dart │ │ └── theme │ │ │ ├── theme_bloc.dart │ │ │ └── theme_state.dart │ ├── components │ │ ├── background │ │ │ └── background_gradient.dart │ │ ├── button │ │ │ └── openai_button.dart │ │ ├── dialog │ │ │ └── loading_dialog.dart │ │ ├── error │ │ │ ├── error_card.dart │ │ │ └── notfound_token.dart │ │ └── setting │ │ │ └── setting_card.dart │ ├── constants │ │ ├── constants.dart │ │ ├── extension │ │ │ └── size_box_extension.dart │ │ └── theme │ │ │ ├── colors.dart │ │ │ ├── dimen.dart │ │ │ └── theme.dart │ ├── di │ │ ├── di.config.dart │ │ └── di.dart │ ├── main.dart │ ├── models │ │ ├── feature │ │ │ └── feature_data.dart │ │ └── message │ │ │ └── message.dart │ ├── screen │ │ ├── chatbot │ │ │ └── chatbot.dart │ │ ├── home │ │ │ └── home_screen.dart │ │ ├── preview │ │ │ └── preview_screen.dart │ │ ├── setup │ │ │ └── setup_token.dart │ │ └── splash │ │ │ └── loading_screen.dart │ └── service │ │ └── shred_preference │ │ └── shared_preference.dart │ ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ ├── main.cc │ ├── my_application.cc │ └── my_application.h │ ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Podfile │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── app_icon_1024.png │ │ │ │ ├── app_icon_128.png │ │ │ │ ├── app_icon_16.png │ │ │ │ ├── app_icon_256.png │ │ │ │ ├── app_icon_32.png │ │ │ │ ├── app_icon_512.png │ │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ │ └── MainMenu.xib │ │ ├── Configs │ │ │ ├── AppInfo.xcconfig │ │ │ ├── Debug.xcconfig │ │ │ ├── Release.xcconfig │ │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements │ └── RunnerTests │ │ └── RunnerTests.swift │ ├── privacy.md │ ├── pubspec.lock │ ├── pubspec.yaml │ ├── test │ └── widget_test.dart │ ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json │ └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── lib ├── chat_gpt_sdk.dart └── src │ ├── assistants.dart │ ├── audio.dart │ ├── client │ ├── client.dart │ ├── exception │ │ ├── base_error_wrapper.dart │ │ ├── missing_token_exception.dart │ │ ├── openai_exception.dart │ │ └── request_error.dart │ ├── interceptor │ │ └── interceptor_wrapper.dart │ ├── openai_client.dart │ └── openai_wrapper.dart │ ├── edit.dart │ ├── embedding.dart │ ├── fine_tuned.dart │ ├── i_openai.dart │ ├── logger │ └── logger.dart │ ├── messages.dart │ ├── model │ ├── assistant │ │ ├── enum │ │ │ └── assistant_model.dart │ │ ├── request │ │ │ └── assistant.dart │ │ └── response │ │ │ ├── assistant_data.dart │ │ │ ├── assistant_file_data.dart │ │ │ ├── delete_assistant.dart │ │ │ ├── list_assistant_file.dart │ │ │ └── tool.dart │ ├── audio │ │ ├── enum │ │ │ └── audio_format.dart │ │ ├── request │ │ │ ├── audio_request.dart │ │ │ └── speech_request.dart │ │ └── response │ │ │ └── audio_response.dart │ ├── cancel │ │ └── cancel_data.dart │ ├── chat_complete │ │ ├── enum │ │ │ ├── chat_model.dart │ │ │ ├── function_call.dart │ │ │ └── role.dart │ │ ├── request │ │ │ ├── chat_complete_text.dart │ │ │ ├── function_data.dart │ │ │ ├── json_schema.dart │ │ │ ├── messages.dart │ │ │ └── response_format.dart │ │ └── response │ │ │ ├── chat_choice.dart │ │ │ ├── chat_choice_sse.dart │ │ │ ├── chat_ct_response.dart │ │ │ ├── chat_response_sse.dart │ │ │ └── message.dart │ ├── client │ │ └── http_setup.dart │ ├── complete_text │ │ ├── enum │ │ │ └── model.dart │ │ ├── request │ │ │ └── complete_text.dart │ │ └── response │ │ │ ├── choices.dart │ │ │ ├── complete_response.dart │ │ │ └── usage.dart │ ├── edits │ │ ├── enum │ │ │ └── edit_model.dart │ │ ├── request │ │ │ └── edit_request.dart │ │ └── response │ │ │ └── edit_response.dart │ ├── embedding │ │ ├── enum │ │ │ └── embed_model.dart │ │ ├── request │ │ │ └── embed_request.dart │ │ └── response │ │ │ ├── embed_data.dart │ │ │ └── embed_response.dart │ ├── error │ │ └── openai_error.dart │ ├── file │ │ ├── request │ │ │ └── upload_file.dart │ │ └── response │ │ │ ├── delete_file.dart │ │ │ ├── file_data.dart │ │ │ ├── file_response.dart │ │ │ └── upload_response.dart │ ├── fine_tune │ │ ├── enum │ │ │ └── fine_model.dart │ │ ├── request │ │ │ ├── create_fine_tune.dart │ │ │ ├── create_fine_tune_job.dart │ │ │ └── hyper_parameter.dart │ │ └── response │ │ │ ├── fine_tune_delete.dart │ │ │ ├── fine_tune_event.dart │ │ │ ├── fine_tune_hyper_params.dart │ │ │ ├── fine_tune_model.dart │ │ │ ├── job │ │ │ ├── fine_tune_list.dart │ │ │ └── fine_tune_model_job.dart │ │ │ └── training_files.dart │ ├── gen_image │ │ ├── enum │ │ │ ├── format.dart │ │ │ ├── generate_image_model.dart │ │ │ └── image_size.dart │ │ ├── request │ │ │ ├── file_info.dart │ │ │ ├── generate_image.dart │ │ │ └── variation.dart │ │ └── response │ │ │ ├── gen_img_response.dart │ │ │ └── image_data.dart │ ├── message │ │ ├── request │ │ │ └── create_message.dart │ │ └── response │ │ │ ├── content.dart │ │ │ ├── content_v2.dart │ │ │ ├── create_message_response.dart │ │ │ ├── create_message_v2_response.dart │ │ │ ├── image_data.dart │ │ │ ├── list_message_file.dart │ │ │ ├── list_message_file_data.dart │ │ │ ├── message_data.dart │ │ │ ├── message_data_response.dart │ │ │ └── text_data.dart │ ├── moderation │ │ ├── enum │ │ │ └── moderation_model.dart │ │ └── response │ │ │ ├── categories.dart │ │ │ ├── category_scores.dart │ │ │ ├── moderation_data.dart │ │ │ └── moderation_result.dart │ ├── openai_engine │ │ ├── engine_data.dart │ │ └── engine_model.dart │ ├── openai_model │ │ ├── model_data.dart │ │ ├── openai_model.dart │ │ └── permission.dart │ ├── run │ │ ├── request │ │ │ ├── create_run.dart │ │ │ └── create_thread_and_run.dart │ │ └── response │ │ │ ├── create_run_response.dart │ │ │ ├── create_thread_and_run_data.dart │ │ │ ├── list_run.dart │ │ │ ├── message_creation.dart │ │ │ └── step_detail.dart │ └── thread │ │ ├── request │ │ └── thread_request.dart │ │ └── response │ │ ├── thread_delete_response.dart │ │ └── thread_response.dart │ ├── moderation.dart │ ├── openai.dart │ ├── openai_file.dart │ ├── runs.dart │ ├── threads.dart │ └── utils │ ├── constants.dart │ ├── json_decode_string.dart │ └── token_builder.dart ├── pubspec.yaml └── test ├── client ├── http_setup_test.dart ├── interceptor_wrapper_test.dart ├── openai_wrapper_test.dart └── openai_wrapper_test.mocks.dart ├── exception ├── base_error_wrapper_test.dart └── missing_token_exception_test.dart ├── logger └── logger_test.dart ├── model ├── audio │ ├── enum │ │ └── audio_format_test.dart │ ├── request │ │ └── audio_request_test.dart │ └── response │ │ └── audio_response_test.dart ├── cancel │ └── cancel_data_test.dart ├── chat_complete │ ├── enum │ │ └── chat_model_test.dart │ ├── request │ │ └── chat_complete_text_test.dart │ └── response │ │ ├── chat_choice_test.dart │ │ ├── chat_ct_response_test.dart │ │ ├── chat_response_sse_test.dart │ │ ├── chat_shoice_sse_test.dart │ │ └── message_test.dart ├── client │ └── http_setup_test.dart ├── complete_text │ ├── enum │ │ └── model_test.dart │ ├── request │ │ └── complete_text_test.dart │ └── response │ │ ├── choices_test.dart │ │ ├── complete_response_test.dart │ │ └── usage_test.dart ├── edits │ ├── enum │ │ └── edit_model_test.dart │ ├── request │ │ └── edit_request_test.dart │ └── response │ │ └── edit_response_test.dart ├── embedding │ ├── enum │ │ └── embed_model_test.dart │ ├── request │ │ └── embed_request_test.dart │ └── response │ │ ├── embed_data_test.dart │ │ └── embed_response_test.dart ├── error │ └── openai_error_test.dart ├── file │ ├── request │ │ └── upload_file_test.dart │ └── response │ │ ├── delete_file_test.dart │ │ ├── file_data_test.dart │ │ ├── file_response_test.dart │ │ └── uplaod_response_test.dart ├── fine_tune │ ├── enum │ │ └── fine_model_test.dart │ ├── request │ │ └── create_fine_tune_test.dart │ └── response │ │ ├── fine_tune_delete_test.dart │ │ ├── fine_tune_event.dart │ │ ├── fine_tune_model_test.dart │ │ ├── fine_turn_hyper_params_test.dart │ │ └── training_files_test.dart ├── gen_image │ ├── enum │ │ ├── format_test.dart │ │ └── image_size_test.dart │ ├── request │ │ ├── edit_file_test.dart │ │ ├── generate_image_test.dart │ │ └── variation_test.dart │ └── response │ │ ├── gen_img_response_test.dart │ │ └── image_data_test.dart ├── moderation │ ├── enum │ │ └── moderation_model_test.dart │ └── response │ │ ├── categories_test.dart │ │ ├── category_scores_test.dart │ │ ├── moderation_data_test.dart │ │ └── moderation_result_test.dart ├── openai_engine │ ├── engine_data_test.dart │ └── engine_model_test.dart └── openia_model │ ├── model_data_test.dart │ ├── openai_model_test.dart │ └── permission_test.dart ├── openai_test.dart ├── openai_test.mocks.dart └── utils_test ├── constants_test.dart └── token_build_test.dart /.github/workflows/dart.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | 6 | name: automate test 7 | 8 | on: 9 | push: 10 | branches: [ "main" ] 11 | pull_request: 12 | branches: [ "main" ] 13 | 14 | workflow_dispatch: 15 | 16 | jobs: 17 | build: 18 | runs-on: windows-latest 19 | 20 | steps: 21 | - uses: actions/checkout@v2 22 | - uses: actions/setup-java@v2 23 | with: 24 | distribution: 'zulu' 25 | java-version: '11' 26 | - uses: subosito/flutter-action@v1 27 | with: 28 | flutter-version: '3.24.3' 29 | 30 | # - name: run analyze 31 | # run: flutter analyze 32 | 33 | - name: Get all Flutter Packages 34 | run: flutter pub get 35 | 36 | - name: Format Code 37 | run: dart format . 38 | 39 | - name: Run Flutter Test 40 | run: flutter test 41 | 42 | - name: Upload coverage to Codecov 43 | uses: codecov/codecov-action@v2.1.0 44 | with: 45 | token: ${{ secrets.CODECOV_TOKEN }} 46 | 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | .packages 30 | build/ 31 | .idea 32 | /.flutter-plugins 33 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 135454af32477f815a7525073027a3ff9eff1bfd 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /.pre-push-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/Cretezy/flutter-format-pre-push 3 | rev: "master" 4 | hooks: 5 | - id: flutter-format 6 | - repo: https://github.com/dluksza/flutter-analyze-pre-push 7 | rev: "master" 8 | hooks: 9 | - id: flutter-analyze 10 | - repo: https://github.com/Virtomize/flutter-test-pre-push 11 | rev: "main" 12 | hooks: 13 | - id: flutter-test -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [2023] [Kasem Saikhuedong] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:lints/core.yaml 2 | 3 | #include: package:flutter_lints/flutter.yaml 4 | 5 | # Additional information about this file can be found at 6 | # https://dart.dev/guides/language/analysis-options 7 | 8 | analyzer: 9 | plugins: 10 | - dart_code_metrics 11 | 12 | dart_code_metrics: 13 | metrics: 14 | cyclomatic-complexity: 20 15 | number-of-parameters: 4 16 | maximum-nesting-level: 7 17 | metrics-exclude: 18 | - test/** 19 | rules: 20 | # - avoid-dynamic 21 | - avoid-passing-async-when-sync-expected 22 | - avoid-redundant-async 23 | - avoid-unnecessary-type-assertions 24 | - avoid-unnecessary-type-casts 25 | - avoid-unrelated-type-assertions 26 | - avoid-unused-parameters 27 | - avoid-nested-conditional-expressions 28 | - newline-before-return 29 | - no-boolean-literal-compare 30 | - no-empty-block 31 | - prefer-trailing-comma 32 | - prefer-conditional-expressions 33 | - no-equal-then-else 34 | - prefer-moving-to-variable: 35 | allowed-duplicated-chains: 3 36 | - prefer-match-file-name 37 | -------------------------------------------------------------------------------- /assets/example/Screenshot_1684672351.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/assets/example/Screenshot_1684672351.png -------------------------------------------------------------------------------- /assets/example/Screenshot_1684672512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/assets/example/Screenshot_1684672512.png -------------------------------------------------------------------------------- /assets/example/Screenshot_1684672715.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/assets/example/Screenshot_1684672715.png -------------------------------------------------------------------------------- /assets/example/translate_ui.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/assets/example/translate_ui.jpg -------------------------------------------------------------------------------- /codemagic.yaml: -------------------------------------------------------------------------------- 1 | scripts: 2 | - echo 'previous step' 3 | - name: Dart Code Metrics 4 | script: | 5 | flutter pub global activate dart_code_metrics 6 | mkdir -p metrics-results 7 | flutter pub global run dart_code_metrics:metrics analyze lib --reporter=json > metrics-results/dart_code_metrics.json 8 | test_report: metrics-results/dart_code_metrics.json -------------------------------------------------------------------------------- /coverage/coverage.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/coverage/coverage.json -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: 796c8ef79279f9c774545b3771238c3098dbefab 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 17 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 18 | - platform: ios 19 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 20 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 21 | 22 | # User provided section 23 | 24 | # List of Local paths (relative to this file) that should be 25 | # ignored by the migrate tool. 26 | # 27 | # Files that are not part of the templates will be ignored by default. 28 | unmanaged_files: 29 | - 'lib/main.dart' 30 | - 'ios/Runner.xcodeproj/project.pbxproj' 31 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/redev/rx/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.redev.rx.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.3.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | tasks.register("clean", Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 6 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - image_picker_ios (0.0.1): 4 | - Flutter 5 | 6 | DEPENDENCIES: 7 | - Flutter (from `Flutter`) 8 | - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) 9 | 10 | EXTERNAL SOURCES: 11 | Flutter: 12 | :path: Flutter 13 | image_picker_ios: 14 | :path: ".symlinks/plugins/image_picker_ios/ios" 15 | 16 | SPEC CHECKSUMS: 17 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 18 | image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 19 | 20 | PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 21 | 22 | COCOAPODS: 1.14.3 23 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /example/lib/constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | final heroCard = BoxDecoration( 4 | color: Colors.white, 5 | borderRadius: BorderRadius.circular(16.0), 6 | boxShadow: [ 7 | BoxShadow( 8 | color: Colors.grey.withValues(alpha: .12), 9 | offset: const Offset(0, 27), 10 | blurRadius: 27, 11 | spreadRadius: .5) 12 | ]); 13 | 14 | final heroNav = BoxDecoration( 15 | color: Colors.white, 16 | borderRadius: BorderRadius.circular(50.0), 17 | boxShadow: [ 18 | BoxShadow( 19 | color: Colors.black.withValues(alpha: .23), 20 | offset: const Offset(2, 18), 21 | blurRadius: 18, 22 | spreadRadius: .5) 23 | ]); 24 | 25 | const kToken = ""; 26 | -------------------------------------------------------------------------------- /example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void fl_register_plugins(FlPluginRegistry* registry) { 12 | g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = 13 | fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); 14 | file_selector_plugin_register_with_registrar(file_selector_linux_registrar); 15 | } 16 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | file_selector_linux 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import file_selector_macos 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.redev.rx.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.redev.rx. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/web/favicon.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void RegisterPlugins(flutter::PluginRegistry* registry) { 12 | FileSelectorWindowsRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("FileSelectorWindows")); 14 | } 15 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | file_selector_windows 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /example_app/openai_app/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /example_app/openai_app/README.md: -------------------------------------------------------------------------------- 1 | # openai_app 2 | 3 | Example use chatGPT SDK 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example_app/openai_app/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/kotlin/com/redevrx/openai/app/openai_app/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.redevrx.openai.app.openai_app 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example_app/openai_app/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /example_app/openai_app/android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = '../build' 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(':app') 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /example_app/openai_app/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example_app/openai_app/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip 6 | -------------------------------------------------------------------------------- /example_app/openai_app/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "7.3.0" apply false 22 | id "org.jetbrains.kotlin.android" version "1.7.10" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /example_app/openai_app/assets/icons/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/icons/app_icon.png -------------------------------------------------------------------------------- /example_app/openai_app/assets/icons/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/icons/ic_launcher.png -------------------------------------------------------------------------------- /example_app/openai_app/assets/icons/icon_send.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/icons/icon_send.png -------------------------------------------------------------------------------- /example_app/openai_app/assets/icons/openai_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/icons/openai_icon.png -------------------------------------------------------------------------------- /example_app/openai_app/assets/icons/send_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/icons/send_icon.png -------------------------------------------------------------------------------- /example_app/openai_app/assets/icons/user_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/icons/user_icon.png -------------------------------------------------------------------------------- /example_app/openai_app/assets/images/generate_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/images/generate_image.png -------------------------------------------------------------------------------- /example_app/openai_app/assets/images/grammar_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/images/grammar_image.png -------------------------------------------------------------------------------- /example_app/openai_app/assets/images/q_and_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/images/q_and_a.png -------------------------------------------------------------------------------- /example_app/openai_app/assets/images/question_interview_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/images/question_interview_image.png -------------------------------------------------------------------------------- /example_app/openai_app/assets/images/robot_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/images/robot_bg.jpg -------------------------------------------------------------------------------- /example_app/openai_app/assets/images/robot_hello.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/images/robot_hello.jpg -------------------------------------------------------------------------------- /example_app/openai_app/assets/images/robot_hello.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/images/robot_hello.png -------------------------------------------------------------------------------- /example_app/openai_app/assets/images/translate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/assets/images/translate.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /example_app/openai_app/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example_app/openai_app/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example_app/openai_app/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example_app/openai_app/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example_app/openai_app/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/bloc/openai/openai_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:openai_app/models/message/message.dart'; 2 | 3 | abstract class OpenAIState {} 4 | 5 | class OpenAIInitialState extends OpenAIState {} 6 | 7 | class OpenAITokenState extends OpenAIState { 8 | final bool isSuccess; 9 | final String? token; 10 | 11 | OpenAITokenState({this.token, required this.isSuccess}); 12 | } 13 | 14 | class OpenSettingState extends OpenAIState { 15 | final bool isOpen; 16 | 17 | OpenSettingState({this.isOpen = false}); 18 | } 19 | 20 | class ChatCompletionState extends OpenAIState { 21 | final List? messages; 22 | final bool isBot; 23 | final bool showStopButton; 24 | 25 | ChatCompletionState( 26 | {this.messages, required this.isBot, required this.showStopButton}); 27 | } 28 | 29 | class AuthErrorState extends OpenAIState {} 30 | 31 | class RateLimitErrorState extends OpenAIState {} 32 | 33 | class OpenAIServerErrorState extends OpenAIState {} 34 | 35 | class CloseOpenAIErrorUI extends OpenAIState {} 36 | 37 | class ClearTextInput extends OpenAIState {} 38 | 39 | class DownloadImageState extends OpenAIState { 40 | final bool isSuccess; 41 | 42 | DownloadImageState({required this.isSuccess}); 43 | } 44 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/bloc/select_version/select_version_state.dart: -------------------------------------------------------------------------------- 1 | abstract class SelectVersionState {} 2 | 3 | class OpenAIGptVersionState extends SelectVersionState { 4 | final bool isGPT4; 5 | 6 | OpenAIGptVersionState({required this.isGPT4}); 7 | } 8 | 9 | class SelectVersionInitState extends SelectVersionState {} 10 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/bloc/theme/theme_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_bloc/flutter_bloc.dart'; 2 | import 'package:openai_app/bloc/theme/theme_state.dart'; 3 | 4 | class ThemeBloc extends Cubit { 5 | ThemeBloc() : super(null); 6 | 7 | void changeTheme() => emit(ChangeTheme()); 8 | } 9 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/bloc/theme/theme_state.dart: -------------------------------------------------------------------------------- 1 | sealed class ThemeState {} 2 | 3 | class ChangeTheme extends ThemeState {} 4 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/components/background/background_gradient.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:openai_app/constants/theme/colors.dart'; 3 | 4 | class BackgroundGradient extends StatelessWidget { 5 | const BackgroundGradient({ 6 | super.key, 7 | }); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Container( 12 | decoration: const BoxDecoration( 13 | gradient: LinearGradient( 14 | begin: Alignment.topCenter, 15 | end: Alignment.bottomCenter, 16 | colors: [Colors.transparent, kDarkBgColor])), 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/components/error/notfound_token.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:openai_app/constants/theme/colors.dart'; 3 | 4 | void errorNotFoundToken(BuildContext context) => 5 | ScaffoldMessenger.of(context).showSnackBar(SnackBar( 6 | backgroundColor: kDarkBgColor, 7 | content: Text('Error NotFound Your Token.', 8 | style: Theme.of(context).textTheme.titleMedium), 9 | )); 10 | 11 | void errorNotFoundPrompt(BuildContext context) => 12 | ScaffoldMessenger.of(context).showSnackBar(SnackBar( 13 | backgroundColor: kDarkBgColor, 14 | content: Text('Error NotFound Your Prompt.', 15 | style: Theme.of(context).textTheme.titleMedium), 16 | )); 17 | 18 | void toast(BuildContext context, {required String message}) => 19 | ScaffoldMessenger.of(context).showSnackBar(SnackBar( 20 | backgroundColor: kDarkBgColor, 21 | content: Text(message, style: Theme.of(context).textTheme.titleMedium), 22 | )); 23 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/constants/constants.dart: -------------------------------------------------------------------------------- 1 | class FeatureType { 2 | static const kCompletion = 'completion'; 3 | static const kGenerateImage = 'generate image'; 4 | static const kGrammar = 'grammar'; 5 | static const kQuestionInterview = 'question interview'; 6 | } 7 | 8 | const kExampleImageNetwork = 9 | 'https://investingnews.com/media-library/image-of-hand-holding-an-ai-face-looking-at-the-words-chatgpt-openai.jpg?id=32871272&width=980'; 10 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/constants/extension/size_box_extension.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | extension SizeBoxExtension on double { 4 | SizedBox toHeight({double height = 1.0}) { 5 | return SizedBox(height: this * height); 6 | } 7 | 8 | SizedBox toWidth() { 9 | return SizedBox(width: this); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/constants/theme/colors.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | const kShadowBgColor = Color(0xFF262626); 4 | const kButtonColor = Color(0xFF1B61EB); 5 | const kDarkItemColor = Color(0xFF17181B); 6 | const kDarkBgColor = Color(0xFF212226); 7 | const kDarkOffBgColor = Color(0xFF2F3036); 8 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/constants/theme/dimen.dart: -------------------------------------------------------------------------------- 1 | /// 2 | const kDefaultPadding = 16.0; 3 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/constants/theme/theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:google_fonts/google_fonts.dart'; 3 | import 'package:openai_app/constants/theme/colors.dart'; 4 | 5 | final theme = ThemeData( 6 | useMaterial3: true, 7 | scaffoldBackgroundColor: kDarkBgColor, 8 | primaryColor: kDarkItemColor, 9 | textTheme: TextTheme( 10 | titleSmall: GoogleFonts.openSans( 11 | fontSize: 12, color: Colors.white, fontWeight: FontWeight.w500), 12 | titleMedium: GoogleFonts.openSans( 13 | fontSize: 16, color: Colors.white, fontWeight: FontWeight.w500), 14 | displayMedium: GoogleFonts.openSans( 15 | fontSize: 38, color: Colors.white, fontWeight: FontWeight.bold), 16 | displaySmall: GoogleFonts.openSans( 17 | fontSize: 26, color: Colors.white, fontWeight: FontWeight.bold), 18 | titleLarge: GoogleFonts.openSans( 19 | fontSize: 18, color: Colors.white, fontWeight: FontWeight.bold))); 20 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/di/di.dart: -------------------------------------------------------------------------------- 1 | import 'package:get_it/get_it.dart'; 2 | import 'package:injectable/injectable.dart'; 3 | import 'package:openai_app/di/di.config.dart'; 4 | 5 | @InjectableInit() 6 | Future configureDependencies() async => await GetIt.instance.init(); 7 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/models/message/message.dart: -------------------------------------------------------------------------------- 1 | class Message { 2 | final String? id; 3 | final bool isBot; 4 | String? message; 5 | 6 | Message({this.id, this.isBot = true, this.message}); 7 | } 8 | -------------------------------------------------------------------------------- /example_app/openai_app/lib/service/shred_preference/shared_preference.dart: -------------------------------------------------------------------------------- 1 | import 'package:injectable/injectable.dart'; 2 | import 'package:shared_preferences/shared_preferences.dart'; 3 | 4 | @module 5 | abstract class SharedPreferenceService { 6 | Future get prefs => SharedPreferences.getInstance(); 7 | } 8 | 9 | class SharedRefKey { 10 | static const kAccessToken = 'access_token'; 11 | static const kGPTVersion = 'gpt_version'; 12 | static const kIsFistSetting = 'is_first_setting'; 13 | } 14 | -------------------------------------------------------------------------------- /example_app/openai_app/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /example_app/openai_app/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example_app/openai_app/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example_app/openai_app/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example_app/openai_app/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /example_app/openai_app/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import path_provider_foundation 9 | import shared_preferences_foundation 10 | 11 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 12 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 13 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 14 | } 15 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = openai_app 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.redevrx.openai.app.openaiApp 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.redevrx.openai.app. All rights reserved. 15 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_app/openai_app/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import FlutterMacOS 2 | import Cocoa 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /example_app/openai_app/privacy.md: -------------------------------------------------------------------------------- 1 | ## AI Chat Bot 2 | app is openSource your can use and learn it. 3 | 4 | ## Permission 5 | This app utilizes the write storage permission to allow users to save images within the app. 6 | -------------------------------------------------------------------------------- /example_app/openai_app/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /example_app/openai_app/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/web/favicon.png -------------------------------------------------------------------------------- /example_app/openai_app/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example_app/openai_app/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example_app/openai_app/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example_app/openai_app/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example_app/openai_app/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "openai_app", 3 | "short_name": "openai_app", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "Example use chatGPT SDK", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /example_app/openai_app/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /example_app/openai_app/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void RegisterPlugins(flutter::PluginRegistry* registry) { 12 | PermissionHandlerWindowsPluginRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); 14 | } 15 | -------------------------------------------------------------------------------- /example_app/openai_app/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example_app/openai_app/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | permission_handler_windows 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /example_app/openai_app/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /example_app/openai_app/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /example_app/openai_app/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redevrx/chat_gpt_sdk/12768c146441344effc425811f98e061739629fe/example_app/openai_app/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example_app/openai_app/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /example_app/openai_app/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /lib/src/client/client.dart: -------------------------------------------------------------------------------- 1 | export 'openai_wrapper.dart'; 2 | export 'openai_client.dart'; 3 | -------------------------------------------------------------------------------- /lib/src/client/exception/base_error_wrapper.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/error/openai_error.dart'; 2 | 3 | abstract class BaseErrorWrapper implements Exception { 4 | final OpenAIError? data; 5 | final int? code; 6 | 7 | BaseErrorWrapper({this.data, this.code}); 8 | 9 | @override 10 | String toString() => "status code :$code message :${data?.error.toMap()}\n"; 11 | } 12 | -------------------------------------------------------------------------------- /lib/src/client/exception/missing_token_exception.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/client/exception/base_error_wrapper.dart'; 2 | 3 | ///[MissingTokenException] 4 | ///not found access token 5 | class MissingTokenException extends BaseErrorWrapper { 6 | @override 7 | String toString() => 8 | "Not Missing Your Token look more https://beta.openai.com/account/api-keys"; 9 | } 10 | -------------------------------------------------------------------------------- /lib/src/client/exception/openai_exception.dart: -------------------------------------------------------------------------------- 1 | export 'missing_token_exception.dart'; 2 | export 'request_error.dart'; 3 | -------------------------------------------------------------------------------- /lib/src/client/exception/request_error.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/client/exception/base_error_wrapper.dart'; 2 | 3 | ///[RequestError] 4 | ///normal error 5 | class RequestError extends BaseErrorWrapper { 6 | RequestError({super.data, super.code}); 7 | } 8 | 9 | ///Cause: Invalid Authentication 10 | /// Solution: Ensure the correct API 11 | /// key and requesting organization are being used. 12 | class OpenAIAuthError extends BaseErrorWrapper { 13 | OpenAIAuthError({super.data, super.code}); 14 | } 15 | 16 | ///Cause: You are sending requests too quickly. 17 | /// Solution: Pace your requests. Read the Rate limit guide. 18 | class OpenAIRateLimitError extends BaseErrorWrapper { 19 | OpenAIRateLimitError({super.data, super.code}); 20 | } 21 | 22 | const kRateLimitMessage = 'Billing hard limit has been reached'; 23 | 24 | ///Cause: Issue on our servers. 25 | ///Solution: Retry your request 26 | /// after a brief wait and 27 | /// contact us if the issue persists. Check the status page. 28 | class OpenAIServerError extends BaseErrorWrapper { 29 | OpenAIServerError({super.data, super.code}); 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/client/interceptor/interceptor_wrapper.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/utils/token_builder.dart'; 2 | import 'package:dio/dio.dart'; 3 | 4 | import '../../utils/constants.dart'; 5 | 6 | class InterceptorWrapper extends Interceptor { 7 | @override 8 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) { 9 | options.headers.addAll( 10 | kHeader( 11 | TokenBuilder.build.token, 12 | TokenBuilder.build.orgId, 13 | ), 14 | ); 15 | 16 | return handler.next(options); // super.onRequest(options, handler); 17 | } 18 | 19 | @override 20 | void onResponse(Response response, ResponseInterceptorHandler handler) { 21 | //debugPrint('http status code => ${response.statusCode} \nresponse data => ${response.data}'); 22 | super.onResponse(response, handler); 23 | } 24 | 25 | @override 26 | void onError(DioException err, ErrorInterceptorHandler handler) { 27 | //debugPrint('have Error [${err.response?.statusCode}] => Data: ${err.response?.data}'); 28 | super.onError(err, handler); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/client/openai_wrapper.dart: -------------------------------------------------------------------------------- 1 | abstract class OpenAIWrapper {} 2 | -------------------------------------------------------------------------------- /lib/src/embedding.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/cancel/cancel_data.dart'; 2 | import 'package:chat_gpt_sdk/src/model/embedding/request/embed_request.dart'; 3 | import 'package:chat_gpt_sdk/src/utils/constants.dart'; 4 | import 'client/client.dart'; 5 | import 'model/embedding/response/embed_response.dart'; 6 | 7 | class Embedding { 8 | final OpenAIClient _client; 9 | Embedding(this._client); 10 | 11 | ///Get a vector representation of a given input 12 | /// that can be easily consumed by machine learning 13 | /// models and algorithms.[embedding] 14 | /// 15 | Future embedding( 16 | EmbedRequest request, { 17 | void Function(CancelData cancelData)? onCancel, 18 | }) { 19 | return _client.post( 20 | _client.apiUrl + kEmbedding, 21 | request.toJson(), 22 | onCancel: (it) => onCancel != null ? onCancel(it) : null, 23 | onSuccess: (it) => EmbedResponse.fromJson(it), 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/logger/logger.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/utils/constants.dart'; 2 | import 'dart:developer' as dev; 3 | 4 | class Logger { 5 | Logger._(); 6 | 7 | ///[instance] 8 | ///return instance of Logger 9 | static Logger instance = Logger._(); 10 | 11 | /// [isLogging] 12 | /// use for enable log 13 | bool isLogging = false; 14 | 15 | Logger builder({required bool isLogging}) { 16 | this.isLogging = isLogging; 17 | 18 | return instance; 19 | } 20 | 21 | void log(String message) { 22 | if (isLogging) dev.log(message, name: kOpenAI); 23 | } 24 | 25 | void error(Object? err, StackTrace? t, {String? message = 'error'}) { 26 | if (isLogging) dev.log('$message', error: err, stackTrace: t); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/model/assistant/response/assistant_file_data.dart: -------------------------------------------------------------------------------- 1 | class AssistantFileData { 2 | AssistantFileData({ 3 | required this.assistantId, 4 | required this.createdAt, 5 | required this.id, 6 | required this.object, 7 | }); 8 | 9 | String assistantId; 10 | int createdAt; 11 | String id; 12 | String object; 13 | 14 | factory AssistantFileData.fromJson(Map json) => 15 | AssistantFileData( 16 | assistantId: json["assistant_id"] ?? '', 17 | createdAt: json["created_at"] ?? 0, 18 | id: json["id"] ?? '', 19 | object: json["object"] ?? '', 20 | ); 21 | 22 | Map toJson() => { 23 | "assistant_id": assistantId, 24 | "created_at": createdAt, 25 | "id": id, 26 | "object": object, 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/model/assistant/response/delete_assistant.dart: -------------------------------------------------------------------------------- 1 | class DeleteAssistant { 2 | DeleteAssistant({ 3 | required this.deleted, 4 | required this.id, 5 | required this.object, 6 | }); 7 | 8 | bool deleted; 9 | String id; 10 | String object; 11 | 12 | factory DeleteAssistant.fromJson(Map json) => 13 | DeleteAssistant( 14 | deleted: json["deleted"], 15 | id: json["id"], 16 | object: json["object"], 17 | ); 18 | 19 | Map toJson() => { 20 | "deleted": deleted, 21 | "id": id, 22 | "object": object, 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /lib/src/model/assistant/response/list_assistant_file.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/assistant/response/assistant_file_data.dart'; 2 | 3 | class ListAssistantFile { 4 | String object; 5 | List data; 6 | String firstId; 7 | String lastId; 8 | bool hasMore; 9 | 10 | ListAssistantFile({ 11 | required this.object, 12 | required this.data, 13 | required this.firstId, 14 | required this.lastId, 15 | required this.hasMore, 16 | }); 17 | 18 | factory ListAssistantFile.fromJson(Map json) => 19 | ListAssistantFile( 20 | object: json["object"] ?? '', 21 | data: json["data"] == null 22 | ? [] 23 | : List.from( 24 | json["data"].map((x) => AssistantFileData.fromJson(x)), 25 | ), 26 | firstId: json["first_id"] ?? '', 27 | lastId: json["last_id"] ?? '', 28 | hasMore: json["has_more"] ?? '', 29 | ); 30 | 31 | Map toJson() => { 32 | "object": object, 33 | "data": data.map((x) => x.toJson()), 34 | "first_id": firstId, 35 | "last_id": lastId, 36 | "has_more": hasMore, 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /lib/src/model/assistant/response/tool.dart: -------------------------------------------------------------------------------- 1 | class Tool { 2 | Tool({ 3 | required this.type, 4 | }); 5 | 6 | String type; 7 | 8 | factory Tool.fromJson(Map json) => Tool( 9 | type: json["type"], 10 | ); 11 | 12 | Map toJson() => { 13 | "type": type, 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /lib/src/model/audio/enum/audio_format.dart: -------------------------------------------------------------------------------- 1 | ///audio response format.[AudioFormat] 2 | enum AudioFormat { json, text, srt, verboseJson, vtt } 3 | 4 | extension AudioFormatExtension on AudioFormat { 5 | String getName() { 6 | switch (this) { 7 | case AudioFormat.json: 8 | return 'json'; 9 | case AudioFormat.text: 10 | return 'text'; 11 | case AudioFormat.srt: 12 | return 'srt'; 13 | case AudioFormat.verboseJson: 14 | return 'verbose_json'; 15 | case AudioFormat.vtt: 16 | return 'vtt'; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/src/model/audio/response/audio_response.dart: -------------------------------------------------------------------------------- 1 | class AudioResponse { 2 | final String text; 3 | 4 | AudioResponse(this.text); 5 | 6 | factory AudioResponse.fromJson(Map json) => 7 | AudioResponse(json["text"]); 8 | } 9 | -------------------------------------------------------------------------------- /lib/src/model/cancel/cancel_data.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | class CancelData { 4 | final CancelToken cancelToken; 5 | 6 | CancelData({required this.cancelToken}); 7 | } 8 | -------------------------------------------------------------------------------- /lib/src/model/chat_complete/enum/function_call.dart: -------------------------------------------------------------------------------- 1 | enum FunctionCall { auto, none } 2 | -------------------------------------------------------------------------------- /lib/src/model/chat_complete/enum/role.dart: -------------------------------------------------------------------------------- 1 | enum Role { system, user, assistant, function } 2 | -------------------------------------------------------------------------------- /lib/src/model/chat_complete/request/function_data.dart: -------------------------------------------------------------------------------- 1 | @Deprecated('') 2 | class FunctionData { 3 | ///The name of the function to be called. 4 | /// Must be a-z, A-Z, 0-9, or contain underscores 5 | /// and dashes, with a maximum length of 64. 6 | /// [name] 7 | final String name; 8 | 9 | ///The description of what the function does. 10 | ///[description] 11 | final String? description; 12 | 13 | ///parameters object Optional 14 | /// The parameters the functions accepts, 15 | /// described as a JSON Schema object. 16 | /// See the 17 | /// guide for examples, 18 | /// and the JSON Schema reference 19 | /// for documentation about the format. 20 | /// [parameters] 21 | final Map? parameters; 22 | 23 | FunctionData({required this.name, this.description, this.parameters}); 24 | 25 | Map toJson() => Map.of( 26 | { 27 | "name": name, 28 | "description": description, 29 | "parameters": parameters, 30 | }, 31 | ); 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/model/chat_complete/request/json_schema.dart: -------------------------------------------------------------------------------- 1 | class JsonSchema { 2 | final String name; 3 | final Map schema; 4 | final bool strict = true; 5 | 6 | JsonSchema({required this.name, required this.schema}); 7 | 8 | Map toJson() { 9 | final data = {}; 10 | data['name'] = name; 11 | data['schema'] = schema; 12 | data['strict'] = strict; 13 | 14 | return data; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/src/model/chat_complete/request/response_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/chat_complete/request/json_schema.dart'; 2 | 3 | class ResponseFormat { 4 | final String type; 5 | final JsonSchema? jsonSchema; 6 | 7 | ResponseFormat({required this.type, this.jsonSchema}); 8 | 9 | ResponseFormat.jsonSchema({required this.jsonSchema}) : type = 'json_schema'; 10 | 11 | Map toJson() { 12 | final data = {}; 13 | data['type'] = type; 14 | if (jsonSchema != null) { 15 | data['json_schema'] = jsonSchema!.toJson(); 16 | } 17 | 18 | return data; 19 | } 20 | 21 | static final jsonObject = ResponseFormat(type: "json_object"); 22 | } 23 | -------------------------------------------------------------------------------- /lib/src/model/chat_complete/response/chat_choice.dart: -------------------------------------------------------------------------------- 1 | import 'message.dart'; 2 | 3 | class ChatChoice { 4 | final String id = "${DateTime.now().millisecondsSinceEpoch}"; 5 | final int index; 6 | final Message? message; 7 | final String? finishReason; 8 | 9 | ChatChoice({required this.index, required this.message, this.finishReason}); 10 | 11 | factory ChatChoice.fromJson(Map json) => ChatChoice( 12 | index: json["index"], 13 | message: 14 | json["message"] == null ? null : Message.fromJson(json["message"]), 15 | finishReason: json["finish_reason"], 16 | ); 17 | 18 | Map toJson() => { 19 | "index": index, 20 | "message": message?.toJson(), 21 | "finish_reason": finishReason ?? "", 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/model/chat_complete/response/chat_choice_sse.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/chat_complete/response/message.dart'; 2 | 3 | class ChatChoiceSSE { 4 | final String id = "${DateTime.now().millisecondsSinceEpoch}"; 5 | final int index; 6 | final Message? message; 7 | final String? finishReason; 8 | 9 | ChatChoiceSSE({ 10 | required this.index, 11 | required this.message, 12 | this.finishReason, 13 | }); 14 | 15 | factory ChatChoiceSSE.fromJson(Map json) => ChatChoiceSSE( 16 | index: json["index"], 17 | message: json["delta"] == null ? null : Message.fromJson(json["delta"]), 18 | finishReason: 19 | json["finish_reason"] == null ? "" : json["finish_reason"], 20 | ); 21 | 22 | Map toJson() => { 23 | "index": index, 24 | "delta": message?.toJson(), 25 | "finish_reason": finishReason ?? "", 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/model/chat_complete/response/message.dart: -------------------------------------------------------------------------------- 1 | class Message { 2 | final String role; 3 | final String content; 4 | final String id = "${DateTime.now().millisecondsSinceEpoch}"; 5 | final Map? functionCall; 6 | final List>? toolCalls; 7 | 8 | Message({ 9 | required this.role, 10 | required this.content, 11 | this.functionCall, 12 | this.toolCalls, 13 | }); 14 | 15 | factory Message.fromJson(Map json) => Message( 16 | role: json["role"] ?? "", 17 | content: json["content"] ?? "", 18 | functionCall: json["function_call"], 19 | toolCalls: json['tool_calls'] == null 20 | ? null 21 | : List>.from( 22 | json["tool_calls"].map((x) => Map.from(x)), 23 | ), 24 | ); 25 | 26 | Map toJson() => { 27 | "role": role, 28 | "content": content, 29 | "function_call": functionCall, 30 | "tool_calls": toolCalls, 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/model/client/http_setup.dart: -------------------------------------------------------------------------------- 1 | class HttpSetup { 2 | Duration sendTimeout; 3 | Duration connectTimeout; 4 | Duration receiveTimeout; 5 | String proxy; 6 | 7 | // Experimental streaming web api with fetch as dio adapter 8 | bool streamingWebApi; 9 | 10 | HttpSetup({ 11 | this.sendTimeout = const Duration(seconds: 6), 12 | this.connectTimeout = const Duration(seconds: 6), 13 | this.receiveTimeout = const Duration(seconds: 6), 14 | this.proxy = '', 15 | this.streamingWebApi = false, 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/model/complete_text/enum/model.dart: -------------------------------------------------------------------------------- 1 | import '../../../utils/constants.dart'; 2 | 3 | sealed class Model { 4 | String model; 5 | Model({required this.model}); 6 | } 7 | 8 | class Gpt3TurboInstruct extends Model { 9 | Gpt3TurboInstruct() : super(model: kGpt3TurboInstruct); 10 | } 11 | 12 | class ModelFromValue extends Model { 13 | ModelFromValue({required super.model}); 14 | } 15 | 16 | class Davinci002Model extends Model { 17 | Davinci002Model() : super(model: kDavinci002Model); 18 | } 19 | 20 | class Babbage002Model extends Model { 21 | Babbage002Model() : super(model: kBabbage002Model); 22 | } 23 | -------------------------------------------------------------------------------- /lib/src/model/complete_text/response/choices.dart: -------------------------------------------------------------------------------- 1 | class Choices { 2 | final String text; 3 | final int index; 4 | // final dynamic logprobs; 5 | final String? finishReason; 6 | final String id = "${DateTime.now().millisecondsSinceEpoch}"; 7 | 8 | Choices(this.text, this.index, this.finishReason); 9 | 10 | factory Choices.fromJson(Map json) => Choices( 11 | json['text'], 12 | json['index'], 13 | // json['logprobs'], 14 | json['finish_reason'], 15 | ); 16 | 17 | Map toJson() => choicesToJson(this); 18 | 19 | Map choicesToJson(Choices instance) => { 20 | 'text': instance.text, 21 | 'index': instance.index, 22 | // 'logprobs': instance.logprobs, 23 | 'finish_reason': instance.finishReason, 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /lib/src/model/complete_text/response/usage.dart: -------------------------------------------------------------------------------- 1 | class Usage { 2 | final int? promptTokens; 3 | final int? completionTokens; 4 | final int? totalTokens; 5 | final String id = "${DateTime.now().millisecondsSinceEpoch}"; 6 | 7 | Usage(this.promptTokens, this.completionTokens, this.totalTokens); 8 | 9 | factory Usage.fromJson(Map json) => Usage( 10 | json['prompt_tokens'], 11 | json['completion_tokens'], 12 | json['total_tokens'], 13 | ); 14 | Map toJson() => usageToJson(this); 15 | 16 | Map usageToJson(Usage instance) => { 17 | 'prompt_tokens': instance.promptTokens, 18 | 'completion_tokens': instance.completionTokens, 19 | 'total_tokens': instance.totalTokens, 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/model/edits/enum/edit_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/utils/constants.dart'; 2 | 3 | sealed class EditModel { 4 | String model; 5 | EditModel({required this.model}); 6 | } 7 | 8 | class Gpt4 extends EditModel { 9 | Gpt4() : super(model: kChatGpt4); 10 | } 11 | 12 | class EditModelFromValue extends EditModel { 13 | EditModelFromValue({required super.model}); 14 | } 15 | -------------------------------------------------------------------------------- /lib/src/model/embedding/enum/embed_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/utils/constants.dart'; 2 | 3 | sealed class EmbedModel { 4 | String model; 5 | EmbedModel({required this.model}); 6 | } 7 | 8 | class TextEmbeddingAda002EmbedModel extends EmbedModel { 9 | TextEmbeddingAda002EmbedModel() : super(model: kEmbeddingAda002); 10 | } 11 | 12 | class TextEmbedding3SmallModel extends EmbedModel { 13 | TextEmbedding3SmallModel() : super(model: kTextEmbedding3Small); 14 | } 15 | 16 | class TextEmbedding3LargeModel extends EmbedModel { 17 | TextEmbedding3LargeModel() : super(model: kTextEmbedding3Large); 18 | } 19 | 20 | class EmbedModelFromValue extends EmbedModel { 21 | EmbedModelFromValue({required super.model}); 22 | } 23 | -------------------------------------------------------------------------------- /lib/src/model/embedding/response/embed_data.dart: -------------------------------------------------------------------------------- 1 | class EmbedData { 2 | EmbedData({ 3 | required this.object, 4 | required this.embedding, 5 | required this.index, 6 | }); 7 | 8 | String object; 9 | List embedding; 10 | int index; 11 | 12 | factory EmbedData.fromJson(Map json) => EmbedData( 13 | object: json["object"], 14 | embedding: 15 | List.from(json["embedding"].map((x) => x?.toDouble())), 16 | index: json["index"], 17 | ); 18 | 19 | Map toJson() => { 20 | "object": object, 21 | "embedding": embedding, 22 | "index": index, 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /lib/src/model/embedding/response/embed_response.dart: -------------------------------------------------------------------------------- 1 | import '../../complete_text/response/usage.dart'; 2 | import 'embed_data.dart'; 3 | 4 | class EmbedResponse { 5 | EmbedResponse({ 6 | required this.object, 7 | required this.data, 8 | required this.model, 9 | required this.usage, 10 | }); 11 | 12 | String object; 13 | List data; 14 | String model; 15 | Usage usage; 16 | 17 | factory EmbedResponse.fromJson(Map json) => EmbedResponse( 18 | object: json["object"], 19 | data: List.from( 20 | json["data"].map((x) => EmbedData.fromJson(x)), 21 | ), 22 | model: json["model"], 23 | usage: Usage.fromJson(json["usage"]), 24 | ); 25 | 26 | Map toJson() => { 27 | "object": object, 28 | "data": List.from(data.map((x) => x.toJson())), 29 | "model": model, 30 | "usage": usage.toJson(), 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/model/error/openai_error.dart: -------------------------------------------------------------------------------- 1 | class OpenAIError { 2 | final String message; 3 | final ErrorData error; 4 | 5 | OpenAIError({required this.message, required this.error}); 6 | 7 | factory OpenAIError.fromJson(Map? json, String message) => 8 | OpenAIError( 9 | message: message, 10 | error: ErrorData.fromJson(json?['error']), 11 | ); 12 | } 13 | 14 | class ErrorData { 15 | final String? message; 16 | final String? type; 17 | final String? code; 18 | 19 | ErrorData({this.message, this.type, this.code}); 20 | 21 | factory ErrorData.fromJson(Map? json) { 22 | if (json == null) { 23 | return ErrorData(); 24 | } 25 | 26 | return ErrorData( 27 | message: json['message'], 28 | code: json['code'], 29 | type: json['type'], 30 | ); 31 | } 32 | 33 | Map toMap() => 34 | Map.of({'message': message, 'code': code, 'type': type}); 35 | } 36 | -------------------------------------------------------------------------------- /lib/src/model/file/request/upload_file.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:chat_gpt_sdk/src/model/gen_image/request/file_info.dart'; 4 | import 'package:dio/dio.dart'; 5 | 6 | class UploadFile { 7 | ///Name of the JSON Lines file to be uploaded. 8 | ///If the is set to "fine-tune", 9 | ///each line is a JSON record with "prompt" and "completion" 10 | /// fields representing your training examples.purpose. [file] 11 | final FileInfo file; 12 | 13 | ///The intended purpose of the uploaded documents. 14 | ///Use "fine-tune" for Fine-tuning. 15 | ///This allows us to validate the format of the uploaded file.[purpose] 16 | final String purpose; 17 | 18 | UploadFile({required this.file, this.purpose = 'fine-tune'}); 19 | 20 | Future getForm() async { 21 | return FormData.fromMap({ 22 | 'file': (await File(file.path).exists()) 23 | ? await MultipartFile.fromFile(file.path, filename: file.name) 24 | : null, 25 | 'purpose': purpose, 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/model/file/response/delete_file.dart: -------------------------------------------------------------------------------- 1 | class DeleteFile { 2 | DeleteFile({ 3 | required this.id, 4 | required this.object, 5 | required this.deleted, 6 | }); 7 | 8 | String id; 9 | String object; 10 | bool deleted; 11 | 12 | factory DeleteFile.fromJson(Map json) => DeleteFile( 13 | id: json["id"], 14 | object: json["object"], 15 | deleted: json["deleted"], 16 | ); 17 | 18 | Map toJson() => { 19 | "id": id, 20 | "object": object, 21 | "deleted": deleted, 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/model/file/response/file_data.dart: -------------------------------------------------------------------------------- 1 | class FileData { 2 | FileData({ 3 | required this.id, 4 | required this.object, 5 | required this.bytes, 6 | required this.createdAt, 7 | required this.filename, 8 | required this.purpose, 9 | }); 10 | 11 | String id; 12 | String object; 13 | int bytes; 14 | int createdAt; 15 | String filename; 16 | String purpose; 17 | 18 | factory FileData.fromJson(Map json) => FileData( 19 | id: json["id"], 20 | object: json["object"], 21 | bytes: json["bytes"], 22 | createdAt: json["created_at"], 23 | filename: json["filename"], 24 | purpose: json["purpose"], 25 | ); 26 | 27 | Map toJson() => { 28 | "id": id, 29 | "object": object, 30 | "bytes": bytes, 31 | "created_at": createdAt, 32 | "filename": filename, 33 | "purpose": purpose, 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /lib/src/model/file/response/file_response.dart: -------------------------------------------------------------------------------- 1 | import 'file_data.dart'; 2 | 3 | class FileResponse { 4 | FileResponse({ 5 | required this.data, 6 | required this.object, 7 | }); 8 | 9 | List data; 10 | String object; 11 | 12 | factory FileResponse.fromJson(Map json) => FileResponse( 13 | data: json["data"] == null || json["data"] == [] 14 | ? List.empty() 15 | : (json["data"] as List).map((e) => FileData.fromJson(e)).toList(), 16 | object: json["object"], 17 | ); 18 | 19 | Map toJson() => { 20 | "data": data, 21 | "object": object, 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/model/file/response/upload_response.dart: -------------------------------------------------------------------------------- 1 | class UploadResponse { 2 | UploadResponse({ 3 | required this.id, 4 | required this.object, 5 | required this.bytes, 6 | required this.createdAt, 7 | required this.filename, 8 | required this.purpose, 9 | }); 10 | 11 | String id; 12 | String object; 13 | int bytes; 14 | int createdAt; 15 | String filename; 16 | String purpose; 17 | 18 | factory UploadResponse.fromJson(Map json) => UploadResponse( 19 | id: json["id"], 20 | object: json["object"], 21 | bytes: json["bytes"], 22 | createdAt: json["created_at"], 23 | filename: json["filename"], 24 | purpose: json["purpose"], 25 | ); 26 | 27 | Map toJson() => { 28 | "id": id, 29 | "object": object, 30 | "bytes": bytes, 31 | "created_at": createdAt, 32 | "filename": filename, 33 | "purpose": purpose, 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /lib/src/model/fine_tune/enum/fine_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/utils/constants.dart'; 2 | 3 | sealed class FineModel { 4 | String model; 5 | FineModel({required this.model}); 6 | } 7 | 8 | class GptTurbo0631Model extends FineModel { 9 | GptTurbo0631Model() : super(model: kChatGptTurbo0613); 10 | } 11 | 12 | class Babbage002FineModel extends FineModel { 13 | Babbage002FineModel() : super(model: kBabbage002Model); 14 | } 15 | 16 | class FineModelFromValue extends FineModel { 17 | FineModelFromValue({required super.model}); 18 | } 19 | -------------------------------------------------------------------------------- /lib/src/model/fine_tune/request/hyper_parameter.dart: -------------------------------------------------------------------------------- 1 | class Hyperparameter { 2 | ///string or integer Optional Defaults to auto [nEpochs] 3 | ///The number of epochs to train the model for. 4 | /// An epoch refers to one full cycle through the training dataset. 5 | final Object nEpochs; 6 | 7 | ///A string of up to 18 characters that will be added to your 8 | /// fine-tuned model name. 9 | /// For example, a suffix of "custom-model-name" would produce a model 10 | /// name like ft:gpt-3.5-turbo:openai:custom-model-name:7p4lURel. 11 | final String? suffix; 12 | 13 | Hyperparameter({required this.nEpochs, this.suffix}); 14 | 15 | factory Hyperparameter.fromJson(Map json) => Hyperparameter( 16 | nEpochs: json["n_epochs"], 17 | ); 18 | 19 | Map toJson() => Map.of({ 20 | "n_epochs": nEpochs, 21 | "suffix": suffix, 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/model/fine_tune/response/fine_tune_delete.dart: -------------------------------------------------------------------------------- 1 | class FineTuneDelete { 2 | final String id; 3 | final String object; 4 | final bool deleted; 5 | 6 | FineTuneDelete({ 7 | required this.id, 8 | required this.object, 9 | required this.deleted, 10 | }); 11 | 12 | factory FineTuneDelete.fromJson(Map json) => FineTuneDelete( 13 | id: json['id'], 14 | object: json['object'], 15 | deleted: json['deleted'], 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/model/fine_tune/response/fine_tune_event.dart: -------------------------------------------------------------------------------- 1 | class FineTuneEvent { 2 | /// The date the event was created. 3 | final DateTime createdAt; 4 | 5 | /// The level of the event. 6 | final String? level; 7 | 8 | /// The message of the event. 9 | final String? message; 10 | 11 | const FineTuneEvent({ 12 | required this.createdAt, 13 | required this.level, 14 | required this.message, 15 | }); 16 | 17 | factory FineTuneEvent.fromJson(Map json) { 18 | return FineTuneEvent( 19 | createdAt: DateTime.fromMillisecondsSinceEpoch( 20 | json['created_at'] == null ? 0 : json['created_at'] * 1000, 21 | ), 22 | level: json['level'], 23 | message: json['message'], 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/model/fine_tune/response/fine_tune_hyper_params.dart: -------------------------------------------------------------------------------- 1 | class FineTuneHyperParams { 2 | /// The batch size used for fine-tuning. 3 | final int? batchSize; 4 | 5 | /// The learning rate multiplier used for fine-tuning. 6 | final double? learningRateMultiplier; 7 | 8 | /// The number of epochs used for fine-tuning. 9 | final int? nEpochs; 10 | 11 | /// The prompt loss weight used for fine-tuning. 12 | final double? promptLossWeight; 13 | 14 | const FineTuneHyperParams({ 15 | required this.batchSize, 16 | required this.learningRateMultiplier, 17 | required this.nEpochs, 18 | required this.promptLossWeight, 19 | }); 20 | 21 | factory FineTuneHyperParams.fromJson(Map json) { 22 | return FineTuneHyperParams( 23 | batchSize: json['batch_size'], 24 | learningRateMultiplier: json['learning_rate_multiplier'], 25 | nEpochs: json['n_epochs'], 26 | promptLossWeight: json['prompt_loss_weight'], 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/src/model/fine_tune/response/training_files.dart: -------------------------------------------------------------------------------- 1 | class TrainingFiles { 2 | /// The id of the file. 3 | final String id; 4 | 5 | /// The number of bytes in the file. 6 | final int bytes; 7 | 8 | /// The time the file was created. 9 | final DateTime createdAt; 10 | 11 | /// The name of the file. 12 | final String filename; 13 | 14 | /// The purpose of the file. 15 | final String? purpose; 16 | 17 | const TrainingFiles({ 18 | required this.id, 19 | required this.bytes, 20 | required this.createdAt, 21 | required this.filename, 22 | required this.purpose, 23 | }); 24 | 25 | factory TrainingFiles.fromJson(Map json) { 26 | return TrainingFiles( 27 | id: json['id'], 28 | bytes: json['bytes'], 29 | createdAt: DateTime.fromMillisecondsSinceEpoch( 30 | json['created_at'] == null ? 0 : json['created_at'] * 1000, 31 | ), 32 | filename: json['filename'], 33 | purpose: json['purpose'], 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/src/model/gen_image/enum/format.dart: -------------------------------------------------------------------------------- 1 | ///The format in which the generated images are returned. Must be one of url or b64_json. 2 | enum Format { 3 | url, 4 | b64Json; 5 | } 6 | 7 | extension FormatExtension on Format { 8 | String getName() { 9 | switch (this) { 10 | case Format.url: 11 | return 'url'; 12 | case Format.b64Json: 13 | return 'b64_json'; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/src/model/gen_image/enum/generate_image_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | 3 | sealed class GenerateImageModel { 4 | final String model; 5 | 6 | GenerateImageModel({required this.model}); 7 | } 8 | 9 | class DallE2 extends GenerateImageModel { 10 | DallE2() : super(model: kDallE2); 11 | } 12 | 13 | class DallE3 extends GenerateImageModel { 14 | DallE3() : super(model: kDallE3); 15 | } 16 | -------------------------------------------------------------------------------- /lib/src/model/gen_image/enum/image_size.dart: -------------------------------------------------------------------------------- 1 | ///The size of the generated images. 2 | enum ImageSize { 3 | size1024("1024x1024"), 4 | size512("512x512"), 5 | size256("256x256"); 6 | 7 | const ImageSize(this.size); 8 | final String size; 9 | } 10 | -------------------------------------------------------------------------------- /lib/src/model/gen_image/response/gen_img_response.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/gen_image/response/image_data.dart'; 2 | 3 | class GenImgResponse { 4 | GenImgResponse({ 5 | this.created, 6 | this.data, 7 | }); 8 | 9 | int? created; 10 | List? data; 11 | final String conversionId = "${DateTime.now().millisecondsSinceEpoch}"; 12 | 13 | factory GenImgResponse.fromJson(Map json) => GenImgResponse( 14 | created: json["created"], 15 | data: json["data"] == null 16 | ? [] 17 | : List.from( 18 | json["data"]!.map((x) => ImageData.fromJson(x)), 19 | ), 20 | ); 21 | 22 | Map toJson() => { 23 | "created": created, 24 | "data": 25 | data == null ? [] : List.from(data!.map((x) => x!.toJson())), 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/model/gen_image/response/image_data.dart: -------------------------------------------------------------------------------- 1 | class ImageData { 2 | ImageData({this.url, this.b64Json}); 3 | 4 | String? url; 5 | String? b64Json; 6 | final String id = "${DateTime.now().millisecondsSinceEpoch}"; 7 | 8 | factory ImageData.fromJson(Map json) => 9 | ImageData(url: json["url"], b64Json: json["b64_json"]); 10 | 11 | Map toJson() => {"url": url, "b64_json": b64Json}; 12 | } 13 | -------------------------------------------------------------------------------- /lib/src/model/message/response/content.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/message/response/text_data.dart'; 2 | 3 | class Content { 4 | Content({ 5 | required this.text, 6 | required this.type, 7 | }); 8 | 9 | TextData? text; 10 | String type; 11 | 12 | factory Content.fromJson(Map json) => Content( 13 | text: json["text"] == null ? null : TextData.fromJson(json["text"]), 14 | type: json["type"] ?? '', 15 | ); 16 | 17 | Map toJson() => { 18 | "text": text?.toJson(), 19 | "type": type, 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/model/message/response/content_v2.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/message/response/text_data.dart'; 2 | import 'package:chat_gpt_sdk/src/model/message/response/image_data.dart'; 3 | 4 | class ContentV2 { 5 | String type; 6 | TextData? text; 7 | ImageData? image; 8 | 9 | ContentV2({ 10 | required this.type, 11 | this.text, 12 | this.image, 13 | }); 14 | 15 | factory ContentV2.fromJson(Map json) { 16 | final type = json["type"]; 17 | final image = (type == 'image_url' || type == 'image_file') 18 | ? json[type] != null 19 | ? ImageData.fromJson(json[type]!) 20 | : null 21 | : null; 22 | 23 | return ContentV2( 24 | type: type, 25 | text: type == 'text' && json["text"] != null 26 | ? TextData.fromJson(json["text"]!) 27 | : null, 28 | image: image, 29 | ); 30 | } 31 | 32 | Map toJson() => { 33 | "type": type, 34 | "text": text?.toJson(), 35 | type: image?.toJson(), // Dynamically set 'image_url' or 'image_file' 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /lib/src/model/message/response/create_message_response.dart: -------------------------------------------------------------------------------- 1 | import 'message_data.dart'; 2 | 3 | class CreateMessageResponse { 4 | CreateMessageResponse({ 5 | required this.firstId, 6 | required this.data, 7 | required this.lastId, 8 | required this.hasMore, 9 | required this.object, 10 | }); 11 | 12 | String firstId; 13 | List data; 14 | String lastId; 15 | bool hasMore; 16 | String object; 17 | 18 | factory CreateMessageResponse.fromJson(Map json) => 19 | CreateMessageResponse( 20 | firstId: json["first_id"] ?? '', 21 | data: json["data"] == null 22 | ? [] 23 | : List.from( 24 | json["data"].map((x) => MessageData.fromJson(x)), 25 | ), 26 | lastId: json["last_id"] ?? '', 27 | hasMore: json["has_more"] ?? false, 28 | object: json["object"] ?? '', 29 | ); 30 | 31 | Map toJson() => { 32 | "first_id": firstId, 33 | "data": data.map((x) => x.toJson()).toList(), 34 | "last_id": lastId, 35 | "has_more": hasMore, 36 | "object": object, 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /lib/src/model/message/response/image_data.dart: -------------------------------------------------------------------------------- 1 | class ImageData { 2 | String? url; 3 | String? fileId; 4 | String? detail; 5 | 6 | ImageData({ 7 | this.url, 8 | this.fileId, 9 | this.detail, 10 | }); 11 | 12 | factory ImageData.fromJson(Map json) => ImageData( 13 | fileId: json["file_id"] ?? '', 14 | url: json["url"] ?? '', 15 | detail: json["detail"] ?? '', 16 | ); 17 | 18 | Map toJson() => { 19 | "file_id": fileId, 20 | "url": url, 21 | "detail": detail, 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/model/message/response/list_message_file.dart: -------------------------------------------------------------------------------- 1 | import 'list_message_file_data.dart'; 2 | 3 | class ListMessageFile { 4 | ListMessageFile({ 5 | required this.firstId, 6 | required this.data, 7 | required this.lastId, 8 | required this.hasMore, 9 | required this.object, 10 | }); 11 | 12 | String firstId; 13 | List data; 14 | String lastId; 15 | bool hasMore; 16 | String object; 17 | 18 | factory ListMessageFile.fromJson(Map json) => 19 | ListMessageFile( 20 | firstId: json["first_id"] ?? '', 21 | data: json["data"] == null 22 | ? [] 23 | : List.from( 24 | json["data"].map((x) => ListMessageFileData.fromJson(x)), 25 | ), 26 | lastId: json["last_id"] ?? '', 27 | hasMore: json["has_more"] ?? false, 28 | object: json["object"] ?? '', 29 | ); 30 | 31 | Map toJson() => { 32 | "first_id": firstId, 33 | "data": data.map((x) => x.toJson()), 34 | "last_id": lastId, 35 | "has_more": hasMore, 36 | "object": object, 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /lib/src/model/message/response/list_message_file_data.dart: -------------------------------------------------------------------------------- 1 | class ListMessageFileData { 2 | ListMessageFileData({ 3 | required this.createdAt, 4 | required this.messageId, 5 | required this.id, 6 | required this.object, 7 | }); 8 | 9 | int createdAt; 10 | String messageId; 11 | String id; 12 | String object; 13 | 14 | factory ListMessageFileData.fromJson(Map json) => 15 | ListMessageFileData( 16 | createdAt: json["created_at"] ?? 0, 17 | messageId: json["message_id"] ?? '', 18 | id: json["id"] ?? '', 19 | object: json["object"] ?? '', 20 | ); 21 | 22 | Map toJson() => { 23 | "created_at": createdAt, 24 | "message_id": messageId, 25 | "id": id, 26 | "object": object, 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/model/message/response/text_data.dart: -------------------------------------------------------------------------------- 1 | class TextData { 2 | TextData({ 3 | required this.annotations, 4 | required this.value, 5 | }); 6 | 7 | List annotations; 8 | String value; 9 | 10 | factory TextData.fromJson(Map json) => TextData( 11 | annotations: json["annotations"] == null 12 | ? [] 13 | : List.from(json["annotations"].map((x) => x)), 14 | value: json["value"] ?? '', 15 | ); 16 | 17 | Map toJson() => { 18 | "annotations": List.from(annotations.map((x) => x)), 19 | "value": value, 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/model/moderation/enum/moderation_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/utils/constants.dart'; 2 | 3 | sealed class ModerationModel { 4 | String model; 5 | ModerationModel({required this.model}); 6 | } 7 | 8 | class TextLastModerationModel extends ModerationModel { 9 | TextLastModerationModel() : super(model: kTextMLast); 10 | } 11 | 12 | class TextStableModerationModel extends ModerationModel { 13 | TextStableModerationModel() : super(model: kTextMStable); 14 | } 15 | 16 | class ModerationModelFromValue extends ModerationModel { 17 | ModerationModelFromValue({required super.model}); 18 | } 19 | -------------------------------------------------------------------------------- /lib/src/model/moderation/response/moderation_data.dart: -------------------------------------------------------------------------------- 1 | import 'moderation_result.dart'; 2 | 3 | class ModerationData { 4 | ModerationData({ 5 | required this.id, 6 | required this.model, 7 | required this.results, 8 | }); 9 | late final String id; 10 | late final String model; 11 | late final List results; 12 | 13 | ModerationData.fromJson(Map json) { 14 | id = json['id']; 15 | model = json['model']; 16 | results = json['results'] == null 17 | ? List.empty() 18 | : List.from(json['results']) 19 | .map((e) => ModerationResult.fromJson(e)) 20 | .toList(); 21 | } 22 | 23 | Map toJson() { 24 | final data = {}; 25 | data['id'] = id; 26 | data['model'] = model; 27 | data['results'] = results.map((e) => e.toJson()).toList(); 28 | 29 | return data; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/model/moderation/response/moderation_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/moderation/response/categories.dart'; 2 | import 'package:chat_gpt_sdk/src/model/moderation/response/category_scores.dart'; 3 | 4 | class ModerationResult { 5 | ModerationResult({ 6 | required this.categories, 7 | required this.categoryScores, 8 | required this.flagged, 9 | }); 10 | late final Categories categories; 11 | late final CategoryScores categoryScores; 12 | late final bool flagged; 13 | 14 | ModerationResult.fromJson(Map json) { 15 | categories = Categories.fromJson(json['categories']); 16 | categoryScores = CategoryScores.fromJson(json['category_scores']); 17 | flagged = json['flagged']; 18 | } 19 | 20 | Map toJson() { 21 | final data = {}; 22 | data['categories'] = categories.toJson(); 23 | data['category_scores'] = categoryScores.toJson(); 24 | data['flagged'] = flagged; 25 | 26 | return data; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/model/openai_engine/engine_data.dart: -------------------------------------------------------------------------------- 1 | class EngineData { 2 | final String id; 3 | final String object; 4 | final String owner; 5 | final bool ready; 6 | 7 | EngineData(this.id, this.object, this.owner, this.ready); 8 | factory EngineData.fromJson(Map json) => EngineData( 9 | json['id'] as String, 10 | json['object'] as String, 11 | json['owner'] as String, 12 | json['ready'] as bool, 13 | ); 14 | Map toJson() => engineDataToJson(this); 15 | 16 | Map engineDataToJson(EngineData instance) => 17 | { 18 | 'id': instance.id, 19 | 'object': instance.object, 20 | 'owner': instance.owner, 21 | 'ready': instance.ready, 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/model/openai_engine/engine_model.dart: -------------------------------------------------------------------------------- 1 | import 'engine_data.dart'; 2 | 3 | class EngineModel { 4 | final List data; 5 | final String object; 6 | 7 | EngineModel(this.data, this.object); 8 | factory EngineModel.fromJson(Map json) => EngineModel( 9 | (json['data'] as List) 10 | .map((e) => EngineData.fromJson(e as Map)) 11 | .toList(), 12 | json['object'] as String, 13 | ); 14 | 15 | Map toJson() => engineModelToJson(this); 16 | Map engineModelToJson(EngineModel instance) => 17 | { 18 | 'data': instance.data, 19 | 'object': instance.object, 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/model/openai_model/model_data.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/openai_model/permission.dart'; 2 | 3 | class ModelData { 4 | final String id; 5 | final String object; 6 | final String ownerBy; 7 | final List? permission; 8 | 9 | ModelData(this.id, this.object, this.ownerBy, this.permission); 10 | factory ModelData.fromJson(Map json) => ModelData( 11 | json['id'] as String, 12 | json['object'] as String, 13 | json['owned_by'] as String, 14 | json['permission'] == null 15 | ? null 16 | : (json['permission'] as List) 17 | .map((e) => Permission.fromJson(e as Map)) 18 | .toList(), 19 | ); 20 | 21 | Map toJson() => { 22 | 'id': id, 23 | 'object': object, 24 | 'owned_by': ownerBy, 25 | 'permission': permission, 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/model/openai_model/openai_model.dart: -------------------------------------------------------------------------------- 1 | import 'model_data.dart'; 2 | 3 | class OpenAiModel { 4 | final List data; 5 | final String object; 6 | 7 | OpenAiModel(this.data, this.object); 8 | factory OpenAiModel.fromJson(Map json) => OpenAiModel( 9 | (json['data'] as List) 10 | .map((e) => ModelData.fromJson(e as Map)) 11 | .toList(), 12 | json['object'], 13 | ); 14 | 15 | Map toJson() => { 16 | 'data': data, 17 | 'object': object, 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /lib/src/model/run/response/list_run.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/run/response/create_run_response.dart'; 2 | 3 | class ListRun { 4 | ListRun({ 5 | required this.firstId, 6 | required this.data, 7 | required this.lastId, 8 | required this.hasMore, 9 | required this.object, 10 | }); 11 | 12 | String firstId; 13 | List data; 14 | String lastId; 15 | bool hasMore; 16 | String object; 17 | 18 | factory ListRun.fromJson(Map json) => ListRun( 19 | firstId: json["first_id"] ?? '', 20 | data: json["data"] == null 21 | ? [] 22 | : List.from( 23 | json["data"].map((x) => CreateRunResponse.fromJson(x)), 24 | ), 25 | lastId: json["last_id"] ?? '', 26 | hasMore: json["has_more"], 27 | object: json["object"], 28 | ); 29 | 30 | Map toJson() => { 31 | "first_id": firstId, 32 | "data": data.map((x) => x.toJson()).toList(), 33 | "last_id": lastId, 34 | "has_more": hasMore, 35 | "object": object, 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /lib/src/model/run/response/message_creation.dart: -------------------------------------------------------------------------------- 1 | class MessageCreation { 2 | MessageCreation({ 3 | required this.messageId, 4 | }); 5 | 6 | String messageId; 7 | 8 | factory MessageCreation.fromJson(Map json) => 9 | MessageCreation( 10 | messageId: json["message_id"] ?? '', 11 | ); 12 | 13 | Map toJson() => { 14 | "message_id": messageId, 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /lib/src/model/run/response/step_detail.dart: -------------------------------------------------------------------------------- 1 | import 'message_creation.dart'; 2 | 3 | class StepDetail { 4 | StepDetail({ 5 | required this.messageCreation, 6 | required this.type, 7 | }); 8 | 9 | MessageCreation messageCreation; 10 | String type; 11 | 12 | factory StepDetail.fromJson(Map json) => StepDetail( 13 | messageCreation: MessageCreation.fromJson(json["message_creation"]), 14 | type: json["type"] ?? '', 15 | ); 16 | 17 | Map toJson() => { 18 | "message_creation": messageCreation.toJson(), 19 | "type": type, 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/model/thread/response/thread_delete_response.dart: -------------------------------------------------------------------------------- 1 | class ThreadDeleteResponse { 2 | ThreadDeleteResponse({ 3 | required this.deleted, 4 | required this.id, 5 | required this.object, 6 | }); 7 | 8 | bool deleted; 9 | String id; 10 | String object; 11 | 12 | factory ThreadDeleteResponse.fromJson(Map json) => 13 | ThreadDeleteResponse( 14 | deleted: json["deleted"] ?? false, 15 | id: json["id"] ?? '', 16 | object: json["object"] ?? '', 17 | ); 18 | 19 | Map toJson() => { 20 | "deleted": deleted, 21 | "id": id, 22 | "object": object, 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /lib/src/model/thread/response/thread_response.dart: -------------------------------------------------------------------------------- 1 | class ThreadResponse { 2 | ThreadResponse({ 3 | required this.metadata, 4 | required this.createdAt, 5 | required this.id, 6 | required this.object, 7 | this.toolResources, 8 | }); 9 | 10 | Map metadata; 11 | int createdAt; 12 | String id; 13 | String object; 14 | Map? toolResources; 15 | 16 | factory ThreadResponse.fromJson(Map json) => ThreadResponse( 17 | metadata: json["metadata"] ?? {}, 18 | createdAt: json["created_at"] ?? 0, 19 | id: json["id"] ?? '', 20 | object: json["object"] ?? '', 21 | toolResources: json['tool_resources'] is Map 22 | ? json['tool_resources'] 23 | : null); 24 | 25 | Map toJson() => { 26 | "metadata": metadata, 27 | "created_at": createdAt, 28 | "id": id, 29 | "object": object, 30 | 'tool_resources': toolResources, 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/utils/json_decode_string.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | extension JsonDecodeString on String? { 4 | Map decode() { 5 | try { 6 | return Map.of({true: json.decode('$this')}); 7 | } catch (err) { 8 | return Map.of({false: ""}); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/src/utils/token_builder.dart: -------------------------------------------------------------------------------- 1 | class TokenBuilder { 2 | TokenBuilder._(); 3 | 4 | static final _instance = TokenBuilder._(); 5 | 6 | static TokenBuilder get build => _instance; 7 | 8 | ///token 9 | String _token = ''; 10 | 11 | ///org 12 | String? _orgId; 13 | 14 | ///set token 15 | void setToken(String token) { 16 | _token = token; 17 | } 18 | 19 | ///set orgId 20 | void setOrgId(String? orgId) => _orgId = orgId; 21 | 22 | ///get token 23 | String? get token => _token; 24 | 25 | ///get orgID 26 | String? get orgId => _orgId; 27 | } 28 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: chat_gpt_sdk 2 | description: create chat bot and other bot with ChatGPT SDK Support GPT-4 , 3.5 and SSE Generate Prompt (Stream) 3 | version: 3.1.5 4 | homepage: https://www.facebook.com/REDEVRX 5 | repository: https://github.com/redevRx/Flutter-ChatGPT 6 | 7 | environment: 8 | sdk: ^3.5.3 9 | # flutter: ">=1.17.0" 10 | 11 | dependencies: 12 | dio: ^5.7.0 13 | dio_compatibility_layer: ^0.1.0 14 | fetch_client: ^1.1.2 15 | http_parser: ^4.0.0 16 | # path_provider: ^2.1.4 17 | 18 | dev_dependencies: 19 | mockito: ^5.4.1 20 | build_runner: ^2.4.4 21 | lints: ^4.0.0 22 | coverage: ^1.7.2 23 | test: ^1.25.2 24 | -------------------------------------------------------------------------------- /test/client/http_setup_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('http setup test', () { 6 | test('http setup test valid instance', () { 7 | final httpSetup = HttpSetup(); 8 | expect(httpSetup, isA()); 9 | }); 10 | test('http setup test valid timeout', () { 11 | final httpSetup = HttpSetup(); 12 | expect(httpSetup.connectTimeout, isA()); 13 | expect(httpSetup.receiveTimeout, isA()); 14 | expect(httpSetup.sendTimeout, isA()); 15 | }); 16 | test('http setup test has proxy', () { 17 | final httpSetup = HttpSetup(proxy: "proxy"); 18 | expect(httpSetup.proxy, 'proxy'); 19 | }); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /test/client/interceptor_wrapper_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('interceptor test', () { 6 | test('interceptor test onRequest', () { 7 | final intercept = InterceptorsWrapper(); 8 | 9 | intercept.onRequest(RequestOptions(), RequestInterceptorHandler()); 10 | }); 11 | test('interceptor test onResponse', () { 12 | final intercept = InterceptorsWrapper(); 13 | final response = Response( 14 | data: "data", 15 | requestOptions: RequestOptions(), 16 | ); 17 | intercept.onResponse(response, ResponseInterceptorHandler()); 18 | expect(response.data, 'data'); 19 | }); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /test/exception/missing_token_exception_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('missing token test', () { 6 | test("missing token not found token test", () { 7 | expect( 8 | () => OpenAI.instance.build(token: ''), 9 | throwsA(isA()), 10 | ); 11 | }); 12 | test("missing token is null test", () { 13 | expect( 14 | () => OpenAI.instance.build(), 15 | throwsA(isA()), 16 | ); 17 | }); 18 | test("missing token Exception set value test", () { 19 | final missingToken = MissingTokenException(); 20 | 21 | expect( 22 | missingToken.toString(), 23 | "Not Missing Your Token look more https://beta.openai.com/account/api-keys", 24 | ); 25 | }); 26 | 27 | test("missing token Exception test", () { 28 | final missingToken = MissingTokenException(); 29 | 30 | expect(missingToken.toString(), isA()); 31 | }); 32 | }); 33 | } 34 | -------------------------------------------------------------------------------- /test/logger/logger_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/logger/logger.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group("openai log test", () { 6 | test('openai logger test isLogging true', () { 7 | final log = Logger.instance.builder(isLogging: true); 8 | log.log('message'); 9 | expect(log.isLogging, true); 10 | }); 11 | test('openai logger test isLogging true print error', () { 12 | final log = Logger.instance.builder(isLogging: true); 13 | log.error(Object(), null, message: ""); 14 | expect(log.isLogging, true); 15 | }); 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /test/model/audio/enum/audio_format_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/audio/enum/audio_format.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('audio format test', () { 6 | test('audio format test with text format', () { 7 | const text = AudioFormat.text; 8 | expect(text.getName(), 'text'); 9 | expect(text, isA()); 10 | }); 11 | test('audio format test with json format', () { 12 | const json = AudioFormat.json; 13 | expect(json.getName(), 'json'); 14 | expect(json, isA()); 15 | }); 16 | test('audio format test with srt format', () { 17 | const srt = AudioFormat.srt; 18 | expect(srt.getName(), 'srt'); 19 | expect(srt, isA()); 20 | }); 21 | test('audio format test with verboseJson format', () { 22 | const verboseJson = AudioFormat.verboseJson; 23 | expect(verboseJson.getName(), 'verbose_json'); 24 | expect(verboseJson, isA()); 25 | }); 26 | test('audio format test with verboseJson format', () { 27 | const vtt = AudioFormat.vtt; 28 | expect(vtt.getName(), 'vtt'); 29 | expect(vtt, isA()); 30 | }); 31 | }); 32 | } 33 | -------------------------------------------------------------------------------- /test/model/audio/response/audio_response_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('audio response test', () { 6 | test('audio response test instance is AudioResponse', () { 7 | final response = AudioResponse('text'); 8 | expect(response, isA()); 9 | }); 10 | test('audio response test match value response', () { 11 | final response = AudioResponse('text'); 12 | expect(response.text, 'text'); 13 | }); 14 | test('audio response test value from json', () { 15 | final response = AudioResponse.fromJson({"text": "text"}); 16 | expect(response.text, 'text'); 17 | }); 18 | }); 19 | } 20 | -------------------------------------------------------------------------------- /test/model/cancel/cancel_data_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:dio/dio.dart'; 3 | import 'package:test/test.dart'; 4 | 5 | void main() { 6 | group('cancel data model test', () { 7 | test('cancel data test cancel instance', () { 8 | final cancel = CancelData(cancelToken: CancelToken()); 9 | expect(cancel.cancelToken, isA()); 10 | }); 11 | test('cancel data test cancel instance', () { 12 | final cancel = CancelData(cancelToken: CancelToken()); 13 | expect(cancel, isA()); 14 | }); 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /test/model/chat_complete/response/message_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/chat_complete/response/message.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('Message', () { 6 | test('toJson() returns expected Map', () { 7 | final message = Message(role: 'sender', content: 'Hello, world!'); 8 | expect(message.toJson(), { 9 | 'role': 'sender', 10 | 'content': 'Hello, world!', 11 | 'function_call': null, 12 | 'tool_calls': null, 13 | }); 14 | }); 15 | 16 | test('fromJson() returns expected Message object', () { 17 | final json = {'role': 'receiver', 'content': 'Hi there!'}; 18 | final message = Message.fromJson(json); 19 | expect(message.role, 'receiver'); 20 | expect(message.content, 'Hi there!'); 21 | }); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /test/model/client/http_setup_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('HttpSetup', () { 6 | test('default values', () { 7 | final httpSetup = HttpSetup(); 8 | expect(httpSetup.sendTimeout, const Duration(seconds: 6)); 9 | expect(httpSetup.connectTimeout, const Duration(seconds: 6)); 10 | expect(httpSetup.receiveTimeout, const Duration(seconds: 6)); 11 | expect(httpSetup.proxy, ''); 12 | }); 13 | 14 | test('custom values', () { 15 | final httpSetup = HttpSetup( 16 | sendTimeout: const Duration(seconds: 10), 17 | connectTimeout: const Duration(seconds: 20), 18 | receiveTimeout: const Duration(seconds: 30), 19 | proxy: 'http://myproxy.com', 20 | ); 21 | expect(httpSetup.sendTimeout, const Duration(seconds: 10)); 22 | expect(httpSetup.connectTimeout, const Duration(seconds: 20)); 23 | expect(httpSetup.receiveTimeout, const Duration(seconds: 30)); 24 | expect(httpSetup.proxy, 'http://myproxy.com'); 25 | }); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /test/model/complete_text/enum/model_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('openai completion model test', () { 6 | test('openai completion model test set value Gpt3.5 Turbo Instruct', () { 7 | final gpt3 = Gpt3TurboInstruct(); 8 | 9 | expect(gpt3.model, kGpt3TurboInstruct); 10 | }); 11 | test('openai completion model test set value davinci 002', () { 12 | final davinci = Davinci002Model(); 13 | 14 | expect(davinci.model, kDavinci002Model); 15 | }); 16 | test('openai completion model test set value Babbage002', () { 17 | final babbage002 = Babbage002Model(); 18 | 19 | expect(babbage002.model, kBabbage002Model); 20 | }); 21 | test('openai completion model test set value null', () { 22 | Model? ada; 23 | 24 | expect(ada, null); 25 | }); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /test/model/complete_text/response/choices_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/complete_text/response/choices.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('choices test', () { 6 | test('choices test from json', () { 7 | final json = { 8 | "finish_reason": "finish_reason", 9 | "text": "text", 10 | "index": 1, 11 | }; 12 | 13 | final choice = Choices.fromJson(json); 14 | 15 | expect(choice.text, 'text'); 16 | expect(choice.index, 1); 17 | }); 18 | 19 | test('choices test to json', () { 20 | final json = Choices("text", 1, 'finishReason').toJson(); 21 | 22 | expect(json['text'], 'text'); 23 | expect(json['index'], 1); 24 | }); 25 | }); 26 | } 27 | -------------------------------------------------------------------------------- /test/model/edits/enum/edit_model_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:chat_gpt_sdk/src/model/edits/enum/edit_model.dart'; 3 | import 'package:test/test.dart'; 4 | 5 | void main() { 6 | group('chat openai model test', () { 7 | test('chat openai model test get gpt4 edit', () { 8 | final codeEditModel = Gpt4(); 9 | 10 | expect(codeEditModel.model, kChatGpt4); 11 | expect(codeEditModel.model, isA()); 12 | }); 13 | test('chat openai model test get from value', () { 14 | final custom = EditModelFromValue(model: 'custom-model'); 15 | 16 | expect(custom.model, 'custom-model'); 17 | expect(custom.model, isA()); 18 | }); 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /test/model/edits/request/edit_request_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:chat_gpt_sdk/src/model/edits/enum/edit_model.dart'; 3 | import 'package:test/test.dart'; 4 | 5 | void main() { 6 | group('openai test edit request', () { 7 | test('openai test edit request from json', () { 8 | final request = EditRequest( 9 | model: Gpt4(), 10 | input: "input", 11 | instruction: "instruction", 12 | ); 13 | 14 | expect(request.model.model, Gpt4().model); 15 | expect(request.input, 'input'); 16 | }); 17 | 18 | test('openai test edit request from json', () { 19 | final mJson = { 20 | "model": Gpt4().model, 21 | "input": "input", 22 | "instruction": "instruction", 23 | "n": 1, 24 | "temperature": 1, 25 | "top_p": 1, 26 | }; 27 | 28 | final json = EditRequest( 29 | model: Gpt4(), 30 | input: "input", 31 | instruction: "instruction", 32 | ).toJson(); 33 | 34 | expect(json, mJson); 35 | expect(json['input'], 'input'); 36 | }); 37 | }); 38 | } 39 | -------------------------------------------------------------------------------- /test/model/embedding/enum/embed_model_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:chat_gpt_sdk/src/model/embedding/enum/embed_model.dart'; 3 | import 'package:test/test.dart'; 4 | 5 | void main() { 6 | group('openai embedding model test', () { 7 | test('openai embedding model test textEmbeddingAda002', () { 8 | final textEmbeddingAda002 = TextEmbeddingAda002EmbedModel(); 9 | 10 | expect(textEmbeddingAda002.model, kEmbeddingAda002); 11 | }); 12 | 13 | test('openai embedding model test null value', () { 14 | EmbedModel? textSearchAdaDoc001; 15 | 16 | expect(textSearchAdaDoc001, null); 17 | }); 18 | 19 | test('openai embedding model test from value', () { 20 | final custom = EmbedModelFromValue(model: 'model'); 21 | 22 | expect(custom.model, 'model'); 23 | }); 24 | }); 25 | } 26 | -------------------------------------------------------------------------------- /test/model/embedding/request/embed_request_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:chat_gpt_sdk/src/model/embedding/enum/embed_model.dart'; 3 | import 'package:test/test.dart'; 4 | 5 | void main() { 6 | group('embed request test', () { 7 | test('embed request test to json', () { 8 | final json = 9 | EmbedRequest(model: TextEmbeddingAda002EmbedModel(), input: "input") 10 | .toJson(); 11 | 12 | expect(json["model"], TextEmbeddingAda002EmbedModel().model); 13 | expect(json['input'], 'input'); 14 | }); 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /test/model/embedding/response/embed_data_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('embed data test', () { 6 | test('embed data test from json', () { 7 | final json = { 8 | "object": "object", 9 | "embedding": [.0, .6], 10 | "index": 1, 11 | }; 12 | 13 | final request = EmbedData.fromJson(json); 14 | 15 | expect(request.object, 'object'); 16 | expect(request.index, 1); 17 | expect(request.embedding.length, 2); 18 | }); 19 | test('embed data test to json', () { 20 | final json = 21 | EmbedData(object: "object", embedding: [.0, .6], index: 2).toJson(); 22 | 23 | expect(json['object'], 'object'); 24 | expect(json['index'], 2); 25 | expect(json['embedding'].length, 2); 26 | }); 27 | }); 28 | } 29 | -------------------------------------------------------------------------------- /test/model/error/openai_error_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/error/openai_error.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('openai error data test', () { 6 | test('openai error data test from json', () { 7 | final json = { 8 | "error": {"message": "message", "code": '404', "type": "type"}, 9 | }; 10 | 11 | final errorData = OpenAIError.fromJson(json, 'message'); 12 | 13 | expect(errorData.error.code, '404'); 14 | expect(errorData.message, 'message'); 15 | }); 16 | test('openai error data test to json', () { 17 | final json = OpenAIError( 18 | message: 'message', 19 | error: ErrorData.fromJson( 20 | {"message": "message", "code": '404', "type": "type"}, 21 | ), 22 | ); 23 | 24 | expect(json.message, 'message'); 25 | expect( 26 | json.error.toMap(), 27 | {"message": "message", "code": '404', "type": "type"}, 28 | ); 29 | }); 30 | }); 31 | } 32 | -------------------------------------------------------------------------------- /test/model/file/request/upload_file_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:dio/dio.dart'; 3 | import 'package:test/test.dart'; 4 | 5 | void main() { 6 | group('upload file test', () { 7 | test('upload file test get from', () { 8 | final upload = UploadFile(file: FileInfo("path", 'name')); 9 | 10 | expect(upload.getForm(), isA>()); 11 | }); 12 | }); 13 | } 14 | -------------------------------------------------------------------------------- /test/model/file/response/delete_file_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('delete file model test', () { 6 | test('delete file model test from json', () { 7 | final json = { 8 | "id": "id", 9 | "object": "object", 10 | "deleted": true, 11 | }; 12 | 13 | final request = DeleteFile.fromJson(json); 14 | 15 | expect(request.object, 'object'); 16 | expect(request.deleted, true); 17 | expect(request.id, 'id'); 18 | }); 19 | test('delete file model test to json', () { 20 | final json = 21 | DeleteFile(id: "id", object: "object", deleted: true).toJson(); 22 | 23 | expect(json['object'], 'object'); 24 | expect(json['deleted'], true); 25 | expect(json['id'], 'id'); 26 | }); 27 | }); 28 | } 29 | -------------------------------------------------------------------------------- /test/model/file/response/file_data_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('openai file data model test', () { 6 | test('openai file data model test from json', () { 7 | final json = { 8 | "id": "id", 9 | "object": 'object', 10 | 'bytes': 12312, 11 | 'created_at': 12312, 12 | 'filename': 'filename', 13 | 'purpose': 'purpose', 14 | }; 15 | 16 | final fileData = FileData.fromJson(json); 17 | 18 | expect(fileData.object, 'object'); 19 | expect(fileData.bytes, 12312); 20 | expect(fileData.createdAt, 12312); 21 | }); 22 | 23 | test('openai file data model test to json', () { 24 | final json = FileData( 25 | id: "id", 26 | object: "object", 27 | bytes: 12312, 28 | createdAt: 12312, 29 | filename: "filename", 30 | purpose: "purpose", 31 | ).toJson(); 32 | 33 | expect(json['object'], 'object'); 34 | expect(json['bytes'], 12312); 35 | expect(json['created_at'], 12312); 36 | }); 37 | }); 38 | } 39 | -------------------------------------------------------------------------------- /test/model/file/response/uplaod_response_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('openai upload file response', () { 6 | test('openai upload file response from json', () { 7 | final json = { 8 | "id": "id", 9 | "object": 'object', 10 | 'bytes': 12312, 11 | 'created_at': 12312, 12 | 'filename': 'filename', 13 | 'purpose': 'purpose', 14 | }; 15 | 16 | final upload = UploadResponse.fromJson(json); 17 | 18 | expect(upload.object, 'object'); 19 | expect(upload.bytes, 12312); 20 | expect(upload.createdAt, 12312); 21 | }); 22 | 23 | test('openai upload file response to json', () { 24 | final json = UploadResponse( 25 | id: "id", 26 | object: "object", 27 | bytes: 12312, 28 | createdAt: 12312, 29 | filename: "filename", 30 | purpose: "purpose", 31 | ).toJson(); 32 | 33 | expect(json['object'], 'object'); 34 | expect(json['bytes'], 12312); 35 | expect(json['created_at'], 12312); 36 | }); 37 | }); 38 | } 39 | -------------------------------------------------------------------------------- /test/model/fine_tune/enum/fine_model_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/fine_tune/enum/fine_model.dart'; 2 | import 'package:chat_gpt_sdk/src/utils/constants.dart'; 3 | import 'package:test/test.dart'; 4 | 5 | void main() { 6 | group('openai fine tune model test', () { 7 | test('openai fine tune model test get value babbage', () { 8 | final babbage = Babbage002FineModel(); 9 | 10 | expect(babbage.model, kBabbage002Model); 11 | }); 12 | test('openai fine tune model test get from value', () { 13 | final davinci = FineModelFromValue(model: 'model'); 14 | 15 | expect(davinci.model, 'model'); 16 | }); 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /test/model/fine_tune/request/create_fine_tune_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/fine_tune/enum/fine_model.dart'; 2 | import 'package:chat_gpt_sdk/src/model/fine_tune/request/create_fine_tune.dart'; 3 | import 'package:test/test.dart'; 4 | 5 | void main() { 6 | group('openai create fine tune test', () { 7 | test('openai create fine tune test to json', () { 8 | final fineTune = CreateFineTune( 9 | trainingFile: 'trainingFile', 10 | model: Babbage002FineModel(), 11 | ).toJson(); 12 | 13 | expect(fineTune['training_file'], 'trainingFile'); 14 | expect(fineTune['n_epochs'], 4); 15 | }); 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /test/model/fine_tune/response/fine_tune_delete_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('openai Fine Tune delete test', () { 6 | test('openai Fine Tune delete test to json', () { 7 | final json = { 8 | "id": 'id', 9 | "object": 'object', 10 | 'deleted': true, 11 | }; 12 | final tineTune = FineTuneDelete.fromJson(json); 13 | 14 | expect(tineTune.object, 'object'); 15 | expect(tineTune.deleted, true); 16 | }); 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /test/model/fine_tune/response/fine_tune_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('openai fine tune event test', () { 6 | test('openai fine tune event test from json', () { 7 | final json = { 8 | "level": 'level', 9 | 'message': 'message', 10 | 'created_at': 12312, 11 | }; 12 | 13 | final event = FineTuneEvent.fromJson(json); 14 | 15 | expect(event.message, 'message'); 16 | expect(event.level, 'level'); 17 | }); 18 | }); 19 | } 20 | -------------------------------------------------------------------------------- /test/model/fine_tune/response/fine_turn_hyper_params_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('fine tune hyper params test', () { 6 | test('fine tune hyper params test from json', () { 7 | final json = { 8 | "batch_size": 12, 9 | 'learning_rate_multiplier': .5, 10 | 'n_epochs': 1, 11 | 'prompt_loss_weight': .5, 12 | }; 13 | 14 | final fineTube = FineTuneHyperParams.fromJson(json); 15 | 16 | expect(fineTube.batchSize, 12); 17 | expect(fineTube.learningRateMultiplier, .5); 18 | }); 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /test/model/fine_tune/response/training_files_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('training file test', () { 6 | test('training file test from json', () { 7 | final json = { 8 | "id": 'id', 9 | 'bytes': 213, 10 | 'filename': 'filename', 11 | 'purpose': 'purpose', 12 | }; 13 | 14 | final training = TrainingFiles.fromJson(json); 15 | 16 | expect(training.bytes, 213); 17 | expect(training.filename, 'filename'); 18 | }); 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /test/model/gen_image/enum/format_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('image format', () { 6 | test('image format get value url', () { 7 | const url = Format.url; 8 | 9 | expect(url.getName(), 'url'); 10 | }); 11 | 12 | test('image format get value b64Json', () { 13 | const b64Json = Format.b64Json; 14 | 15 | expect(b64Json.getName(), 'b64_json'); 16 | }); 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /test/model/gen_image/enum/image_size_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('openai image size', () { 6 | test('openai image size get value size256', () { 7 | const size256 = ImageSize.size256; 8 | 9 | expect(size256.size, '256x256'); 10 | }); 11 | test('openai image size get value size512', () { 12 | const size512 = ImageSize.size512; 13 | 14 | expect(size512.size, '512x512'); 15 | }); 16 | test('openai image size get value size1024', () { 17 | const size1024 = ImageSize.size1024; 18 | 19 | expect(size1024.size, '1024x1024'); 20 | }); 21 | }); 22 | } 23 | -------------------------------------------------------------------------------- /test/model/gen_image/request/edit_file_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:dio/dio.dart'; 3 | import 'package:test/test.dart'; 4 | 5 | void main() { 6 | group('edit file test', () { 7 | test('edit file test', () async { 8 | final e = FileInfo('path', 'name'); 9 | final edit = await EditImageRequest( 10 | image: e, 11 | prompt: 'prompt', 12 | mask: e, 13 | n: 1, 14 | user: 'user', 15 | responseFormat: Format.url, 16 | size: ImageSize.size1024, 17 | ).convert(); 18 | e.toString(); 19 | 20 | expect(edit, isA()); 21 | }); 22 | 23 | test('edit file test', () { 24 | final e = FileInfo('path', 'name'); 25 | e.toString(); 26 | final json = EditImageRequest( 27 | image: e, 28 | prompt: 'prompt', 29 | mask: e, 30 | n: 1, 31 | user: 'user', 32 | responseFormat: Format.url, 33 | size: ImageSize.size1024, 34 | ).toJson(); 35 | 36 | expect(json['prompt'], 'prompt'); 37 | }); 38 | }); 39 | } 40 | -------------------------------------------------------------------------------- /test/model/gen_image/request/variation_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:dio/dio.dart'; 3 | import 'package:test/test.dart'; 4 | 5 | void main() { 6 | group('variation test', () { 7 | test('variation test from json', () async { 8 | final variation = await Variation( 9 | image: FileInfo('path', 'name'), 10 | size: ImageSize.size1024, 11 | responseFormat: Format.url, 12 | user: 'user', 13 | n: 1, 14 | ).convert(); 15 | 16 | expect(variation, isA()); 17 | }); 18 | test('variation test to json', () { 19 | final json = Variation( 20 | image: FileInfo('path', 'name'), 21 | size: ImageSize.size1024, 22 | responseFormat: Format.url, 23 | user: 'user', 24 | n: 1, 25 | ).toJson(); 26 | 27 | expect(json, isA()); 28 | }); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /test/model/gen_image/response/gen_img_response_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('generate image response test', () { 6 | test('generate image response test', () { 7 | final json = { 8 | 'data': [ 9 | { 10 | 'url': 'url', 11 | 'b64_json': 'b64_json', 12 | }, 13 | ], 14 | 'created': 1231, 15 | }; 16 | 17 | final image = GenImgResponse.fromJson(json); 18 | 19 | expect(image.data?.length, 1); 20 | expect(image.data?.last?.url, 'url'); 21 | }); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /test/model/gen_image/response/image_data_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/gen_image/response/image_data.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('image data test', () { 6 | test('image data test from json', () { 7 | final json = { 8 | 'url': 'url', 9 | 'b64_json': 'b64_json', 10 | }; 11 | 12 | final data = ImageData.fromJson(json); 13 | 14 | expect(data.url, 'url'); 15 | expect(data.b64Json, 'b64_json'); 16 | }); 17 | 18 | test('image data test to json', () { 19 | final json = ImageData(url: 'url', b64Json: 'b64_json').toJson(); 20 | 21 | expect(json['url'], 'url'); 22 | expect(json['b64_json'], 'b64_json'); 23 | }); 24 | }); 25 | } 26 | -------------------------------------------------------------------------------- /test/model/moderation/enum/moderation_model_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:chat_gpt_sdk/src/model/moderation/enum/moderation_model.dart'; 3 | import 'package:test/test.dart'; 4 | 5 | void main() { 6 | group('moderation test', () { 7 | test('moderation test get value textLast', () { 8 | final textLast = TextLastModerationModel(); 9 | 10 | expect(textLast.model, kTextMLast); 11 | }); 12 | test('moderation test get value textStable', () { 13 | final textStable = TextStableModerationModel(); 14 | 15 | expect(textStable.model, kTextMStable); 16 | }); 17 | test('moderation test get from value', () { 18 | final textStable = ModerationModelFromValue(model: 'model'); 19 | 20 | expect(textStable.model, 'model'); 21 | }); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /test/model/moderation/response/categories_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('categories test', () { 6 | test('categories test from json', () { 7 | final json = { 8 | "hate": true, 9 | 'hate/threatening': false, 10 | 'self-harm': true, 11 | 'sexual': true, 12 | 'sexual/minors': true, 13 | 'violence': true, 14 | 'violence/graphic': true, 15 | }; 16 | 17 | final category = Categories.fromJson(json); 18 | 19 | expect(category.hate, true); 20 | expect(category.hateThreatening, false); 21 | expect(category.selfHarm, true); 22 | }); 23 | 24 | test('categories test to json', () { 25 | final json = Categories( 26 | hate: true, 27 | hateThreatening: false, 28 | selfHarm: true, 29 | sexual: true, 30 | sexualMinors: true, 31 | violence: true, 32 | violenceGraphic: true, 33 | ).toJson(); 34 | 35 | expect(json['hate'], true); 36 | expect(json['hate/threatening'], false); 37 | expect(json['self-harm'], true); 38 | }); 39 | }); 40 | } 41 | -------------------------------------------------------------------------------- /test/model/openai_engine/engine_data_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/model/openai_engine/engine_data.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('engine data test', () { 6 | test('engine data test from json', () { 7 | final json = { 8 | 'id': 'id', 9 | 'object': 'object', 10 | 'owner': 'owner', 11 | 'ready': false, 12 | }; 13 | 14 | final engine = EngineData.fromJson(json); 15 | 16 | expect(engine.id, 'id'); 17 | expect(engine.object, 'object'); 18 | }); 19 | 20 | test('engine data test to json', () { 21 | final json = EngineData("id", 'object', 'owner', false).toJson(); 22 | 23 | expect(json['id'], 'id'); 24 | expect(json['object'], 'object'); 25 | }); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /test/model/openai_engine/engine_model_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/chat_gpt_sdk.dart'; 2 | import 'package:chat_gpt_sdk/src/model/openai_engine/engine_data.dart'; 3 | import 'package:test/test.dart'; 4 | 5 | void main() { 6 | group('engine model test', () { 7 | test('engine model test from json', () { 8 | final json = { 9 | 'data': [ 10 | { 11 | 'id': 'id', 12 | 'object': 'object', 13 | 'owner': 'owner', 14 | 'ready': false, 15 | }, 16 | ], 17 | 'object': 'object', 18 | }; 19 | 20 | final engine = EngineModel.fromJson(json); 21 | 22 | expect(engine.object, 'object'); 23 | expect(engine.data.length, 1); 24 | }); 25 | 26 | test('engine model test to json', () { 27 | final json = EngineModel( 28 | [ 29 | EngineData.fromJson({ 30 | 'id': 'id', 31 | 'object': 'object', 32 | 'owner': 'owner', 33 | 'ready': false, 34 | }), 35 | ], 36 | 'object', 37 | ).toJson(); 38 | 39 | expect(json['object'], 'object'); 40 | expect(json['data'].length, 1); 41 | }); 42 | }); 43 | } 44 | -------------------------------------------------------------------------------- /test/utils_test/token_build_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:chat_gpt_sdk/src/utils/token_builder.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('TokenBuilder test', () { 6 | test('TokenBuilder set token', () { 7 | final token = TokenBuilder.build; 8 | token.setToken('token'); 9 | 10 | expect(token.token, 'token'); 11 | expect(token.token, isA()); 12 | }); 13 | 14 | test('TokenBuilder set orgId', () { 15 | final token = TokenBuilder.build; 16 | token.setOrgId('orgId'); 17 | 18 | expect(token.orgId, 'orgId'); 19 | expect(token.orgId, isA()); 20 | }); 21 | }); 22 | } 23 | --------------------------------------------------------------------------------