智能体会话开发

This commit is contained in:
weber
2025-08-07 19:03:05 +08:00
parent 38759eb3e4
commit f6a796e2bc
17 changed files with 1084 additions and 45 deletions

View File

@@ -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
)
}

View File

@@ -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()
}
}

View File

@@ -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