智能体会话开发
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.aiosman.ravenow.data
|
||||
|
||||
import com.aiosman.ravenow.AppState
|
||||
import com.aiosman.ravenow.AppStore
|
||||
import com.aiosman.ravenow.data.api.ApiClient
|
||||
import com.aiosman.ravenow.data.api.AppConfig
|
||||
import com.aiosman.ravenow.data.api.CaptchaInfo
|
||||
@@ -53,6 +54,8 @@ data class AccountProfile(
|
||||
val banner: String?,
|
||||
// trtcUserId
|
||||
val trtcUserId: String,
|
||||
// aiAccount true:ai false:普通用户
|
||||
val aiAccount: Boolean
|
||||
) {
|
||||
/**
|
||||
* 转换为Entity
|
||||
@@ -63,7 +66,13 @@ data class AccountProfile(
|
||||
followerCount = followerCount,
|
||||
followingCount = followingCount,
|
||||
nickName = nickname,
|
||||
avatar = "${ApiClient.BASE_SERVER}$avatar",
|
||||
avatar = if (aiAccount) {
|
||||
// 对于AI账户,直接使用原始头像URL,不添加服务器前缀
|
||||
"${ApiClient.BASE_API_URL+"/outside"}$avatar"+"?token="+"Bearer ${AppStore.token}"
|
||||
} else {
|
||||
// 对于普通用户,添加服务器前缀
|
||||
"${ApiClient.BASE_SERVER}$avatar"
|
||||
},
|
||||
bio = bio,
|
||||
country = "Worldwide",
|
||||
isFollowing = isFollowing,
|
||||
@@ -74,6 +83,7 @@ data class AccountProfile(
|
||||
null
|
||||
},
|
||||
trtcUserId = trtcUserId,
|
||||
aiAccount = aiAccount,
|
||||
rawAvatar = avatar
|
||||
)
|
||||
}
|
||||
|
||||
@@ -48,8 +48,23 @@ interface UserService {
|
||||
followingId: Int? = null
|
||||
): ListContainer<AccountProfileEntity>
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param id 用户ID
|
||||
* @return 用户信息
|
||||
*/
|
||||
|
||||
suspend fun getUserProfileByTrtcUserId(id: String):AccountProfileEntity
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param id 用户ID
|
||||
* @return 用户信息
|
||||
*/
|
||||
|
||||
suspend fun getUserProfileByOpenId(id: String):AccountProfileEntity
|
||||
|
||||
}
|
||||
|
||||
class UserServiceImpl : UserService {
|
||||
@@ -97,4 +112,10 @@ class UserServiceImpl : UserService {
|
||||
val body = resp.body() ?: throw ServiceException("Failed to get account")
|
||||
return body.data.toAccountProfileEntity()
|
||||
}
|
||||
|
||||
override suspend fun getUserProfileByOpenId(id: String): AccountProfileEntity {
|
||||
val resp = ApiClient.api.getAccountProfileByOpenId(id)
|
||||
val body = resp.body() ?: throw ServiceException("Failed to get account")
|
||||
return body.data.toAccountProfileEntity()
|
||||
}
|
||||
}
|
||||
@@ -373,6 +373,12 @@ interface RaveNowAPI {
|
||||
@Path("id") id: String
|
||||
): Response<DataContainer<AccountProfile>>
|
||||
|
||||
|
||||
@GET("profile/aichat/profile/{id}")
|
||||
suspend fun getAccountProfileByOpenId(
|
||||
@Path("id") id: String
|
||||
): Response<DataContainer<AccountProfile>>
|
||||
|
||||
@POST("user/{id}/follow")
|
||||
suspend fun followUser(
|
||||
@Path("id") id: Int
|
||||
|
||||
Reference in New Issue
Block a user