From 13c85bb2a833b6e820e9767c2222d24698a2c410 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Thu, 7 Aug 2025 17:01:13 +0900 Subject: [PATCH] =?UTF-8?q?"feat(api):=20=EC=BA=90=EB=A6=AD=ED=84=B0=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20API=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EB=B0=8F=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - API 경로를 /admin/chat/character/list로 변경 - size 파라미터 기본값을 20으로 설정 - 응답 데이터 구조 변경 (items → content) - total_page 계산 로직 수정 (전체 개수와 size로 계산) - 태그 표시 기능 추가" --- src/api/character.js | 10 +++--- src/views/Chat/CharacterList.vue | 61 +++++++++++++++++--------------- 2 files changed, 37 insertions(+), 34 deletions(-) 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);