Coder Social home page Coder Social logo

lambiengcode / flutter-chatgpt-completions Goto Github PK

View Code? Open in Web Editor NEW
16.0 3.0 8.0 12.2 MB

:dove: Dart client for the unofficial ChatGPT API. Support Text Completion and stream response from v1/completions. 非官方 ChatGPT API 的 Dart 客户端。支持文本补全和来自 v1/completions。

Home Page: https://pub.dev/packages/chatgpt_completions

License: MIT License

Java 0.84% Kotlin 0.19% Swift 1.97% Objective-C 0.97% Dart 23.34% CMake 30.51% C++ 34.72% C 3.06% HTML 2.78% Shell 1.62%
chatgpt3 completions dart-package library openai stream-api chatbot dart-packages stream-server-api chatgpt

flutter-chatgpt-completions's Introduction

🚀 Welcome to my GitHub space!

I'm Kai, also known as lambiengcode, currently steering the tech ship at Waterbus as a TechLead. My playground revolves around code, and I'm here to share the excitement with you. Have a tech question? Hit me up at [email protected] or telegram: https://t.me/lambiengcode.

I'm really interested in WebRTC and that is main reason I kick off Waterbus is an open source project for curious and experimental, it's try to apply some interesting features related to VoIP. I bet you can find something there.

Feel free to explore my repositories and join me on this exciting coding journey. ✨

📺 Latest YouTube Videos

Virtual Background on iOS (VisionKit for Person segment) Virtual Background on Android (Mediapipe for Image segment) Compose ChatGPT Kotlin - Android Chatbot (stream: true)

⚙️ Coding Stats - Last 7 Days

Dart            22 hrs 43 mins  ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⣀⣀⣀⣀⣀⣀   72.79 %
Swift           2 hrs 21 mins   ⣿⣷⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀   07.56 %
YAML            1 hr 31 mins    ⣿⣄⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀   04.91 %
Kotlin          1 hr 20 mins    ⣿⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀   04.28 %
Other           1 hr 17 mins    ⣿⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀   04.14 %

flutter-chatgpt-completions's People

Contributors

chopper985 avatar lambiengcode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flutter-chatgpt-completions's Issues

how to stop the stream when response is completed - more example code

Hi, this package is great. thanks!
I am not sure how I can stop the stream based on when the response has been completed, like in your video example.

When response is completed, I would like to stop the stream: how can I do it?
If you could also share the example code used in your example video it would be useful.
Thanks!

run error

E/flutter ( 6185): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: status code: 400, error: [] is too short - 'messages'
E/flutter ( 6185): #0 TextCompletionsRepository._handleListenBodyBytesTurbo (package:chatgpt_completions/src/repository/text_completions_repository.dart:201:9)
E/flutter ( 6185): #1 TextCompletionsRepository.textCompletions.. (package:chatgpt_completions/src/repository/text_completions_repository.dart:77:15)
E/flutter ( 6185): #2 DecoderQueueService.runQueue (package:chatgpt_completions/src/services/decoder_queue.dart:21:19)
E/flutter ( 6185): #3 DecoderQueueService.addQueue (package:chatgpt_completions/src/services/decoder_queue.dart:14:5)
E/flutter ( 6185): #4 TextCompletionsRepository.textCompletions. (package:chatgpt_completions/src/repository/text_completions_repository.dart:75:40)
E/flutter ( 6185): #5 _RootZone.runUnaryGuarded (dart:async/zone.dart:1593:10)
E/flutter ( 6185): #6 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter ( 6185): #7 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter ( 6185): #8 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
E/flutter ( 6185): #9 _StreamController._add (dart:async/stream_controller.dart:648:7)
E/flutter ( 6185): #10 _StreamController.add (dart:async/stream_controller.dart:596:5)
E/flutter ( 6185): #11 _DoStreamSink.onData (package:rxdart/src/transformers/do.dart:40:10)
E/flutter ( 6185): #12 _RootZone.runUnaryGuarded (dart:async/zone.dart:1593:10)
E/flutter ( 6185): #13 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter ( 6185): #14 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter ( 6185): #15 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
E/flutter ( 6185): #16 _StreamController._add (dart:async/stream_controller.dart:648:7)
E/flutter ( 6185): #17 _RootZone.runUnaryGuarded (dart:async/zone.dart:1593:10)
E/flutter ( 6185): #18 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter ( 6185): #19 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter ( 6185): #20 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
E/flutter ( 6185): #21 _StreamController._add (dart:async/stream_controller.dart:648:7)
E/flutter ( 6185): #22 _StreamController.add (dart:async/stream_controller.dart:596:5)
E/flutter ( 6185): #23 TimerStream._buildController.. (package:rxdart/src/streams/timer.dart:51:22)
E/flutter ( 6185): #24 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15)
E/flutter ( 6185): #25 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
E/flutter ( 6185): #26 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
E/flutter ( 6185): #27 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)

Separating GUI from server

I see nice advantages of using Flutter for the frontend/GUI of a chat app. I have not got this project running yet and it is unclear to me if the requests sent to OpenAI are sent from a server running in a separate process (maybe a separate machine) from the frontend. Sorry for my lack of undestanding about Flutter. I imagine having a server process that interfaces between the Flutter frontend and OpenAI would be essential for protecting the OpenAI keys.

Error on first run

Hi, I get as far as:

Error: FormatException: SyntaxError: Unexpected non-whitespace character after JSON at position 209
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49        throw_
dart-sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart 39:5                 _parseJson
dart-sdk/lib/convert/json.dart 610:36                                               convert
dart-sdk/lib/convert/json.dart 216:41                                               decode
dart-sdk/lib/convert/json.dart 155:10                                               jsonDecode
packages/chatgpt_completions/src/repository/text_completions_repository.dart 63:34  <fn>
dart-sdk/lib/async/zone.dart 1593:10                                                runUnaryGuarded
dart-sdk/lib/async/stream_impl.dart 339:11                                          [_sendData]
dart-sdk/lib/async/stream_impl.dart 515:13                                          perform
dart-sdk/lib/async/stream_impl.dart 620:10                                          handleNext
dart-sdk/lib/async/stream_impl.dart 591:7                                           callback
dart-sdk/lib/async/schedule_microtask.dart 40:11                                    _microtaskLoop
dart-sdk/lib/async/schedule_microtask.dart 49:5                                     _startMicrotaskLoop
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15                 <fn>

I have not used Flutter before so it may be something obvious. I ran the following in the example directory flutter run -d chrome

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.