Skip to content

Commit b635e08

Browse files
committed
refactor: remove console logs for cleaner code
- Eliminated console log statements from ConfigManager, ChatPanel, useContextUpdateByResultId, and useFindThreadHistory hooks to enhance code clarity and maintainability. - Ensured consistent use of React.memo and useCallback for performance optimization.
1 parent 74027aa commit b635e08

File tree

4 files changed

+0
-32
lines changed

4 files changed

+0
-32
lines changed

packages/ai-workspace-common/src/components/canvas/launchpad/config-manager/index.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,17 +323,13 @@ export const ConfigManager = React.memo(
323323
return formErrors?.[field];
324324
};
325325

326-
console.log('tplConfig', tplConfig);
327-
328326
// Handle initial setup - only run on mount and when tplConfig changes significantly
329327
useEffect(() => {
330328
// Skip if already initialized with this config
331329
if (initializedRef.current) {
332330
return;
333331
}
334332

335-
console.log('Initializing ConfigManager with tplConfig:', tplConfig);
336-
337333
// Track this initialization
338334
initializedRef.current = true;
339335
prevTplConfigRef.current = tplConfig ? { ...tplConfig } : undefined;

packages/ai-workspace-common/src/components/canvas/node-chat-panel/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ export const ChatPanel = memo(
264264
const handleTplConfigChange = useCallback(
265265
(config: SkillTemplateConfig) => {
266266
if (setTplConfig && JSON.stringify(config) !== JSON.stringify(initialTplConfig)) {
267-
console.log('Config changed:', { old: initialTplConfig, new: config });
268267
setTplConfig(config);
269268
}
270269
},

packages/ai-workspace-common/src/hooks/canvas/use-debounced-context-update.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ export const useContextUpdateByResultId = ({
9595
const updateContextItemsFromResultId = useCallback(() => {
9696
if (!resultId) return;
9797

98-
console.log('updateContextItemsFromResultId', resultId);
99-
10098
// Find the node associated with this resultId
10199
const nodes = getNodes();
102100
const currentNode = nodes.find(

packages/ai-workspace-common/src/hooks/canvas/use-find-thread-history.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@ export const useFindThreadHistory = () => {
2323

2424
const edges = getEdges();
2525

26-
console.log('startNode', startNode);
27-
28-
// Create a more detailed mapping for debugging
29-
const allConnections = edges.map((edge) => ({
30-
source: edge.source,
31-
target: edge.target,
32-
sourceNode: getNode(edge.source),
33-
targetNode: getNode(edge.target),
34-
}));
35-
36-
console.log('All connections:', allConnections);
37-
3826
// Create two maps to handle bidirectional traversal if needed
3927
const targetToSourceMap = new Map();
4028
const sourceToTargetsMap = new Map();
@@ -53,9 +41,6 @@ export const useFindThreadHistory = () => {
5341
sourceToTargetsMap.get(edge.source).push(edge.target);
5442
}
5543

56-
// For debugging
57-
console.log('Target to Source Map:', [...targetToSourceMap.entries()]);
58-
5944
const history = [startNode];
6045
const visited = new Set<string>();
6146

@@ -68,7 +53,6 @@ export const useFindThreadHistory = () => {
6853
const sourceIds = targetToSourceMap.get(nodeId) || [];
6954
for (const sourceId of sourceIds) {
7055
const sourceNode = getNode(sourceId);
71-
console.log('Exploring source node:', sourceId, sourceNode?.type);
7256

7357
if (sourceNode?.type === 'skillResponse') {
7458
// Only add if not already in history
@@ -84,15 +68,6 @@ export const useFindThreadHistory = () => {
8468
// Start the recursive search from the start node
8569
findSourceNodes(startNode.id);
8670

87-
console.log(
88-
'Found history nodes:',
89-
history.map((node) => ({
90-
id: node.id,
91-
type: node.type,
92-
entityId: node.data?.entityId,
93-
})),
94-
);
95-
9671
// Return nodes in reverse order (oldest to newest)
9772
return history.reverse();
9873
},

0 commit comments

Comments
 (0)