flutter_openchat 0.0.4 copy "flutter_openchat: ^0.0.4" to clipboard
flutter_openchat: ^0.0.4 copied to clipboard

discontinued
outdated

Flutter package that help integrate your app with open source chat https://openchat.so

Flutter MIT Licence pub package

Flutter package that help integrate your app with open source chat openchat.so

Features #

  • Use OpenChatTeam in your app
  • Use your chatboot builded in OpenChat in your app
  • Use only LLMProviders to generate text in your app.

Usage #

OpenChat Team #

To use the chat available in OpenChatTeam you just use FlutterOpenChatWidget passing OpenChatTeamLLM in llm param :


    FlutterOpenChatWidget(
        llm: OpenChatTeamLLM(),
      ),
    )

OpenChat Cloud #

First you need create your chatboot in OpenChat Login, after that you just use FlutterOpenChatWidget passing OpenChatCloudLLM in llm param with yout chat token:


    FlutterOpenChatWidget(
        llm: OpenChatCloudLLM(token:'1RuzS7w5ceGaN6CiK0J7'),
      ),
    )

This token is available in this section:

Customization #

This chat is entirely customizable take a look some params to do it:


    FlutterOpenChatWidget(
        llm: OpenChatTeamLLM(),
        assetBotAvatar: 'botAvatar.png', // You can pass the image asset to bot. It accept url image too.
        assetUserAvatar: 'userAvatar.png', // You can pass the image asset to user. It accept url image too.
        background: MyWidget(), // Here you can customize the chat background
        backgroundEmpty: MyWidget(), // Here you can customize the chat background when there is not messages.
        markdownConfig: MarkdownConfig(), // Here you can settings the markdown style od the bot saying.
      ),
    )

If you need recreate the input widget with your way just pass the inputBuilder:


    FlutterOpenChatWidget(
        llm: OpenChatTeamLLM(),
        inputBuilder: (OpenChatWidgetState state,ValueChanged<String> submit) {
          return MyInputWidget(state,submit);
        }
      ),
    )

If you need recreate the messages widget with your way just pass the msgBuilder:


    FlutterOpenChatWidget(
        llm: OpenChatTeamLLM(),
        msgBuilder: (BuildContext context, OpenChatItemMessageState state, VoidCallback tryAgain) {
          return MyMsgWidget(state,tryAgain);
        }
      ),
    )

Initial prompt #

Yeah, It have support to it. Just init your widget passing the param initialPrompt:


    FlutterOpenChatWidget(
        llm: OpenChatTeamLLM(),
        initialPrompt: 'You are an AI software engineer...',
      ),
    )

Using oly the llm to build anything #

You can use oly the llm calls to give a response and create anything. To it jus use OpenChatTeamLLM or OpenChatCloudLLM:


    final llm = OpenChatTeamLLM()
    llm.prompt('What is gravity?',onListen:(text){
        print(text);
    }).then((value){
        print(value);
    })


    final llm = OpenChatTeamLLM()
    llm.chat([
         ChatMessage.assistant('bla bla bla'),
         ChatMessage.user('Ok, thank you!'),
    ],onListen:(text){
        print(text);
    }).then((value){
        print(value);
    })


    final llm = OpenChatCloudLLM()
    llm.prompt('Do you can support me about your product?',onListen:(text){
        print(text);
    }).then((value){
        print(value);
    })

10
likes
140
points
17
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter package that help integrate your app with open source chat https://openchat.so

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, markdown_widget

More

Packages that depend on flutter_openchat