ishaq101 commited on
Commit
5231660
Β·
1 Parent(s): 7fb5553

remove console log

Browse files
src/app/components/Main.tsx CHANGED
@@ -107,10 +107,10 @@ export default function Main() {
107
  const lastAsst = asstMsgs[asstMsgs.length - 1];
108
  if (lastAsst) {
109
  const hasCR = lastAsst.content.includes("\r");
110
- console.log("[loadRoomMessages] last assistant contentLen=", lastAsst.content.length, "hasCR=", hasCR);
111
- console.log("[loadRoomMessages] CONTENT JSON β†’", JSON.stringify(lastAsst.content.slice(0, 600)));
112
  }
113
- console.log("[loadRoomMessages] room", roomId, "β†’", messages.length, "messages from server");
114
  setChats((prev) =>
115
  prev.map((chat) =>
116
  chat.id === roomId ? { ...chat, messages, messagesLoaded: true } : chat
@@ -179,16 +179,16 @@ export default function Main() {
179
  };
180
 
181
  const handleSend = useCallback(async (text: string, skipReload = false) => {
182
- console.log("[handleSend] called, user:", user?.user_id ?? "null", "text:", text.slice(0, 40));
183
  if (!user) {
184
  console.warn("[handleSend] early return: no user");
185
  return;
186
  }
187
 
188
  let roomId = await ensureRoom(text.slice(0, 50));
189
- console.log("[handleSend] roomId:", roomId);
190
  if (!roomId) {
191
- console.warn("[handleSend] early return: no roomId");
192
  return;
193
  }
194
 
@@ -383,7 +383,7 @@ export default function Main() {
383
  audioText = "";
384
  }
385
  } finally {
386
- console.log("[handleSend] finally: clearing streamingMsgId β†’", assistantMsgId, "| skipReload:", skipReload);
387
  setIsStreaming(false);
388
  setStreamingMsgId(null);
389
  abortControllerRef.current = null;
@@ -426,12 +426,12 @@ export default function Main() {
426
 
427
  const { voiceState, start, stop, stopRecording, setStateExternal, isActive: isVoiceActive } = useVoiceSession({
428
  onTranscript: async (text: string) => {
429
- console.log("[onTranscript] received:", text);
430
  // Pass skipReload=true so handleSend returns immediately after streaming
431
  // without waiting for GET /room β€” TTS starts with zero extra delay.
432
  const result = await handleSend(text, true);
433
  const { audioText = "", assistantMsgId } = result ?? {};
434
- console.log("[onTranscript] handleSend done, audioText:", audioText ? audioText.slice(0, 40) : "(empty)");
435
  if (audioText && isVoiceActiveRef.current) {
436
  const { chunks, sampleRate } = await playTtsAudio(audioText, () => {
437
  if (isVoiceActiveRef.current) setVoiceStateRef.current?.("SPEAKING");
 
107
  const lastAsst = asstMsgs[asstMsgs.length - 1];
108
  if (lastAsst) {
109
  const hasCR = lastAsst.content.includes("\r");
110
+ // console.log("[loadRoomMessages] last assistant contentLen=", lastAsst.content.length, "hasCR=", hasCR);
111
+ // console.log("[loadRoomMessages] CONTENT JSON β†’", JSON.stringify(lastAsst.content.slice(0, 600)));
112
  }
113
+ // console.log("[loadRoomMessages] room", roomId, "β†’", messages.length, "messages from server");
114
  setChats((prev) =>
115
  prev.map((chat) =>
116
  chat.id === roomId ? { ...chat, messages, messagesLoaded: true } : chat
 
179
  };
180
 
181
  const handleSend = useCallback(async (text: string, skipReload = false) => {
182
+ // console.log("[handleSend] called, user:", user?.user_id ?? "null", "text:", text.slice(0, 40));
183
  if (!user) {
184
  console.warn("[handleSend] early return: no user");
185
  return;
186
  }
187
 
188
  let roomId = await ensureRoom(text.slice(0, 50));
189
+ // console.log("[handleSend] roomId:", roomId);
190
  if (!roomId) {
191
+ // console.warn("[handleSend] early return: no roomId");
192
  return;
193
  }
194
 
 
383
  audioText = "";
384
  }
385
  } finally {
386
+ // console.log("[handleSend] finally: clearing streamingMsgId β†’", assistantMsgId, "| skipReload:", skipReload);
387
  setIsStreaming(false);
388
  setStreamingMsgId(null);
389
  abortControllerRef.current = null;
 
426
 
427
  const { voiceState, start, stop, stopRecording, setStateExternal, isActive: isVoiceActive } = useVoiceSession({
428
  onTranscript: async (text: string) => {
429
+ // console.log("[onTranscript] received:", text);
430
  // Pass skipReload=true so handleSend returns immediately after streaming
431
  // without waiting for GET /room β€” TTS starts with zero extra delay.
432
  const result = await handleSend(text, true);
433
  const { audioText = "", assistantMsgId } = result ?? {};
434
+ // console.log("[onTranscript] handleSend done, audioText:", audioText ? audioText.slice(0, 40) : "(empty)");
435
  if (audioText && isVoiceActiveRef.current) {
436
  const { chunks, sampleRate } = await playTtsAudio(audioText, () => {
437
  if (isVoiceActiveRef.current) setVoiceStateRef.current?.("SPEAKING");
src/app/components/chat/MessageBubble.tsx CHANGED
@@ -14,9 +14,9 @@ interface MessageBubbleProps {
14
  export default function MessageBubble({ message, isStreamingPlaceholder }: MessageBubbleProps) {
15
  useEffect(() => {
16
  if (message.role === "assistant") {
17
- console.log(
18
- `[MessageBubble] id=...${message.id.slice(-6)} isStreamingPlaceholder=${isStreamingPlaceholder} contentLen=${message.content.length}`
19
- );
20
  }
21
  }, [isStreamingPlaceholder, message.id, message.role, message.content.length]);
22
 
 
14
  export default function MessageBubble({ message, isStreamingPlaceholder }: MessageBubbleProps) {
15
  useEffect(() => {
16
  if (message.role === "assistant") {
17
+ // console.log(
18
+ // `[MessageBubble] id=...${message.id.slice(-6)} isStreamingPlaceholder=${isStreamingPlaceholder} contentLen=${message.content.length}`
19
+ // );
20
  }
21
  }, [isStreamingPlaceholder, message.id, message.role, message.content.length]);
22
 
src/app/components/chat/renderers/MarkdownRenderer.tsx CHANGED
@@ -116,10 +116,10 @@ export default function MarkdownRenderer({ content, skipPreprocess }: MarkdownRe
116
  if (!skipPreprocess) {
117
  const hasCR = content.includes("\r");
118
  const hasDoubleNewline = content.includes("\n\n");
119
- console.log(
120
- `[MarkdownRenderer] skipPreprocess=false contentLen=${content.length} same=${content === processed} hasCR=${hasCR} hasDoubleNewline=${hasDoubleNewline}`
121
- );
122
- console.log("[MarkdownRenderer] CONTENT JSON β†’", JSON.stringify(content.slice(0, 600)));
123
  }
124
 
125
  return (
 
116
  if (!skipPreprocess) {
117
  const hasCR = content.includes("\r");
118
  const hasDoubleNewline = content.includes("\n\n");
119
+ // console.log(
120
+ // `[MarkdownRenderer] skipPreprocess=false contentLen=${content.length} same=${content === processed} hasCR=${hasCR} hasDoubleNewline=${hasDoubleNewline}`
121
+ // );
122
+ // console.log("[MarkdownRenderer] CONTENT JSON β†’", JSON.stringify(content.slice(0, 600)));
123
  }
124
 
125
  return (