Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ const OttButtonGroup = ({
// selectedData가 변경될 때마다 state 업데이트
useEffect(() => {
if (selectedData?.isSelected && selectedData.selectedServices) {
console.log(
'🔄 Updating selectedServices from props:',
selectedData.selectedServices,
);
setSelectedServices(selectedData.selectedServices);
} else {
setSelectedServices([]);
Expand All @@ -62,7 +58,6 @@ const OttButtonGroup = ({
return (
<>
<DraggableScroll className="flex flex-nowrap gap-2">

{OTT_SERVICES.map((service) => (
<ChatButton
key={service.id}
Expand Down
44 changes: 0 additions & 44 deletions client/src/hooks/useChatSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export const useChatSocket = () => {

try {
const session = getSession(sessionIdToLoad);
console.log('🔍 실제 로컬스토리지 세션 데이터:', session);
if (!session) return { messages: [] };

const messages: Message[] = session.messages.map(
Expand Down Expand Up @@ -161,17 +160,6 @@ export const useChatSocket = () => {
setStoredUserProfile(userProfile);
}
if (!hasLoggedSession.current) {
console.log(
'📂 로컬스토리지에서 기존 채팅 히스토리를 불러왔습니다:',
localMessages.length,
'개',
);
if (userProfile) {
console.log(
'👤 사용자 프로필도 복원되었습니다:',
userProfile.plan.name,
);
}
hasLoggedSession.current = true;
}
} else {
Expand All @@ -180,7 +168,6 @@ export const useChatSocket = () => {
setStoredUserProfile(userProfile);
}
if (!hasLoggedSession.current) {
console.log('📭 새로운 세션을 시작합니다');
hasLoggedSession.current = true;
}
}
Expand All @@ -207,11 +194,6 @@ export const useChatSocket = () => {
}

const converted: Message[] = logs.map((msg) => {
// 로그 추가 (각 메시지별로)
if (msg.type) {
console.log('🔍 Processing message with type:', msg.type, msg.data);
}

// 캐러셀 선택 등 특별한 타입 처리
if (
msg.type === 'carousel_select' ||
Expand Down Expand Up @@ -468,7 +450,6 @@ export const useChatSocket = () => {
};

const handleDone = () => {
console.log('✅ Stream completed');
setIsStreaming(false);
followUpResponseRef.current = ''; // 역질문 완료 시 리셋
};
Expand Down Expand Up @@ -561,7 +542,6 @@ export const useChatSocket = () => {
message: text.trim(),
history: chatHistory, // 🔧 전체 대화 히스토리 추가
};
console.log(payload);
setMessages((prev) => [...prev, newUserMessage] as Message[]);
setIsStreaming(true);
responseRef.current = '';
Expand All @@ -574,11 +554,6 @@ export const useChatSocket = () => {
// 로컬 상태에서만 선택 상태 업데이트 (서버에 보내지 않음)
const updateCarouselSelection = useCallback(
(messageIndex: number, selectedItem: CarouselItem) => {
console.log('🔄 로컬에서 캐러셀 선택 상태 업데이트:', {
messageIndex,
selectedItem,
});

// 로컬 상태만 업데이트
setMessages((prev) =>
prev.map((msg, idx) => {
Expand All @@ -598,11 +573,6 @@ export const useChatSocket = () => {
// 로컬 상태에서만 OTT 선택 상태 업데이트 (서버에 보내지 않음)
const updateOttSelection = useCallback(
(messageIndex: number, selectedServices: string[]) => {
console.log('🎬 로컬에서 OTT 선택 상태 업데이트:', {
messageIndex,
selectedServices,
});

// 로컬 상태만 업데이트
setMessages((prev) =>
prev.map((msg, idx) => {
Expand All @@ -625,11 +595,6 @@ export const useChatSocket = () => {
// 로컬 상태에서만 OX 선택 상태 업데이트 (서버에 보내지 않음)
const updateOxSelection = useCallback(
(messageIndex: number, selectedOption: string) => {
console.log('🔘 로컬에서 OX 선택 상태 업데이트:', {
messageIndex,
selectedOption,
});

// 로컬 상태만 업데이트
setMessages((prev) =>
prev.map((msg, idx) => {
Expand All @@ -646,14 +611,6 @@ export const useChatSocket = () => {
[],
);

// storedUserProfile 상태 변화 디버깅
useEffect(() => {
console.log(
'📊 storedUserProfile 상태 변화:',
storedUserProfile?.plan?.name || 'null',
);
}, [storedUserProfile]);

// 메시지가 변경될 때마다 로컬스토리지에 저장
useEffect(() => {
if (useLocalStorage && messages.length > 0) {
Expand All @@ -675,7 +632,6 @@ export const useChatSocket = () => {

// userProfile 설정 함수 (ChatbotPage에서 사용)
const setUserProfile = useCallback((userProfile: UserProfile | null) => {
console.log('💾 setUserProfile 호출됨:', userProfile?.plan?.name || 'null');
setStoredUserProfile(userProfile);
}, []);

Expand Down
12 changes: 2 additions & 10 deletions client/src/pages/ChatbotPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,6 @@
);
});

console.log('🔍 전체 messages 배열 길이:', messages.length);
console.log('🔍 전체 allMessages 배열 길이:', allMessages.length);

if (actualIndex !== -1) {
updateCarouselSelection(actualIndex, selectedItem);
} else {
Expand All @@ -244,14 +241,12 @@
);
}
},
[updateCarouselSelection, messages, allMessages],

Check warning on line 244 in client/src/pages/ChatbotPage.tsx

View workflow job for this annotation

GitHub Actions / Lint and Build Checks ✅

React Hook useCallback has an unnecessary dependency: 'allMessages'. Either exclude it or remove the dependency array
);

// 새로 추가: OTT 선택 처리
const handleOttSelect = useCallback(
(selectedServices: string[], displayIndex?: number) => {
console.log('🎬 OTT 선택:', { selectedServices, displayIndex });

(selectedServices: string[]) => {
// 실제 function_call 메시지의 인덱스를 찾기 (messages 배열에서만)
const actualIndex = messages.findIndex((msg) => {
return (
Expand All @@ -271,9 +266,7 @@

// 새로 추가: OX 선택 처리
const handleOxSelect = useCallback(
(selectedOption: string, displayIndex?: number) => {
console.log('🔘 OX 선택:', { selectedOption, displayIndex });

(selectedOption: string) => {
// 실제 function_call 메시지의 인덱스를 찾기 (messages 배열에서만)
const actualIndex = messages.findIndex((msg) => {
return (
Expand Down Expand Up @@ -352,7 +345,6 @@

// 컨테이너의 첫 번째 자식 (실제 메시지들이 들어있는 div) 관찰
const messageContainer = container.querySelector('div');
console.log(messageContainer);
if (messageContainer) {
observer.observe(messageContainer);
}
Expand Down
2 changes: 0 additions & 2 deletions client/src/utils/chatStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export const deleteSession = (sessionId: string): void => {
const sessions = getAllSessions();
const filtered = sessions.filter((s) => s.sessionId !== sessionId);
localStorage.setItem(STORAGE_KEY, JSON.stringify(filtered));
console.log('✅ 세션 삭제 완료:', sessionId);
} catch (error) {
console.error('❌ 세션 삭제 실패:', error);
}
Expand All @@ -108,7 +107,6 @@ export const deleteSession = (sessionId: string): void => {
export const clearAllSessions = (): void => {
try {
localStorage.removeItem(STORAGE_KEY);
console.log('✅ 모든 세션 삭제 완료');
} catch (error) {
console.error('❌ 세션 삭제 실패:', error);
}
Expand Down
2 changes: 1 addition & 1 deletion server/utils/promptBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Function Calling
- 고용량 데이터 요금제를 추천해주세요라는 질문이 오면,
"**고용량 데이터 요금제를 찾으시는군요!** 고용량 요금제는 데이터 걱정없이 마음 껏 쓸 수 있는 요금제에요😀 \n \n요금제를 추천해 드리기 위해, 고객님의 한달 데이터 사용량은 얼마인가요?" → requestCarouselButtons(["50GB 이하", "120GB 이하", "200GB 이하", "무제한 필요", "모르겠음"])
- "어떤 통신 기술을 선호하시나요?" → requestCarouselButtons(["5G", "LTE", "상관없음"])
- "월 예산은 어느 정도로 생각하고 계신가요?" → requestCarouselButtons(["3-5만원", "5-7만원", "7-10만원", "10-15만원", "15만원 이상", "예산 무관"])
- "월 예산은 어느 정도로 생각하고 계신가요?" → requestCarouselButtons(["3-5만원", "5-7만원", "7-10만원", "10-15만원", "예산 무관"])
- 일반적으로 유저가 요금제를 추천해달라고하면,
"한달에 데이터를 얼마나 사용하시나요?" → requestCarouselButtons(["5GB 이하", "15GB 이하", "50GB 이하", "무제한 필요", "모르겠음"]) 실행

Expand Down
Loading