Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fernandospr/kmp-storyteller
Choose a character πΆπ± and Gemini AI will generate a bedtime story for you.
https://github.com/fernandospr/kmp-storyteller
avspeechsynthesizer compose gemini-ai kotlin kotlin-multiplatform kotlin-multiplatform-sample multiplatform texttospeech
Last synced: 3 months ago
JSON representation
Choose a character πΆπ± and Gemini AI will generate a bedtime story for you.
- Host: GitHub
- URL: https://github.com/fernandospr/kmp-storyteller
- Owner: fernandospr
- Created: 2024-02-15T21:08:46.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-06-14T00:33:03.000Z (8 months ago)
- Last Synced: 2024-06-14T02:07:28.704Z (8 months ago)
- Topics: avspeechsynthesizer, compose, gemini-ai, kotlin, kotlin-multiplatform, kotlin-multiplatform-sample, multiplatform, texttospeech
- Language: Kotlin
- Homepage:
- Size: 927 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![]()
# Kotlin Multiplatform Story Teller App
Choose a character πΆπ± and Gemini AI will generate a bedtime story for you.
### Showcase (sound on!)
https://github.com/fernandospr/kmp-storyteller/assets/4404680/7f6e3e9f-bbf5-48d5-b688-42383d5bb1e3### Setting up your development environment
To setup the environment, please consult these [instructions](https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-multiplatform-setup.html).### Before running
* Get a [Gemini API Key](https://aistudio.google.com/app/apikey)
* Add to `local.properties` file located in the root directory (create if it doesn't exist):
`gemini.api_key=YOUR_KEY`### Running the Android app
Open project in IntelliJ IDEA or Android Studio and run `composeApp` configuration.### Running the iOS app
Open project in IntelliJ IDEA or Android Studio and run `iosApp` configuration.Or open `iosApp/iosApp.xcodeproj` in Xcode and run it.
### Technologies
The app uses the following multiplatform dependencies in its implementation:
* [Compose Multiplatform](https://www.jetbrains.com/lp/compose-multiplatform/) for UI
* [Ktor](https://ktor.io/) for networking with [Gemini API](https://ai.google.dev/docs/gemini_api_overview)
* [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) for JSON handling
* [Compose ViewModel](https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-viewmodel.html) to store and manage UI-related data
* [gradle-buildconfig-plugin](https://github.com/gmazzo/gradle-buildconfig-plugin) to expose the Gemini API Key as a constant from `local.properties`
* [Compose Navigation](https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-navigation-routing.html) for navigation between screensTo synthesize speech from the story text, it uses:
* [TextToSpeech](https://developer.android.com/reference/android/speech/tts/TextToSpeech) for Android
* [AVSpeechSynthesizer](https://developer.apple.com/documentation/avfaudio/avspeechsynthesizer) for iOS### How to modify the AI prompt?
If you want the AI to generate other type of stories or make them longer, you can modify the prompt by opening the `strings.xml` files. You'll find one prompt string per language.### How to add more characters?
Open `CharacterRepository` and modify `getAllCharacters()`: Add the character you desire by providing a **name**, **emoji** and a **background color**.You have to declare the name in the `strings.xml` files. You'll find one name string per language.