背景,大模型 接口接入
This commit is contained in:
parent
1e82e8278a
commit
d40644c6d2
|
|
@ -141,7 +141,7 @@ android {
|
||||||
buildConfigString("RECHAEGE_SERVICES", "https://test.xxxxx.ai/policy/recharge")
|
buildConfigString("RECHAEGE_SERVICES", "https://test.xxxxx.ai/policy/recharge")
|
||||||
buildConfigString("RTC_APP_ID", "689ade491323ae01797818e0-XXX-TODO")
|
buildConfigString("RTC_APP_ID", "689ade491323ae01797818e0-XXX-TODO")
|
||||||
|
|
||||||
buildConfigString("API_BASE", "http://54.223.196.180:9090")
|
buildConfigString("API_BASE", "http://54.223.196.180:8091")
|
||||||
//buildConfigString("API_BASE", "http://192.168.110.113:9090")
|
//buildConfigString("API_BASE", "http://192.168.110.113:9090")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +162,7 @@ android {
|
||||||
buildConfigString("RECHAEGE_SERVICES", "https://test.xxxxx.ai/policy/recharge")
|
buildConfigString("RECHAEGE_SERVICES", "https://test.xxxxx.ai/policy/recharge")
|
||||||
buildConfigString("RTC_APP_ID", "689ade491323ae01797818e0-XXX-TODO")
|
buildConfigString("RTC_APP_ID", "689ade491323ae01797818e0-XXX-TODO")
|
||||||
|
|
||||||
buildConfigString("API_BASE", "http://54.223.196.180:9090")
|
buildConfigString("API_BASE", "http://54.223.196.180:8091")
|
||||||
//buildConfigString("API_BASE", "http://192.168.110.113:9090")
|
//buildConfigString("API_BASE", "http://192.168.110.113:9090")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import com.remax.visualnovel.entity.request.SimpleDataDTO
|
||||||
import com.remax.visualnovel.entity.request.VoiceTTS
|
import com.remax.visualnovel.entity.request.VoiceTTS
|
||||||
import com.remax.visualnovel.entity.response.Album
|
import com.remax.visualnovel.entity.response.Album
|
||||||
import com.remax.visualnovel.entity.response.Character
|
import com.remax.visualnovel.entity.response.Character
|
||||||
|
import com.remax.visualnovel.entity.response.ChatAiModule
|
||||||
import com.remax.visualnovel.entity.response.ChatBackgroundBase
|
import com.remax.visualnovel.entity.response.ChatBackgroundBase
|
||||||
import com.remax.visualnovel.entity.response.ChatModel
|
import com.remax.visualnovel.entity.response.ChatModel
|
||||||
import com.remax.visualnovel.entity.response.ChatSet
|
import com.remax.visualnovel.entity.response.ChatSet
|
||||||
|
|
@ -27,9 +28,7 @@ import com.remax.visualnovel.entity.response.VoiceASR
|
||||||
import com.remax.visualnovel.entity.response.base.Response
|
import com.remax.visualnovel.entity.response.base.Response
|
||||||
import com.remax.visualnovel.entity.response.basenew.ResponseNew
|
import com.remax.visualnovel.entity.response.basenew.ResponseNew
|
||||||
import retrofit2.http.Body
|
import retrofit2.http.Body
|
||||||
import retrofit2.http.GET
|
|
||||||
import retrofit2.http.POST
|
import retrofit2.http.POST
|
||||||
import retrofit2.http.Query
|
|
||||||
|
|
||||||
interface ChatService {
|
interface ChatService {
|
||||||
|
|
||||||
|
|
@ -171,12 +170,12 @@ interface ChatService {
|
||||||
suspend fun requestSoundList(@Body param: ParamSoundList): ResponseNew<List<ChatSound>>
|
suspend fun requestSoundList(@Body param: ParamSoundList): ResponseNew<List<ChatSound>>
|
||||||
|
|
||||||
@POST(BuildConfig.API_BASE + "/model/config/list")
|
@POST(BuildConfig.API_BASE + "/model/config/list")
|
||||||
suspend fun requestAiModelList(@Body language: Int = 1): ResponseNew<List<ChatModel>>
|
suspend fun requestAiModelList(@Body language: Int = 1): ResponseNew<List<ChatAiModule>>
|
||||||
|
|
||||||
@POST(BuildConfig.API_BASE + "/bg_image/config/upload")
|
@POST(BuildConfig.API_BASE + "/file/bgImage/upload")
|
||||||
suspend fun uploadCustomBgPic(@Body param: ParamBgUpload): ResponseNew<Any>
|
suspend fun uploadCustomBgPic(@Body param: ParamBgUpload): ResponseNew<Any>
|
||||||
|
|
||||||
@POST(BuildConfig.API_BASE + "/bg_image/config/list")
|
@POST(BuildConfig.API_BASE + "/file/bgImage/list")
|
||||||
suspend fun requestChatBgList(@Body userId: Int): ResponseNew<List<ChatBackgroundBase.ChatBackground>>
|
suspend fun requestChatBgList(@Body userId: Int): ResponseNew<List<ChatBackgroundBase.ChatBackground>>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.remax.visualnovel.entity.response
|
||||||
|
|
||||||
|
|
||||||
|
data class ChatAiModule(
|
||||||
|
val modelId: Long = 0,
|
||||||
|
val nameLanguage: String,
|
||||||
|
val desLanguage: String? = null,
|
||||||
|
val price: Int = 0,
|
||||||
|
val rules: Int = 0,
|
||||||
|
val icon: String? = null,
|
||||||
|
|
||||||
|
// others
|
||||||
|
var isSelected: Boolean = false,
|
||||||
|
)
|
||||||
|
|
@ -37,14 +37,14 @@ class ChatRepository @Inject constructor(private val chatService: ChatService) :
|
||||||
chatService.requestAiModelList(language)
|
chatService.requestAiModelList(language)
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun uploadCustomBgPic(param: ParamBgUpload) = executeHttp {
|
|
||||||
chatService.uploadCustomBgPic(param)
|
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun getChatBgList(userId: Int) = executeHttp {
|
suspend fun getChatBgList(userId: Int) = executeHttp {
|
||||||
chatService.requestChatBgList(userId)
|
chatService.requestChatBgList(userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun uploadCustomBgPic(param: ParamBgUpload) = executeHttp {
|
||||||
|
chatService.uploadCustomBgPic(param)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -74,6 +74,38 @@ class ChatActivity : BaseBindingActivity<ActivityActorChatBinding>() {
|
||||||
|
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
loadSoundDatas(null)
|
loadSoundDatas(null)
|
||||||
|
loadAiModuleDatas()
|
||||||
|
loadChantBgDatas()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadAiModuleDatas() {
|
||||||
|
launchAndCollect2({
|
||||||
|
mViewModel.loadAiModelList(LanguageUtil.instance().getCurrentLanguageCode())
|
||||||
|
}) {
|
||||||
|
onSuccess = {
|
||||||
|
val dataList = it?: emptyList()
|
||||||
|
binding.settingView.setAiModulesItems(dataList)
|
||||||
|
}
|
||||||
|
|
||||||
|
onComplete = {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadChantBgDatas() {
|
||||||
|
launchAndCollect2({
|
||||||
|
mViewModel.loadChatBgList(1)
|
||||||
|
}) {
|
||||||
|
onSuccess = {
|
||||||
|
val dataList = it?: emptyList()
|
||||||
|
binding.settingView.setBackgroundItems(dataList)
|
||||||
|
}
|
||||||
|
|
||||||
|
onComplete = {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadSoundDatas(gender: Int?) {
|
private fun loadSoundDatas(gender: Int?) {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ package com.remax.visualnovel.ui.chat
|
||||||
import com.remax.visualnovel.app.viewmodel.base.OssViewModel
|
import com.remax.visualnovel.app.viewmodel.base.OssViewModel
|
||||||
import com.remax.visualnovel.entity.imbean.raw.CustomRawData
|
import com.remax.visualnovel.entity.imbean.raw.CustomRawData
|
||||||
import com.remax.visualnovel.entity.request.ChatSetting
|
import com.remax.visualnovel.entity.request.ChatSetting
|
||||||
import com.remax.visualnovel.entity.request.S3TypeDTO
|
|
||||||
import com.remax.visualnovel.entity.response.ChatModel
|
import com.remax.visualnovel.entity.response.ChatModel
|
||||||
import com.remax.visualnovel.entity.response.ChatSet
|
import com.remax.visualnovel.entity.response.ChatSet
|
||||||
import com.remax.visualnovel.entity.response.VoiceASR
|
import com.remax.visualnovel.entity.response.VoiceASR
|
||||||
|
|
@ -16,6 +15,7 @@ import com.remax.visualnovel.repository.api.DictRepository
|
||||||
import com.remax.visualnovel.repository.api.MessageRepository
|
import com.remax.visualnovel.repository.api.MessageRepository
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.netease.nimlib.sdk.v2.message.V2NIMMessageCreator
|
import com.netease.nimlib.sdk.v2.message.V2NIMMessageCreator
|
||||||
|
import com.remax.visualnovel.entity.request.ParamBgUpload
|
||||||
import com.remax.visualnovel.entity.request.ParamSoundList
|
import com.remax.visualnovel.entity.request.ParamSoundList
|
||||||
import com.remax.visualnovel.entity.response.BucketBean
|
import com.remax.visualnovel.entity.response.BucketBean
|
||||||
import com.remax.visualnovel.entity.response.Character
|
import com.remax.visualnovel.entity.response.Character
|
||||||
|
|
@ -86,6 +86,9 @@ class ChatViewModel @Inject constructor(
|
||||||
|
|
||||||
//------------------------ new ------------------------
|
//------------------------ new ------------------------
|
||||||
suspend fun loadSoundList(param: ParamSoundList) = chatRepository.getSoundList(param)
|
suspend fun loadSoundList(param: ParamSoundList) = chatRepository.getSoundList(param)
|
||||||
|
suspend fun loadAiModelList(language: Int = 1) = chatRepository.getAiModelList(language)
|
||||||
|
suspend fun loadChatBgList(userId: Int) = chatRepository.getChatBgList(userId)
|
||||||
|
suspend fun uploadCustomBgPic(param: ParamBgUpload) = chatRepository.uploadCustomBgPic(param)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import android.widget.LinearLayout
|
||||||
import androidx.core.graphics.toColorInt
|
import androidx.core.graphics.toColorInt
|
||||||
import com.remax.visualnovel.R
|
import com.remax.visualnovel.R
|
||||||
import com.remax.visualnovel.databinding.LayoutChatMenuViewBinding
|
import com.remax.visualnovel.databinding.LayoutChatMenuViewBinding
|
||||||
|
import com.remax.visualnovel.entity.response.ChatAiModule
|
||||||
import com.remax.visualnovel.entity.response.ChatBackgroundBase
|
import com.remax.visualnovel.entity.response.ChatBackgroundBase
|
||||||
import com.remax.visualnovel.entity.response.ChatBubble
|
import com.remax.visualnovel.entity.response.ChatBubble
|
||||||
import com.remax.visualnovel.entity.response.ChatHistory
|
import com.remax.visualnovel.entity.response.ChatHistory
|
||||||
|
|
@ -20,7 +21,6 @@ import com.remax.visualnovel.ui.chat.setting.customui.expandableSelector.ExpandA
|
||||||
import com.remax.visualnovel.ui.chat.setting.customui.expandableSelector.ExpandBubbleSelectView
|
import com.remax.visualnovel.ui.chat.setting.customui.expandableSelector.ExpandBubbleSelectView
|
||||||
import com.remax.visualnovel.ui.chat.setting.customui.expandableSelector.ExpandChatModeSelectView
|
import com.remax.visualnovel.ui.chat.setting.customui.expandableSelector.ExpandChatModeSelectView
|
||||||
import com.remax.visualnovel.ui.chat.setting.customui.expandableSelector.ExpandSoundSelectView
|
import com.remax.visualnovel.ui.chat.setting.customui.expandableSelector.ExpandSoundSelectView
|
||||||
import com.remax.visualnovel.ui.chat.setting.customui.expandableSelector.SelectorItem
|
|
||||||
import com.remax.visualnovel.widget.imageviewer.utils.activity
|
import com.remax.visualnovel.widget.imageviewer.utils.activity
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ class ChatSettingView @JvmOverloads constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun initAiModelSelectorView() {
|
fun initAiModelSelectorView() {
|
||||||
val items = listOf(
|
/*val items = listOf(
|
||||||
SelectorItem(
|
SelectorItem(
|
||||||
name = "Max-0618",
|
name = "Max-0618",
|
||||||
description = "Previous-generation large model",
|
description = "Previous-generation large model",
|
||||||
|
|
@ -117,17 +117,17 @@ class ChatSettingView @JvmOverloads constructor(
|
||||||
color = Color.parseColor("#FBBC05"),
|
color = Color.parseColor("#FBBC05"),
|
||||||
isSelected = true // 默认选中
|
isSelected = true // 默认选中
|
||||||
)
|
)
|
||||||
)
|
)*/
|
||||||
|
|
||||||
with(mBinding.aiModelSelector) {
|
with(mBinding.aiModelSelector) {
|
||||||
setTitleIcon(R.mipmap.setting_ai_model)
|
setTitleIcon(R.mipmap.setting_ai_model)
|
||||||
setItems(items)
|
// setItems(items)
|
||||||
selectItem(0)
|
selectItem(0)
|
||||||
setOnEventListener(
|
setOnEventListener(
|
||||||
object : ExpandAiModelSelectView.IEventListener {
|
object : ExpandAiModelSelectView.IEventListener {
|
||||||
override fun onItemSelected(
|
override fun onItemSelected(
|
||||||
position: Int,
|
position: Int,
|
||||||
item: SelectorItem
|
item: ChatAiModule
|
||||||
) {
|
) {
|
||||||
// TODO -
|
// TODO -
|
||||||
}
|
}
|
||||||
|
|
@ -360,5 +360,13 @@ class ChatSettingView @JvmOverloads constructor(
|
||||||
mBinding.soundActorSelector.setItems(newItems)
|
mBinding.soundActorSelector.setItems(newItems)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setAiModulesItems(newItems: List<ChatAiModule>) {
|
||||||
|
mBinding.aiModelSelector.setItems(newItems)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setBackgroundItems(newItems: List<ChatBackgroundBase.ChatBackground>) {
|
||||||
|
mBinding.backgroundSelectorView.setItems(newItems)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import android.animation.Animator
|
||||||
import android.animation.ObjectAnimator
|
import android.animation.ObjectAnimator
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.GradientDrawable
|
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
|
@ -13,7 +12,10 @@ import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import com.remax.visualnovel.R
|
import com.remax.visualnovel.R
|
||||||
import com.remax.visualnovel.databinding.LayoutExpandSelectViewBinding
|
import com.remax.visualnovel.databinding.LayoutExpandSelectViewBinding
|
||||||
|
import com.remax.visualnovel.entity.response.ChatAiModule
|
||||||
|
import com.remax.visualnovel.extension.glide.load
|
||||||
import com.remax.visualnovel.utils.spannablex.utils.dp
|
import com.remax.visualnovel.utils.spannablex.utils.dp
|
||||||
|
import com.remax.visualnovel.widget.roundedimageview.RoundedImageView
|
||||||
|
|
||||||
|
|
||||||
class ExpandAiModelSelectView @JvmOverloads constructor(
|
class ExpandAiModelSelectView @JvmOverloads constructor(
|
||||||
|
|
@ -26,10 +28,10 @@ class ExpandAiModelSelectView @JvmOverloads constructor(
|
||||||
|
|
||||||
private var isExpanded = false
|
private var isExpanded = false
|
||||||
private var animationDuration = 300
|
private var animationDuration = 300
|
||||||
private var items: List<SelectorItem> = emptyList()
|
private var items: List<ChatAiModule> = emptyList()
|
||||||
private var mEventListener: IEventListener? = null
|
private var mEventListener: IEventListener? = null
|
||||||
interface IEventListener {
|
interface IEventListener {
|
||||||
fun onItemSelected(position: Int, item: SelectorItem)
|
fun onItemSelected(position: Int, item: ChatAiModule)
|
||||||
fun onExpanded(isExpanded: Boolean)
|
fun onExpanded(isExpanded: Boolean)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,7 +73,7 @@ class ExpandAiModelSelectView @JvmOverloads constructor(
|
||||||
mBinding.titleText.text = context.resources.getString(titleRes)
|
mBinding.titleText.text = context.resources.getString(titleRes)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setItems(newItems: List<SelectorItem>) {
|
fun setItems(newItems: List<ChatAiModule>) {
|
||||||
items = newItems
|
items = newItems
|
||||||
updateItemsView()
|
updateItemsView()
|
||||||
}
|
}
|
||||||
|
|
@ -91,21 +93,20 @@ class ExpandAiModelSelectView @JvmOverloads constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createItemView(item: SelectorItem, position: Int): View {
|
private fun createItemView(item: ChatAiModule, position: Int): View {
|
||||||
val itemView = LayoutInflater.from(context)
|
val itemView = LayoutInflater.from(context)
|
||||||
.inflate(R.layout.layout_item_ai_model, mBinding.itemsContainer, false)
|
.inflate(R.layout.layout_item_ai_model, mBinding.itemsContainer, false)
|
||||||
|
|
||||||
val colorIndicator = itemView.findViewById<View>(R.id.colorIndicator)
|
val colorIndicator = itemView.findViewById<RoundedImageView>(R.id.iv_ai_indi)
|
||||||
val itemName = itemView.findViewById<TextView>(R.id.itemName)
|
val itemName = itemView.findViewById<TextView>(R.id.itemName)
|
||||||
val itemDesc = itemView.findViewById<TextView>(R.id.itemDesc)
|
val itemDesc = itemView.findViewById<TextView>(R.id.itemDesc)
|
||||||
val recommendedTag = itemView.findViewById<TextView>(R.id.recommendedTag)
|
val recommendedTag = itemView.findViewById<TextView>(R.id.recommendedTag)
|
||||||
val selectedDot = itemView.findViewById<View>(R.id.selectedDot)
|
val selectedDot = itemView.findViewById<View>(R.id.selectedDot)
|
||||||
|
|
||||||
(colorIndicator.background as? GradientDrawable)?.setColor(item.color)
|
colorIndicator.load(item.icon)
|
||||||
|
itemName.text = item.nameLanguage
|
||||||
itemName.text = item.name
|
itemDesc.text = item.desLanguage
|
||||||
itemDesc.text = item.description
|
recommendedTag.text = "" + item.price + item.rules
|
||||||
recommendedTag.text = item.pointsInfo
|
|
||||||
selectedDot.visibility = if (item.isSelected) View.VISIBLE else View.GONE
|
selectedDot.visibility = if (item.isSelected) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
itemView.setOnClickListener {
|
itemView.setOnClickListener {
|
||||||
|
|
@ -135,7 +136,7 @@ class ExpandAiModelSelectView @JvmOverloads constructor(
|
||||||
updateItemsView()
|
updateItemsView()
|
||||||
|
|
||||||
if (position in items.indices) {
|
if (position in items.indices) {
|
||||||
mBinding.titleText.text = items[position].name
|
mBinding.titleText.text = items[position].nameLanguage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
package com.remax.visualnovel.ui.chat.setting.customui.expandableSelector
|
|
||||||
|
|
||||||
data class SelectorItem(
|
|
||||||
val name: String,
|
|
||||||
val description: String = "",
|
|
||||||
val pointsInfo: String = "",
|
|
||||||
val color: Int,
|
|
||||||
val isRecommended: Boolean = false,
|
|
||||||
var isSelected: Boolean = false
|
|
||||||
)
|
|
||||||
|
|
@ -5,12 +5,12 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="@dimen/dp_12" >
|
android:padding="@dimen/dp_12" >
|
||||||
|
|
||||||
<View
|
<com.remax.visualnovel.widget.roundedimageview.RoundedImageView
|
||||||
android:id="@+id/colorIndicator"
|
android:id="@+id/iv_ai_indi"
|
||||||
android:layout_width="@dimen/dp_25"
|
android:layout_width="@dimen/dp_25"
|
||||||
android:layout_height="@dimen/dp_25"
|
android:layout_height="@dimen/dp_25"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:background="@drawable/circle_shape"/>
|
android:src="@drawable/circle_shape"/>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/selectedDot"
|
android:id="@+id/selectedDot"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue