移除聊天组件中的调试日志

This commit is contained in:
pingchuan
2025-06-06 15:31:36 +08:00
parent 1b79f973da
commit ab960f6dd0
6 changed files with 150 additions and 150 deletions
+2 -2
View File
@@ -389,7 +389,7 @@ export default function Chat() {
(async () => {
try {
console.log('🚀 开始初始化聊天应用...');
// console.log('🚀 开始初始化聊天应用...');
// 并行获取会话列表和应用参数
const [conversationData, appParams] = await Promise.all([
@@ -441,7 +441,7 @@ export default function Chat() {
}
setInited(true);
console.log('✅ 聊天应用初始化完成');
// console.log('✅ 聊天应用初始化完成');
} catch (e: any) {
console.error('❌ 初始化失败:', e);
if (e.status === 404) {
+6 -6
View File
@@ -17,12 +17,12 @@ interface MarkdownProps {
* 使用 react-markdown 库进行标准 Markdown 解析,支持流式渲染
*/
export default function Markdown({ content, className = '' }: MarkdownProps) {
console.log('🎨 [Markdown] 渲染组件:', {
contentLength: content?.length || 0,
contentPreview: content?.substring(0, 100) + (content && content.length > 100 ? '...' : ''),
className,
hasContent: !!content
});
// console.log('🎨 [Markdown] 渲染组件:', {
// contentLength: content?.length || 0,
// contentPreview: content?.substring(0, 100) + (content && content.length > 100 ? '...' : ''),
// className,
// hasContent: !!content
// });
if (!content) {
console.log('⚠️ [Markdown] 内容为空,返回null');
+13 -13
View File
@@ -82,22 +82,22 @@ const ChatSidebar = forwardRef<ChatSidebarRef, ChatSidebarProps>(({
setDeleteLoading(true);
try {
console.log('🗑️ 开始删除会话:', deletingConversation.id);
// console.log('🗑️ 开始删除会话:', deletingConversation.id);
// 调用API删除服务器端的会话
const response = await deleteConversation(deletingConversation.id);
console.log('✅ 服务器端会话删除响应:', response);
// console.log('✅ 服务器端会话删除响应:', response);
// 检查响应是否成功
if (response && (response as any).result === 'success') {
console.log('✅ 服务器端会话删除成功');
// console.log('✅ 服务器端会话删除成功');
message.success('会话删除成功');
setDeleteModalVisible(false);
// 通知父组件会话已删除
onConversationDeleted?.(deletingConversation.id);
console.log('✅ 会话删除完成:', deletingConversation.id);
// console.log('✅ 会话删除完成:', deletingConversation.id);
} else {
throw new Error((response as any)?.error || '删除会话失败');
}
@@ -130,22 +130,22 @@ const ChatSidebar = forwardRef<ChatSidebarRef, ChatSidebarProps>(({
setRenameLoading(true);
try {
console.log('✏️ 开始重命名会话:', { conversationId: renamingConversation.id, newName: newName.trim() });
// console.log('✏️ 开始重命名会话:', { conversationId: renamingConversation.id, newName: newName.trim() });
// 调用API重命名服务器端的会话
const response = await renameConversation(renamingConversation.id, newName.trim(), false);
console.log('✅ 服务器端会话重命名响应:', response);
// console.log('✅ 服务器端会话重命名响应:', response);
// 检查响应是否成功
if (response && (response as any).name) {
console.log('✅ 服务器端会话重命名成功');
// console.log('✅ 服务器端会话重命名成功');
message.success('重命名成功');
setRenameModalVisible(false);
// 通知父组件会话已重命名
onConversationRenamed?.(renamingConversation.id, (response as any).name);
console.log('✅ 会话重命名完成:', renamingConversation.id, '->', (response as any).name);
// console.log('✅ 会话重命名完成:', renamingConversation.id, '->', (response as any).name);
} else {
throw new Error((response as any)?.error || '重命名会话失败');
}
@@ -213,27 +213,27 @@ const ChatSidebar = forwardRef<ChatSidebarRef, ChatSidebarProps>(({
useImperativeHandle(ref, () => ({
autoRename: async (conversationId: string) => {
try {
console.log('🏷️ 开始自动重命名会话为"新对话":', conversationId);
// console.log('🏷️ 开始自动重命名会话为"新对话":', conversationId);
// 调用API将会话重命名为固定的"新对话"
const response = await renameConversation(conversationId, '新对话', false);
console.log('✅ 服务器端会话重命名响应:', response);
// console.log('✅ 服务器端会话重命名响应:', response);
// 检查响应是否成功
if (response && (response as any).name) {
console.log('✅ 服务器端会话重命名成功');
// console.log('✅ 服务器端会话重命名成功');
// 通知父组件会话已重命名
onConversationRenamed?.(conversationId, (response as any).name);
console.log('✅ 会话重命名完成:', conversationId, '->', (response as any).name);
// console.log('✅ 会话重命名完成:', conversationId, '->', (response as any).name);
} else {
throw new Error((response as any)?.error || '重命名会话失败');
}
} catch (error) {
console.error('❌ 重命名会话失败:', error);
// 重命名失败时不显示错误消息,避免打扰用户
console.warn('⚠️ 重命名失败,会话将保持默认名称');
// console.warn('⚠️ 重命名失败,会话将保持默认名称');
}
},
}));