Skip to content

Commit 48bc649

Browse files
committed
fix(agent): use user home dir as fallback for rootPath #453
Set rootPath to the user's home directory if currentWorkspace is null.
1 parent c76a974 commit 48bc649

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/agent/AgentChatInterface.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import androidx.compose.runtime.*
88
import androidx.compose.ui.Alignment
99
import androidx.compose.ui.Modifier
1010
import androidx.compose.ui.unit.dp
11+
import cc.unitmesh.agent.Platform
1112
import cc.unitmesh.devins.ui.compose.editor.DevInEditorInput
1213
import cc.unitmesh.devins.workspace.WorkspaceManager
1314
import cc.unitmesh.llm.KoogLLMService
@@ -39,7 +40,8 @@ fun AgentChatInterface(
3940
val viewModel =
4041
remember(llmService, currentWorkspace?.rootPath) {
4142
val workspace = currentWorkspace
42-
val rootPath = workspace?.rootPath ?: return@remember null
43+
val rootPath = workspace?.rootPath ?: Platform.getUserHomeDir()
44+
4345
if (llmService != null) {
4446
CodingAgentViewModel(
4547
llmService = llmService,

0 commit comments

Comments
 (0)