This is a Kotlin Multiplatform (KMP) project demonstrating how to integrate a locally running Large Language Model (LLM) with Ollama into a KMP application that supports Android, iOS, and Desktop platforms. The project showcases key features like chat history management with Room, user preferences storage with DataStore, and support for both light and dark themes.
- β Local LLM Integration: Chat with locally running DeepSeek models on Ollama.
- π± Multiplatform Support: Works seamlessly on Android, iOS, and Desktop.
- πΎ Chat History: Uses Room Database (for Android & Desktop) to persist chat history.
- βοΈ User Preferences: Uses DataStore to save theme and model preferences.
- π¨ Theming: Supports light and dark themes.
- π§ Example Models:
- πΉ
deepseek-r1:1.5b
- πΉ
deepseek-coder:1.3b
- πΉ
- π Kotlin Multiplatform (KMP)
- π¨ Jetpack Compose (Android UI)
- π Jetpack Compose (iOS UI)
- π» Compose for Desktop
- π Ktor (for networking & communicating with Ollama API)
- π Room Database (for chat history on Android & Desktop)
- π DataStore (for storing preferences)
- π§ Ollama (for running local LLMs)
- Install Ollama and set up the required models:
ollama pull deepseek-r1:1.5b ollama pull deepseek-coder:1.3b
- Ensure you have the necessary tools installed for KMP development:
- π± Android Studio (for Android & Desktop)
- π Xcode (for iOS)
- Open the project in Android Studio.
- Select an Android device/emulator and run the app.
- Open the
iosApp
project in Xcode. - Run on an iOS Simulator or a physical device.
- Use
gradle
to build and run the Desktop app:./gradlew run
- π§ Modify the Ollama server URL if necessary in the Ktor client configuration.
- π Customize available models in the UI as needed.
This project is licensed under the MIT License. Feel free to modify and use it in your projects!
Feel free to contribute, report issues, or suggest improvements via GitHub Issues or Pull Requests. Your feedback is welcome! π