캐릭터 챗봇 #338
|
@ -5,9 +5,7 @@ import kr.co.vividnext.sodalive.chat.character.dto.CharacterBackgroundResponse
|
|||
import kr.co.vividnext.sodalive.chat.character.dto.CharacterBannerResponse
|
||||
import kr.co.vividnext.sodalive.chat.character.dto.CharacterDetailResponse
|
||||
import kr.co.vividnext.sodalive.chat.character.dto.CharacterMainResponse
|
||||
import kr.co.vividnext.sodalive.chat.character.dto.CharacterMemoryResponse
|
||||
import kr.co.vividnext.sodalive.chat.character.dto.CharacterPersonalityResponse
|
||||
import kr.co.vividnext.sodalive.chat.character.dto.CharacterRelationshipResponse
|
||||
import kr.co.vividnext.sodalive.chat.character.dto.CurationSection
|
||||
import kr.co.vividnext.sodalive.chat.character.dto.RecentCharacter
|
||||
import kr.co.vividnext.sodalive.chat.character.service.ChatCharacterBannerService
|
||||
|
@ -109,58 +107,37 @@ class ChatCharacterController(
|
|||
val character = service.getCharacterDetail(characterId)
|
||||
?: throw SodaException("캐릭터를 찾을 수 없습니다.")
|
||||
|
||||
// 태그, 가치관, 취미, 목표 추출
|
||||
val tags = character.tagMappings.map { it.tag.tag }
|
||||
val values = character.valueMappings.map { it.value.value }
|
||||
val hobbies = character.hobbyMappings.map { it.hobby.hobby }
|
||||
val goals = character.goalMappings.map { it.goal.goal }
|
||||
// 태그 가공: # prefix 규칙 적용 후 공백으로 연결
|
||||
val tags = character.tagMappings
|
||||
.map { it.tag.tag }
|
||||
.joinToString(" ") { if (it.startsWith("#")) it else "#$it" }
|
||||
|
||||
// 메모리, 성격, 배경, 관계 변환
|
||||
val memories = character.memories.map {
|
||||
CharacterMemoryResponse(
|
||||
title = it.title,
|
||||
content = it.content,
|
||||
emotion = it.emotion
|
||||
)
|
||||
}
|
||||
|
||||
val personalities = character.personalities.map {
|
||||
// 성격, 배경: 각각 첫 번째 항목만 선택
|
||||
val personality: CharacterPersonalityResponse? = character.personalities.firstOrNull()?.let {
|
||||
CharacterPersonalityResponse(
|
||||
trait = it.trait,
|
||||
description = it.description
|
||||
)
|
||||
}
|
||||
|
||||
val backgrounds = character.backgrounds.map {
|
||||
val background: CharacterBackgroundResponse? = character.backgrounds.firstOrNull()?.let {
|
||||
CharacterBackgroundResponse(
|
||||
topic = it.topic,
|
||||
description = it.description
|
||||
)
|
||||
}
|
||||
|
||||
val relationships = character.relationships.map { CharacterRelationshipResponse(it.name, it.relationShip) }
|
||||
|
||||
// 응답 생성
|
||||
ApiResponse.ok(
|
||||
CharacterDetailResponse(
|
||||
characterId = character.id!!,
|
||||
name = character.name,
|
||||
description = character.description,
|
||||
age = character.age,
|
||||
gender = character.gender,
|
||||
mbti = character.mbti,
|
||||
speechPattern = character.speechPattern,
|
||||
speechStyle = character.speechStyle,
|
||||
appearance = character.appearance,
|
||||
imageUrl = "$imageHost/${character.imagePath ?: "profile/default-profile.png"}",
|
||||
memories = memories,
|
||||
personalities = personalities,
|
||||
backgrounds = backgrounds,
|
||||
relationships = relationships,
|
||||
tags = tags,
|
||||
values = values,
|
||||
hobbies = hobbies,
|
||||
goals = goals
|
||||
personalities = personality,
|
||||
backgrounds = background,
|
||||
tags = tags
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -4,27 +4,11 @@ data class CharacterDetailResponse(
|
|||
val characterId: Long,
|
||||
val name: String,
|
||||
val description: String,
|
||||
val age: Int?,
|
||||
val gender: String?,
|
||||
val mbti: String?,
|
||||
val speechPattern: String?,
|
||||
val speechStyle: String?,
|
||||
val appearance: String?,
|
||||
val imageUrl: String,
|
||||
val memories: List<CharacterMemoryResponse> = emptyList(),
|
||||
val personalities: List<CharacterPersonalityResponse> = emptyList(),
|
||||
val backgrounds: List<CharacterBackgroundResponse> = emptyList(),
|
||||
val relationships: List<CharacterRelationshipResponse> = emptyList(),
|
||||
val tags: List<String> = emptyList(),
|
||||
val values: List<String> = emptyList(),
|
||||
val hobbies: List<String> = emptyList(),
|
||||
val goals: List<String> = emptyList()
|
||||
)
|
||||
|
||||
data class CharacterMemoryResponse(
|
||||
val title: String,
|
||||
val content: String,
|
||||
val emotion: String
|
||||
val personalities: CharacterPersonalityResponse?,
|
||||
val backgrounds: CharacterBackgroundResponse?,
|
||||
val tags: String
|
||||
)
|
||||
|
||||
data class CharacterPersonalityResponse(
|
||||
|
@ -36,8 +20,3 @@ data class CharacterBackgroundResponse(
|
|||
val topic: String,
|
||||
val description: String
|
||||
)
|
||||
|
||||
data class CharacterRelationshipResponse(
|
||||
val name: String,
|
||||
val relationShip: String
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue