Recently, I am very interested in AI. I spent a few days learning Android, and tried to combine Bmob AI SDK to make an open source project with role function. It may be because there are still relatively few projects of this type at present. After the release, it has even obtained several stars and forks. For an Android novice, it is quite a sense of accomplishment.
First release the source code address for everyone to share, welcome friends who are interested to join together, and constantly improve this project. Friends who are willing to join contact the Q group I built (673744742).
https://github.com/bmob/Bmob-Android-AI-Prompt https://github.com/bmob/Bmob-Android-AI-Prompt The tentative name of the project is BeAI. Supported features include:
- One-click registration of mobile phone number
- Cloud settings for AI characters, including prompt settings, entry words, etc.
- Cloudification of AI chat records
- Complete removal of chat content
The functions that I want to continue to improve include:
- text and voice input
- User-defined AI roles (open prompt and entry word permissions to users)
- Perfect user system
Some display pictures now:
Reference: Bmob backend cloud
key code:
//连接AI服务器(这个代码为了防止AI连接中断,因为可能会存在某些情况下,比如网络切换、中断等,导致心跳连接失败)
BmobApp.bmobAI.Connect();
//发送对话信息
BmobApp.bmobAI.Chat("帮我用写一段android访问Bmob后端云的代码", "session_id", new ChatMessageListener() {
@Override
public void onMessage(String message) {
//消息流的形式返回AI的结果
Log.d("Bmob", message);
}
@Override
public void onFinish(String message) {
//一次性返回全部结果,这个方法需要等待一段时间,友好性较差
Log.d("Bmob", message);
}
@Override
public void onError(String error) {
//OpenAI的密钥错误或者超过OpenAI并发时,会返回这个错误
Log.d("Bmob", "连接发生异常了"+error);
}
@Override
public void onClose() {
Log.d("Bmob", "连接被关闭了");
}
});