An open-source Android framework for building AI companion apps, offering a modular architecture, multiple AI provider support, local model inference, and a complete product skeleton including chat, role management, memory, and group chat systems.

Stars

172

7-day growth

No data

Forks

59

Open issues

2

License

Apache-2.0

Last updated

2026-07-04

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It provides a production-ready, feature-rich application skeleton with modular Compose architecture, support for 10+ AI providers, local model integration, and a clear separation of concerns—all in an open-source package that can be customized, commercialized, or used as a learning reference.

Who it is for

  • Android developers learning large-scale Jetpack Compose modular architecture
  • Teams building AI companion or role-play chat products
  • Developers wanting to integrate multiple AI providers or switch between them easily
  • Engineers exploring on-device local model inference for privacy and offline use

Use cases

  • Rapidly prototyping an AI companion app with built-in chat, memory, and persona systems
  • Reference project for modular Android architecture with Compose and Room
  • Customizing AI chat with self-hosted, local, or third-party models via a unified configuration center
  • Educational resource for modern Android development practices including Coroutines, Flow, and WorkManager

Strengths

  • Highly modular feature-based architecture with clear dependency rules and no cross-feature coupling
  • Supports 10+ AI providers (OpenAI, DeepSeek, Gemini, Kimi, Groq, etc.) and a custom OpenAI-compatible mode
  • Built-in local model framework with LiteRT-LM integration for offline inference and safety classification
  • Polished Material 3 UI with dark theme, frosted glass effects, and adaptive animation strength based on device performance

Considerations

  • No pre-configured API keys or AI services; users must supply their own Base URL, API key, and model
  • Security module is a no-op stub (core:security) that requires custom replacement for production use
  • Large model files are not included; users need Git LFS or release assets and in-app download management

README quick start

LianYu / 恋语

面向 Android 的 AI 虚拟陪伴应用开源框架

AI Companion · Modular Android · Jetpack Compose · Local Model Ready · Open API Framework

快速开始 · 功能全景 · 系统架构 · API 配置 · 贡献者


目录


🌌 项目定位

LianYu(恋语) 是一款 Android AI 虚拟陪伴应用的开源框架。它不是一个简单的聊天 Demo,而是一个围绕“长期陪伴、角色人格、记忆沉淀、多模态扩展、本地模型接入、模块化工程治理”构建的完整应用骨架。

本项目适合:

  • 想学习 Kotlin + Jetpack Compose 大型 Android 工程架构 的开发者。
  • 想二次开发 AI 伴侣、AI 角色聊天、AI 社交陪伴类产品的团队。
  • 想接入 OpenAI-compatible API、本地模型、私有模型网关的个人或组织。
  • 想参考 Room / Flow / Compose / WorkManager / 多模块拆分实践的 Android 工程师。

它提供了一套完整但可替换的产品基座:

角色系统 + 聊天系统 + 记忆系统 + 群聊系统 + 设置系统 + 本地模型框架 + 通知框架 + 主题框架

你可以把它当作:

  • 一个 AI companion app starter kit。
  • 一个 Compose 多模块工程样板。
  • 一个可继续商业化或社区化的虚拟陪伴应用底座。
  • 一个可替换后端、替换模型、替换 UI 风格的产品壳。

🌱 开源版声明

为了适合公开发布,本仓库已经整理为 Public Edition

已移除

  • 私有 AI 中继服务配置。
  • 内置 Clove / cloveapi 相关服务器逻辑。
  • 个人服务器地址、内置 token、内置 secret、私有 API key。
  • 私有证书 pinning 和面向私有后端的请求签名。
  • Native 安全壳、VMP、反调试、OLLVM、shell payload、打包加固脚本。
  • 发布 APK、私有安全文档、历史临时推送目录。

已保留

  • App 主体功能和模块化架构。
  • AI Provider 配置框架。
  • Room 数据库和 Repository 层。
  • Compose UI 与主题系统。
  • 本地模型接入框架。
  • 通知、WorkManager、微信/QQ Bot 等功能模块骨架。
  • core:security 最小 no-op 兼容层,方便下游替换实现。

需要你自行配置

  • AI API Base URL。
  • API Key。
  • 模型名称。
  • 推送平台参数。
  • 签名证书。
  • 是否接入自己的安全/加密/风控方案。

Public Edition 默认不会连接任何私有服务器,也不提供可直接使用的内置模型服务。

UI 占位提示

Public Edition 中保留的部分「自定义中继 / Partner / 连接测试」相关 UI 仅作为二次开发占位,用于展示原有设置入口和配置流程。

这些 UI 不会连接任何内置服务器,也不会自动分发 API Key。如果你需要使用对应能力,请在自己的 fork 中接入自有后端,或直接使用「自定义 API / OpenAI-compatible」配置填写自己的 Base URL 与 API Key。


✨ 功能全景

1. AI 伴侣聊天

  • 单人伴侣聊天。
  • 多轮上下文对话。
  • 消息历史持久化。
  • AI 回复失败处理。
  • 消息输入队列和异步处理。
  • 用户消息与 AI 消息区分展示。
  • 适配 OpenAI-compatible Chat Completions 风格接口。

2. 角色与伴侣管理

  • 创建虚拟伴侣。
  • 编辑角色资料。
  • 角色头像、名称、设定、描述管理。
  • 默认伴侣 seed 框架。
  • 角色资料可扩展到人格、语气、背景故事、互动风格。

3. 群聊框架

  • 群组数据结构。
  • 群消息持久化。
  • 多角色互动基础。
  • 可扩展为多人 AI 剧场、虚拟社群、AI 角色扮演房间。

4. 记忆系统

  • 记忆条目管理。
  • MemoryEntry 数据模型。
  • 可扩展长期记忆、用户偏好、角色关系、重要事件。
  • 为后续向量检索、RAG、上下文召回预留工程空间。

5. API 配置中心

支持多种 Provider 类型和自定义接口:

  • OpenAI
  • Claude / Anthropic
  • Gemini
  • DeepSeek
  • DashScope / 通义千问
  • Kimi

Related repositories

Similar projects matched by category, topics, and programming language.

MarshallBear1
MarshallBear1 GitHub avatar

react-native-system-thumbnails

A React Native library that generates OS-native thumbnails for local files with a single API, falling back to file icons when needed.

Kotlin
114
doesthings
doesthings GitHub avatar

FreeFCC

FreeFCC is a free, open-source Android app that unlocks FCC mode on DJI smart controllers by sending raw DUML commands from JSON profiles, without servers or tracking.

Kotlin
113
v-modal
v-modal GitHub avatar

vmodal_sdk_android

VModal for Android is a Kotlin SDK that adds multimodal video search and upload capabilities to Android apps, allowing users to find video moments by meaning, speech, text, or imagery.

Kotlin
111