diff --git a/src/api/character.js b/src/api/character.js index 0333ddc..a5adab3 100644 --- a/src/api/character.js +++ b/src/api/character.js @@ -1,15 +1,15 @@ import Vue from 'vue'; // 캐릭터 리스트 -async function getCharacterList(page = 1, size = 10) { - return Vue.axios.get('/api/admin/characters', { - params: { page, size } +async function getCharacterList(page = 1, size = 20) { + return Vue.axios.get('/admin/chat/character/list', { + params: { page: page - 1, size } }) } // 캐릭터 검색 -async function searchCharacters(keyword, page = 1, size = 10) { - return Vue.axios.get('/api/admin/characters/search', { +async function searchCharacters(keyword, page = 1, size = 20) { + return Vue.axios.get('/api/admin/chat/character/search', { params: { keyword, page, size } }) } diff --git a/src/views/Chat/CharacterList.vue b/src/views/Chat/CharacterList.vue index ab1a9c8..918ca6a 100644 --- a/src/views/Chat/CharacterList.vue +++ b/src/views/Chat/CharacterList.vue @@ -70,6 +70,9 @@ 대화 스타일 + + 태그 + 등록일 @@ -97,7 +100,7 @@ {{ item.name }} {{ item.gender || '-' }} - {{ calculateAge(item.birthDate) }} + {{ item.age || '-' }} 보기 + +
+ + {{ tag }} + +
+ - + {{ item.createdAt }} {{ item.updatedAt || '-' }} @@ -211,9 +229,11 @@ {{ detail_title }} - + -
{{ detail_content }}
+
+ {{ detail_content }} +
@@ -265,23 +285,6 @@ export default { this.$dialog.notify.success(message) }, - calculateAge(birthDate) { - if (!birthDate) return '-'; - - // birthDate가 YYYY-MM-DD 형식이라고 가정 - const today = new Date(); - const birth = new Date(birthDate); - - let age = today.getFullYear() - birth.getFullYear(); - const monthDiff = today.getMonth() - birth.getMonth(); - - // 생일이 아직 지나지 않았으면 나이에서 1을 뺌 - if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) { - age--; - } - - return age; - }, showDetailDialog(item, type) { this.selected_character = item; @@ -297,9 +300,9 @@ export default { this.detail_title = '말투'; this.detail_content = item.speechPattern || '내용이 없습니다.'; break; - case 'systemPrompt': + case 'speechStyle': this.detail_title = '대화 스타일'; - this.detail_content = item.systemPrompt || '내용이 없습니다.'; + this.detail_content = item.speechStyle || '내용이 없습니다.'; break; default: this.detail_title = ''; @@ -374,12 +377,12 @@ export default { if (response && response.data) { const data = response.data; - this.characters = data.items || []; + this.characters = data.content || []; - const total_page = Math.ceil((data.totalCount || 0) / 10); + const total_page = Math.ceil((data.totalCount || 0) / 20); this.total_page = total_page <= 0 ? 1 : total_page; } else { - throw new Error('응답 데이터가 없습니다.'); + this.notifyError('응답 데이터가 없습니다.'); } } catch (e) { console.error('캐릭터 목록 조회 오류:', e); @@ -406,12 +409,12 @@ export default { if (response && response.data) { const data = response.data; - this.characters = data.items || []; + this.characters = data.content || []; - const total_page = Math.ceil((data.totalCount || 0) / 10); + const total_page = Math.ceil((data.totalCount || 0) / 20); this.total_page = total_page <= 0 ? 1 : total_page; } else { - throw new Error('응답 데이터가 없습니다.'); + this.notifyError('응답 데이터가 없습니다.'); } } catch (e) { console.error('캐릭터 검색 오류:', e);