fix(安全): 修复HTML导出中的XSS漏洞并清理调试日志
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
refactor(日志): 替换console.log为tracing日志系统 style(代码): 移除未使用的代码和依赖项 feat(测试): 添加端到端测试文档和CI工作流 docs(变更日志): 更新CHANGELOG.md记录0.1.0版本变更 perf(构建): 更新依赖版本并优化CI流程
This commit is contained in:
@@ -8,6 +8,9 @@ import { getAgentSwarm } from '../lib/agent-swarm';
|
||||
import { getSkillDiscovery } from '../lib/skill-discovery';
|
||||
import { useOfflineStore, isOffline } from './offlineStore';
|
||||
import { useConnectionStore } from './connectionStore';
|
||||
import { createLogger } from '../lib/logger';
|
||||
|
||||
const log = createLogger('ChatStore');
|
||||
|
||||
export interface MessageFile {
|
||||
name: string;
|
||||
@@ -307,7 +310,7 @@ export const useChatStore = create<ChatState>()(
|
||||
if (isOffline()) {
|
||||
const { queueMessage } = useOfflineStore.getState();
|
||||
const queueId = queueMessage(content, effectiveAgentId, effectiveSessionKey);
|
||||
console.log(`[Chat] Offline - message queued: ${queueId}`);
|
||||
log.debug(`Offline - message queued: ${queueId}`);
|
||||
|
||||
// Show a system message about offline queueing
|
||||
const systemMsg: Message = {
|
||||
@@ -334,7 +337,7 @@ export const useChatStore = create<ChatState>()(
|
||||
const messages = get().messages.map(m => ({ role: m.role, content: m.content }));
|
||||
const check = await intelligenceClient.compactor.checkThreshold(messages);
|
||||
if (check.should_compact) {
|
||||
console.log(`[Chat] Context compaction triggered (${check.urgency}): ${check.current_tokens} tokens`);
|
||||
log.debug(`Context compaction triggered (${check.urgency}): ${check.current_tokens} tokens`);
|
||||
const result = await intelligenceClient.compactor.compact(
|
||||
get().messages.map(m => ({
|
||||
role: m.role,
|
||||
@@ -355,7 +358,7 @@ export const useChatStore = create<ChatState>()(
|
||||
set({ messages: compactedMsgs });
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('[Chat] Context compaction check failed:', err);
|
||||
log.warn('Context compaction check failed:', err);
|
||||
}
|
||||
|
||||
// Build memory-enhanced content
|
||||
@@ -375,7 +378,7 @@ export const useChatStore = create<ChatState>()(
|
||||
enhancedContent = `<context>\n${systemPrompt}\n</context>\n\n${content}`;
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('[Chat] Memory enhancement failed, proceeding without:', err);
|
||||
log.warn('Memory enhancement failed, proceeding without:', err);
|
||||
}
|
||||
|
||||
// Add user message (original content for display)
|
||||
@@ -477,16 +480,16 @@ export const useChatStore = create<ChatState>()(
|
||||
.filter(m => m.role === 'user' || m.role === 'assistant')
|
||||
.map(m => ({ role: m.role, content: m.content }));
|
||||
getMemoryExtractor().extractFromConversation(msgs, agentId, get().currentConversationId ?? undefined).catch(err => {
|
||||
console.warn('[Chat] Memory extraction failed:', err);
|
||||
log.warn('Memory extraction failed:', err);
|
||||
});
|
||||
// Track conversation for reflection trigger
|
||||
intelligenceClient.reflection.recordConversation().catch(err => {
|
||||
console.warn('[Chat] Recording conversation failed:', err);
|
||||
log.warn('Recording conversation failed:', err);
|
||||
});
|
||||
intelligenceClient.reflection.shouldReflect().then(shouldReflect => {
|
||||
if (shouldReflect) {
|
||||
intelligenceClient.reflection.reflect(agentId, []).catch(err => {
|
||||
console.warn('[Chat] Reflection failed:', err);
|
||||
log.warn('Reflection failed:', err);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -570,7 +573,7 @@ export const useChatStore = create<ChatState>()(
|
||||
|
||||
return result.task.id;
|
||||
} catch (err) {
|
||||
console.warn('[Chat] Swarm dispatch failed:', err);
|
||||
log.warn('Swarm dispatch failed:', err);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user