diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e40b544..a9c46bb 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -17,8 +17,8 @@ android { applicationId = "dev.chungjungsoo.gptmobile" minSdk = 31 targetSdk = 35 - versionCode = 12 - versionName = "0.6.0" + versionCode = 13 + versionName = "0.6.1" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { @@ -71,9 +71,6 @@ dependencies { implementation(libs.androidx.ui.tooling.preview) implementation(libs.androidx.material3) - // AI Edge SDK - implementation(libs.ai.core) - // SplashScreen implementation(libs.splashscreen) diff --git a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/data/repository/ChatRepository.kt b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/data/repository/ChatRepository.kt index 4077288..bd999ad 100644 --- a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/data/repository/ChatRepository.kt +++ b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/data/repository/ChatRepository.kt @@ -15,7 +15,6 @@ interface ChatRepository { suspend fun fetchChatList(): List suspend fun fetchMessages(chatId: Int): List fun generateDefaultChatTitle(messages: List): String? - fun generateAIChatTitle(messages: List): Flow suspend fun updateChatTitle(chatRoom: ChatRoom, title: String) suspend fun saveChat(chatRoom: ChatRoom, messages: List): ChatRoom suspend fun deleteChats(chatRooms: List) diff --git a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/data/repository/ChatRepositoryImpl.kt b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/data/repository/ChatRepositoryImpl.kt index 237f9ab..88ef4ae 100644 --- a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/data/repository/ChatRepositoryImpl.kt +++ b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/data/repository/ChatRepositoryImpl.kt @@ -34,7 +34,6 @@ import dev.chungjungsoo.gptmobile.data.network.AnthropicAPI import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch -import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onCompletion import kotlinx.coroutines.flow.onStart @@ -180,33 +179,6 @@ class ChatRepositoryImpl @Inject constructor( override fun generateDefaultChatTitle(messages: List): String? = messages.sortedBy { it.createdAt }.firstOrNull { it.platformType == null }?.content?.replace('\n', ' ')?.take(50) - override fun generateAIChatTitle(messages: List): Flow { - if (messages.isEmpty()) { - return flow { "Untitled Chat" } - } - - val generationConfig = com.google.ai.edge.aicore.generationConfig { - context = appContext // required - temperature = 1f - maxOutputTokens = 25 - } - val model = com.google.ai.edge.aicore.GenerativeModel(generationConfig = generationConfig) - - var request = ModelConstants.CHAT_TITLE_GENERATE_PROMPT - messages.sortedBy { it.createdAt }.forEach { message -> - request += when (message.platformType) { - null -> "User: ${message.content}\n\n" - else -> "Assistant: ${message.content}\n\n" - } - } - - return model.generateContentStream(request) - .map { response -> ApiState.Success(response.text ?: "") } - .catch { throwable -> emit(ApiState.Error("Cannot process this request at the moment.")) } - .onStart { emit(ApiState.Loading) } - .onCompletion { emit(ApiState.Done) } - } - override suspend fun updateChatTitle(chatRoom: ChatRoom, title: String) { chatRoomDao.editChatRoom(chatRoom.copy(title = title.replace('\n', ' ').take(50))) } diff --git a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/chat/ChatScreen.kt b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/chat/ChatScreen.kt index 1e6e53a..4093c74 100644 --- a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/chat/ChatScreen.kt +++ b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/chat/ChatScreen.kt @@ -300,7 +300,7 @@ fun ChatScreen( if (isChatTitleDialogOpen) { ChatTitleDialog( initialTitle = chatRoom.title, - aiCoreModeEnabled = canEnableAICoreMode, + aiCoreModeEnabled = false, aiGeneratedResult = geminiNano.content, isAICoreLoading = geminiNanoLoadingState == ChatViewModel.LoadingState.Loading, onDefaultTitleMode = chatViewModel::generateDefaultChatTitle, diff --git a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/chat/ChatViewModel.kt b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/chat/ChatViewModel.kt index 56d1671..3287e6e 100644 --- a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/chat/ChatViewModel.kt +++ b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/chat/ChatViewModel.kt @@ -164,8 +164,6 @@ class ChatViewModel @Inject constructor( viewModelScope.launch { _geminiNanoLoadingState.update { LoadingState.Loading } _geminiNanoMessage.update { it.copy(content = "") } - val chatFlow = chatRepository.generateAIChatTitle(_messages.value) - chatFlow.collect { chunk -> geminiNanoFlow.emit(chunk) } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1ddb83f..ecad880 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,4 @@ [versions] -aicore = "0.0.1-exp01" agp = "8.7.2" autoLicense = "11.2.2" kotlin = "2.0.20" @@ -41,7 +40,6 @@ androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-toolin androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } androidx-material3 = { group = "androidx.compose.material3", name = "material3" } -ai-core = { group = "com.google.ai.edge.aicore", name = "aicore", version.ref = "aicore"} auto-license-core = { group = "com.mikepenz", name = "aboutlibraries-core", version.ref = "autoLicense" } auto-license-ui = { group = "com.mikepenz", name = "aboutlibraries-compose-m3", version.ref = "autoLicense" } compose-markdown = { group = "com.github.jeziellago", name = "compose-markdown", version.ref = "markdown" }