Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import androidx.compose.material.icons.outlined.Extension
import androidx.compose.material.icons.outlined.Hub
import androidx.compose.material.icons.outlined.Link
import androidx.compose.material.icons.outlined.Psychology
import androidx.compose.material.icons.outlined.RocketLaunch
import androidx.compose.material.icons.outlined.Schedule
import androidx.compose.material.icons.outlined.Settings
import androidx.compose.material.icons.outlined.Terminal
Expand Down Expand Up @@ -94,6 +95,8 @@ import com.google.ai.edge.gallery.ui.navigation.GALLERY_ROUTE_MODEL
import com.google.ai.edge.gallery.ui.navigation.GalleryNavHost
import com.google.ai.edge.gallery.data.TerminalSessionManager
import com.google.ai.edge.gallery.data.SharedShellManager
import com.google.ai.edge.gallery.ui.osmodules.AppProjectCreationScreen
import com.google.ai.edge.gallery.ui.osmodules.AppConfig
import com.google.ai.edge.gallery.ui.osmodules.BrainBoxModuleScreen
import com.google.ai.edge.gallery.ui.osmodules.DiffBoxScreen
import com.google.ai.edge.gallery.ui.osmodules.ExtBoxScreen
Expand Down Expand Up @@ -121,6 +124,7 @@ private enum class OsModule(val label: String, val icon: ImageVector) {
EXT_BOX("EXT_BOX", Icons.Outlined.Extension),
SCDL_BOX("SCDL_BOX", Icons.Outlined.Schedule),
LNK_BOX("LNK_BOX", Icons.Outlined.Link),
PROJ_BOX("PROJ_BOX", Icons.Outlined.RocketLaunch),
VENDING_MACHINE("VENDING_MACHINE", Icons.Outlined.DashboardCustomize),
SYS_SETTINGS("SETTINGS", Icons.Outlined.Settings),
}
Expand Down Expand Up @@ -322,6 +326,34 @@ fun GalleryApp(
)
OsModule.SCDL_BOX -> ScdlBoxScreen(db = db)
OsModule.LNK_BOX -> LnkBoxScreen(mcpConnectionManager = mcpConnectionManager)
OsModule.PROJ_BOX -> AppProjectCreationScreen(
onGeneratePlanningSession = { config: AppConfig ->
// Hand the config off to the chat agent and switch back to CHAT_BOX.
val prompt = buildString {
appendLine("I want to plan a new app called \"${config.workingTitle}\".")
if (config.uiTheme.isNotBlank()) appendLine("UI theme: ${config.uiTheme}")
if (config.references.isNotEmpty()) {
appendLine("References:")
config.references.forEach { appendLine(" - $it") }
}
if (config.features.isNotEmpty()) {
appendLine("Features:")
fun appendFeatures(features: List<com.google.ai.edge.gallery.ui.osmodules.FeatureNode>, indent: Int) {
features.forEach { f ->
appendLine("${" ".repeat(indent)}- ${f.name}: ${f.description}")
appendFeatures(f.subFeatures, indent + 1)
}
}
appendFeatures(config.features, 1)
}
appendLine("Please generate a detailed planning session for this app.")
}
// Log the planning config; the user can paste it into the chat agent.
android.util.Log.d("PROJ_BOX", "Planning session:\n$prompt")
Comment on lines +351 to +352
activeModule = OsModule.CHAT_BOX
},
onCancel = { activeModule = OsModule.CHAT_BOX },
)
OsModule.SYS_SETTINGS -> SystemSettingsScreen(
modelManagerViewModel = modelManagerViewModel,
skillManagerViewModel = skillManagerViewModel,
Expand Down
Loading
Loading