Files
rider-pro-android-app/app/src/main/java/com/aiosman/ravenow/data/AgentService.kt
2025-08-13 18:57:03 +08:00

98 lines
2.4 KiB
Kotlin

package com.aiosman.ravenow.data
import com.aiosman.ravenow.AppStore
import com.aiosman.ravenow.data.api.ApiClient
import com.aiosman.ravenow.entity.AgentEntity
import com.aiosman.ravenow.entity.ProfileEntity
import com.google.gson.annotations.SerializedName
data class Agent(
@SerializedName("author")
val author: String,
@SerializedName("avatar")
val avatar: String,
@SerializedName("breakMode")
val breakMode: Boolean,
@SerializedName("createdAt")
val createdAt: String,
@SerializedName("desc")
val desc: String,
@SerializedName("id")
val id: Int,
@SerializedName("isPublic")
val isPublic: Boolean,
@SerializedName("openId")
val openId: String,
@SerializedName("title")
val title: String,
@SerializedName("updatedAt")
val updatedAt: String,
@SerializedName("useCount")
val useCount: Int
) {
fun toAgentEntity(): AgentEntity {
return AgentEntity(
id = id,
title = title,
desc = desc,
createdAt = createdAt,
updatedAt = updatedAt,
avatar = "${ApiClient.BASE_API_URL+"/outside"}$avatar"+"?token="+"${AppStore.token}",
//author = author,
isPublic = isPublic,
openId = openId,
breakMode = breakMode,
useCount = useCount,
)
}
}
data class Profile(
@SerializedName("aiAccount")
val aiAccount: Boolean,
@SerializedName("avatar")
val avatar: String,
@SerializedName("banner")
val banner: String,
@SerializedName("bio")
val bio: String,
@SerializedName("chatAIId")
val chatAIId: String,
@SerializedName("id")
val id: Int,
@SerializedName("nickname")
val nickname: String,
@SerializedName("trtcUserId")
val trtcUserId: String,
@SerializedName("username")
val username: String
){
fun toProfileEntity(): ProfileEntity {
return ProfileEntity(
id = id,
username = username,
nickname = nickname,
avatar = "${ApiClient.BASE_SERVER}$avatar",
bio = bio,
banner = "${ApiClient.BASE_SERVER}$banner",
trtcUserId = trtcUserId,
chatAIId = chatAIId,
aiAccount = aiAccount
)
}
}
interface AgentService {
/**
* 获取智能体列表
*/
suspend fun getAgent(
pageNumber: Int,
pageSize: Int = 20
): ListContainer<AgentEntity>
}