智能体会话开发
This commit is contained in:
@@ -27,14 +27,19 @@ import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.aiosman.ravenow.LocalAppTheme
|
||||
import com.aiosman.ravenow.LocalNavController
|
||||
import com.aiosman.ravenow.R
|
||||
import com.aiosman.ravenow.ui.composables.AgentCard
|
||||
import com.aiosman.ravenow.ui.navigateToChat
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@Composable
|
||||
fun MineAgent() {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val navController = LocalNavController.current
|
||||
val model = MineAgentViewModel
|
||||
var agentList = model.agentList
|
||||
val scope = rememberCoroutineScope()
|
||||
@@ -108,7 +113,11 @@ fun MineAgent() {
|
||||
key = { idx -> idx }
|
||||
) { idx ->
|
||||
val agentItem = agentList[idx]
|
||||
AgentCard(agentEntity = agentItem)
|
||||
AgentCard(agentEntity = agentItem,
|
||||
onClick = {
|
||||
//model.createSingleChat(agentItem.openId)
|
||||
model.goToChatAi(agentItem.openId,navController)
|
||||
})
|
||||
}
|
||||
|
||||
// 加载更多指示器
|
||||
|
||||
@@ -104,12 +104,12 @@ object MineAgentViewModel : ViewModel() {
|
||||
return body.toString()
|
||||
|
||||
}
|
||||
fun goToChat(
|
||||
conversation: Conversation,
|
||||
fun goToChatAi(
|
||||
openId: String,
|
||||
navController: NavHostController
|
||||
) {
|
||||
viewModelScope.launch {
|
||||
val profile = userService.getUserProfileByTrtcUserId(conversation.trtcUserId)
|
||||
val profile = userService.getUserProfileByOpenId(openId)
|
||||
navController.navigateToChat(profile.id.toString())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,10 +279,11 @@ fun NotificationsScreen() {
|
||||
}
|
||||
}
|
||||
|
||||
/*Box(
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.fillMaxWidth(),
|
||||
.fillMaxWidth()
|
||||
,
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
if (AppState.enableChat){
|
||||
@@ -303,7 +304,7 @@ fun NotificationsScreen() {
|
||||
)
|
||||
}
|
||||
|
||||
}*/
|
||||
}
|
||||
}
|
||||
PullRefreshIndicator(
|
||||
MessageListViewModel.isLoading,
|
||||
|
||||
@@ -63,38 +63,40 @@ fun TimelineMomentsList() {
|
||||
) {
|
||||
items(
|
||||
moments.size,
|
||||
key = { idx -> moments[idx].id }
|
||||
key = { idx -> moments.getOrNull(idx)?.id ?: idx }
|
||||
) { idx ->
|
||||
val momentItem = moments[idx]
|
||||
MomentCard(momentEntity = momentItem,
|
||||
onAddComment = {
|
||||
scope.launch {
|
||||
model.onAddComment(momentItem.id)
|
||||
}
|
||||
},
|
||||
onLikeClick = {
|
||||
scope.launch {
|
||||
if (momentItem.liked) {
|
||||
model.dislikeMoment(momentItem.id)
|
||||
} else {
|
||||
model.likeMoment(momentItem.id)
|
||||
moments.getOrNull(idx)?.let { momentItem ->
|
||||
MomentCard(
|
||||
momentEntity = momentItem,
|
||||
onAddComment = {
|
||||
scope.launch {
|
||||
model.onAddComment(momentItem.id)
|
||||
}
|
||||
}
|
||||
},
|
||||
onFavoriteClick = {
|
||||
scope.launch {
|
||||
if (momentItem.isFavorite) {
|
||||
model.unfavoriteMoment(momentItem.id)
|
||||
} else {
|
||||
model.favoriteMoment(momentItem.id)
|
||||
},
|
||||
onLikeClick = {
|
||||
scope.launch {
|
||||
if (momentItem.liked) {
|
||||
model.dislikeMoment(momentItem.id)
|
||||
} else {
|
||||
model.likeMoment(momentItem.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onFollowClick = {
|
||||
model.followAction(momentItem)
|
||||
},
|
||||
showFollowButton = false
|
||||
)
|
||||
},
|
||||
onFavoriteClick = {
|
||||
scope.launch {
|
||||
if (momentItem.isFavorite) {
|
||||
model.unfavoriteMoment(momentItem.id)
|
||||
} else {
|
||||
model.favoriteMoment(momentItem.id)
|
||||
}
|
||||
}
|
||||
},
|
||||
onFollowClick = {
|
||||
model.followAction(momentItem)
|
||||
},
|
||||
showFollowButton = false
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
PullRefreshIndicator(model.refreshing, state, Modifier.align(Alignment.TopCenter))
|
||||
|
||||
@@ -233,7 +233,7 @@ fun ProfileV3(
|
||||
.fillMaxWidth()
|
||||
.height(bannerHeight.dp - 24.dp)
|
||||
.let {
|
||||
if (isSelf) {
|
||||
if (isSelf&&isMain) {
|
||||
it.noRippleClickable {
|
||||
Intent(Intent.ACTION_PICK).apply {
|
||||
type = "image/*"
|
||||
@@ -383,8 +383,11 @@ fun ProfileV3(
|
||||
Row(
|
||||
modifier = Modifier.padding(
|
||||
horizontal = 16.dp,
|
||||
vertical = 8.dp
|
||||
),
|
||||
vertical = 8.dp,
|
||||
).noRippleClickable {
|
||||
|
||||
},
|
||||
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
if (!isMain) {
|
||||
|
||||
Reference in New Issue
Block a user