预留首页-探索,完善群组功能

This commit is contained in:
weber
2025-08-13 18:57:03 +08:00
parent 2d518cbd68
commit bc7a897cec
17 changed files with 1045 additions and 128 deletions

View File

@@ -15,6 +15,8 @@ import com.aiosman.ravenow.data.api.ResetPasswordRequestBody
import com.aiosman.ravenow.data.api.TrtcSignResponseBody
import com.aiosman.ravenow.data.api.UnRegisterMessageChannelRequestBody
import com.aiosman.ravenow.data.api.UpdateNoticeRequestBody
import com.aiosman.ravenow.data.DataContainer
import com.aiosman.ravenow.data.ListContainer
import com.aiosman.ravenow.data.api.UpdateUserLangRequestBody
import com.aiosman.ravenow.entity.AccountFavouriteEntity
import com.aiosman.ravenow.entity.AccountLikeEntity
@@ -55,7 +57,9 @@ data class AccountProfile(
// trtcUserId
val trtcUserId: String,
// aiAccount true:ai false:普通用户
val aiAccount: Boolean
val aiAccount: Boolean,
val chatAIId: String,
) {
/**
* 转换为Entity
@@ -79,7 +83,8 @@ data class AccountProfile(
},
trtcUserId = trtcUserId,
aiAccount = aiAccount,
rawAvatar = avatar
rawAvatar = avatar,
chatAIId = chatAIId
)
}
}
@@ -394,6 +399,21 @@ interface AccountService {
suspend fun getAppConfig(): AppConfig
suspend fun removeAccount(password: String)
/**
* 获取AI智能体列表
* @param page 页码
* @param pageSize 每页数量
*/
suspend fun getAgent(page: Int, pageSize: Int): retrofit2.Response<DataContainer<ListContainer<Agent>>>
/**
* 创建群聊
* @param name 群聊名称
* @param userIds 用户ID列表
* @param promptIds AI智能体ID列表
*/
suspend fun createGroupChat(name: String, userIds: List<String>, promptIds: List<String>): retrofit2.Response<DataContainer<Unit>>
}
class AccountServiceImpl : AccountService {
@@ -574,4 +594,17 @@ class AccountServiceImpl : AccountService {
throw ServiceException("Failed to remove account")
}
}
override suspend fun getAgent(page: Int, pageSize: Int): retrofit2.Response<DataContainer<ListContainer<Agent>>> {
return ApiClient.api.getAgent(page, pageSize)
}
override suspend fun createGroupChat(name: String, userIds: List<String>, promptIds: List<String>): retrofit2.Response<DataContainer<Unit>> {
val requestBody = com.aiosman.ravenow.data.api.CreateGroupChatRequestBody(
name = name,
userIds = userIds,
promptIds = promptIds
)
return ApiClient.api.createGroupChat(requestBody)
}
}

View File

@@ -29,6 +29,7 @@ data class Agent(
val updatedAt: String,
@SerializedName("useCount")
val useCount: Int
) {
fun toAgentEntity(): AgentEntity {
return AgentEntity(

View File

@@ -56,6 +56,15 @@ data class SendChatAiRequestBody(
)
data class CreateGroupChatRequestBody(
@SerializedName("name")
val name: String,
@SerializedName("userIds")
val userIds: List<String>,
@SerializedName("promptIds")
val promptIds: List<String>,
)
data class LoginUserRequestBody(
@SerializedName("username")
val username: String? = null,
@@ -529,6 +538,9 @@ interface RaveNowAPI {
@POST("outside/rooms/message")
suspend fun sendChatAiMessage(@Body body: SendChatAiRequestBody): Response<DataContainer<Unit>>
@POST("outside/rooms")
suspend fun createGroupChat(@Body body: CreateGroupChatRequestBody): Response<DataContainer<Unit>>