Flutter package that help integrate your app with open source chat openchat
- Use OpenChatTeam in your app
- Use only LLMProviders to generate text in your app.
To use the chat available in OpenChatTeam you just use FlutterOpenChatWidget
passing OpenChatTeamLLM
in llm param :
FlutterOpenChatWidget(
llm: OpenChatTeamLLM(),
),
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);
}
),
Yeah, It have support to it. Just init your widget passing the param initialPrompt
:
FlutterOpenChatWidget(
llm: OpenChatTeamLLM(),
initialPrompt: 'You are an AI software engineer...',
),
You can use only 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);
})