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