fix:删除所有日志

This commit is contained in:
Lishiling
2026-02-21 20:44:32 +08:00
parent 462071c0b1
commit 32854397fb
3 changed files with 5 additions and 153 deletions
-10
View File
@@ -228,9 +228,6 @@ const props = withDefaults(defineProps<Props>(), {
chatboxMode: false
});
// TODO: Remove debug log
console.warn('[Chat] component loaded', { chatboxMode: props.chatboxMode });
const router = useRouter();
const route = useRoute();
const { t } = useI18n();
@@ -586,11 +583,6 @@ async function handleSendMessage() {
const currentProjectId = selectedProjectId.value; // 保存当前项目ID
if (isCreatingNewSession) {
// TODO: Remove debug log
console.warn('[Chat] No active session; calling newSession() before send', {
selectedProjectId: currentProjectId,
currSessionId: currSessionId.value
});
await newSession();
// 如果在项目视图中创建新会话,立即退出项目视图
@@ -683,8 +675,6 @@ watch(sessions, (newSessions) => {
});
onMounted(() => {
// TODO: Remove debug log
console.warn('[Chat] mounted');
checkMobile();
window.addEventListener('resize', checkMobile);
getSessions();
@@ -83,8 +83,6 @@ const props = withDefaults(defineProps<Props>(), {
const { t } = useI18n();
const { error: showError } = useToast();
// TODO: Remove debug log
console.warn('[StandaloneChat] component loaded', { configId: props.configId });
// UI 状态
const imagePreviewDialog = ref(false);
@@ -97,107 +95,32 @@ const getCurrentSession = computed(() => null); // 独立测试模式不需要
async function bindConfigToSession(sessionId: string) {
const confId = (props.configId || '').trim();
if (!confId || confId === 'default') {
// TODO: Remove debug log
console.warn('[StandaloneChat] Skip binding config to session', {
sessionId,
confId,
reason: !confId ? 'empty_configId' : 'default_configId'
});
return;
}
const umoDetails = buildWebchatUmoDetails(sessionId, false);
// TODO: Remove debug log
console.warn('[StandaloneChat] Binding config to session', {
sessionId,
confId,
localStorageUser: localStorage.getItem('user'),
umo: umoDetails.umo,
username: umoDetails.username,
sessionKey: umoDetails.sessionKey
});
const payload = {
await axios.post('/api/config/umo_abconf_route/update', {
umo: umoDetails.umo,
conf_id: confId
};
// TODO: Remove debug log
console.warn('[StandaloneChat] POST /api/config/umo_abconf_route/update', payload);
const updateRes = await axios.post('/api/config/umo_abconf_route/update', payload);
// TODO: Remove debug log
console.warn('[StandaloneChat] Route update response', {
umo: payload.umo,
status: updateRes.status,
data: updateRes.data
});
try {
const routesRes = await axios.get('/api/config/umo_abconf_routes');
const routing = routesRes.data?.data?.routing || {};
const boundConfId = routing[umoDetails.umo];
const related = Object.entries(routing)
.filter(([umo]) => typeof umo === 'string' && umo.includes(sessionId))
.map(([umo, id]) => ({ umo, confId: id }));
// TODO: Remove debug log
console.warn('[StandaloneChat] Routing table after update', {
totalEntries: Object.keys(routing).length,
selectedUmo: umoDetails.umo,
boundConfId,
relatedEntries: related
});
} catch (err) {
const axiosErr = err as any;
// TODO: Remove debug log
console.warn('[StandaloneChat] Failed to fetch routing table after update', {
message: axiosErr?.message,
status: axiosErr?.response?.status,
data: axiosErr?.response?.data
});
}
}
async function newSession() {
try {
// TODO: Remove debug log
console.warn('[StandaloneChat] Creating new session', { configId: props.configId });
const response = await axios.get('/api/chat/new_session');
const sessionId = response.data.data.session_id;
// TODO: Remove debug log
console.warn('[StandaloneChat] New session created', {
sessionId,
platformId: response.data.data.platform_id
});
// Bind the config before activating the session in the UI.
try {
await bindConfigToSession(sessionId);
} catch (err) {
const axiosErr = err as any;
// TODO: Remove debug log
console.error('[StandaloneChat] Failed to bind config to session', {
sessionId,
configId: props.configId,
message: axiosErr?.message,
status: axiosErr?.response?.status,
data: axiosErr?.response?.data
});
console.error('Failed to bind config to session', err);
}
currSessionId.value = sessionId;
// TODO: Remove debug log
console.warn('[StandaloneChat] Session activated in UI', { sessionId });
return sessionId;
} catch (err) {
// TODO: Remove debug log
console.error(err);
throw err;
}
@@ -314,8 +237,6 @@ async function handleSendMessage() {
}
onMounted(async () => {
// TODO: Remove debug log
console.warn('[StandaloneChat] mounted');
// 独立模式在挂载时创建新会话
try {
await newSession();
+3 -62
View File
@@ -20,9 +20,6 @@ export function useSessions(chatboxMode: boolean = false) {
const currSessionId = ref('');
const pendingSessionId = ref<string | null>(null);
// TODO: Remove debug log
console.warn('[useSessions] composable initialized', { chatboxMode });
// 编辑标题相关
const editTitleDialog = ref(false);
const editingTitle = ref('');
@@ -66,79 +63,23 @@ export function useSessions(chatboxMode: boolean = false) {
async function newSession() {
try {
// TODO: Remove debug log
console.warn('[useSessions] newSession() entered', { chatboxMode });
const selectedConfigId = getStoredSelectedChatConfigId();
// TODO: Remove debug log
console.warn('[useSessions] Stored chat selected config', { selectedConfigId });
const response = await axios.get('/api/chat/new_session');
const sessionId = response.data.data.session_id;
const platformId = response.data.data.platform_id;
// TODO: Remove debug log
console.warn('[useSessions] New session created', { sessionId, platformId });
currSessionId.value = sessionId;
if (selectedConfigId && selectedConfigId !== 'default' && platformId === 'webchat') {
const umoDetails = buildWebchatUmoDetails(sessionId, false);
// TODO: Remove debug log
console.warn('[useSessions] Binding config to new session', {
sessionId,
selectedConfigId,
umo: umoDetails.umo,
username: umoDetails.username
});
try {
const updateRes = await axios.post('/api/config/umo_abconf_route/update', {
const umoDetails = buildWebchatUmoDetails(sessionId, false);
await axios.post('/api/config/umo_abconf_route/update', {
umo: umoDetails.umo,
conf_id: selectedConfigId
});
// TODO: Remove debug log
console.warn('[useSessions] Route update response', {
status: updateRes.status,
data: updateRes.data
});
try {
const routesRes = await axios.get('/api/config/umo_abconf_routes');
const routing = routesRes.data?.data?.routing || {};
// TODO: Remove debug log
console.warn('[useSessions] Routing table check', {
umo: umoDetails.umo,
boundConfId: routing[umoDetails.umo],
totalEntries: Object.keys(routing).length
});
} catch (err) {
const axiosErr = err as any;
// TODO: Remove debug log
console.warn('[useSessions] Failed to fetch routing table after update', {
message: axiosErr?.message,
status: axiosErr?.response?.status,
data: axiosErr?.response?.data
});
}
} catch (err) {
const axiosErr = err as any;
// TODO: Remove debug log
console.error('[useSessions] Failed to bind config to session', {
sessionId,
selectedConfigId,
message: axiosErr?.message,
status: axiosErr?.response?.status,
data: axiosErr?.response?.data
});
console.error('Failed to bind config to session', err);
}
} else {
// TODO: Remove debug log
console.warn('[useSessions] Skip binding config to new session', {
sessionId,
selectedConfigId,
platformId
});
}
// 更新 URL