Skip to content

Commit c26c3f9

Browse files
committed
cleaned files
1 parent 2a15980 commit c26c3f9

6 files changed

Lines changed: 8 additions & 65 deletions

File tree

app/(api)/_datalib/hackbot/getHackbotContext.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ export async function retrieveContext(
6262
if (!limit) {
6363
const complexity = analyzeQueryComplexity(trimmed);
6464
limit = complexity.docLimit;
65-
console.log('[hackbot][retrieve][adaptive]', {
66-
query: trimmed,
67-
complexity: complexity.type,
68-
docLimit: limit,
69-
reason: complexity.reason,
70-
});
7165
}
7266

7367
try {
@@ -132,12 +126,6 @@ export async function retrieveContext(
132126
url: doc.url ?? undefined,
133127
}));
134128

135-
console.log('[hackbot][retrieve][vector]', {
136-
query: trimmed,
137-
docIds: docs.map((d) => d.id),
138-
titles: docs.map((d) => d.title),
139-
});
140-
141129
return { docs };
142130
} catch (err) {
143131
console.error(

app/(api)/_utils/hackbot/stream/eventsTool.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,6 @@ export async function executeGetEvents(
116116
date,
117117
} = input;
118118

119-
console.log('[hackbot][stream][tool] get_events input', {
120-
type,
121-
search,
122-
limit,
123-
forProfile,
124-
timeFilter,
125-
include_activities,
126-
tags,
127-
date,
128-
});
129-
130119
try {
131120
const db = await getDatabase();
132121
const query: Record<string, unknown> = {};
@@ -221,17 +210,6 @@ export async function executeGetEvents(
221210

222211
const limited = limit ? profileFiltered.slice(0, limit) : profileFiltered;
223212

224-
console.log('[hackbot][stream][tool] get_events counts', {
225-
total: events.length,
226-
afterDate: dateFiltered.length,
227-
afterType: typeFiltered.length,
228-
afterRole: roleSpecificFiltered.length,
229-
afterTime: timeFiltered.length,
230-
afterFuture: futureFiltered.length,
231-
afterProfile: profileFiltered.length,
232-
afterLimit: limited.length,
233-
});
234-
235213
if (!limited.length) {
236214
return { events: [], message: 'No events found.' };
237215
}
@@ -255,9 +233,6 @@ export async function executeGetEvents(
255233
};
256234
});
257235

258-
console.log(
259-
`[hackbot][stream][tool] get_events returned ${formatted.length} events`
260-
);
261236
return { events: formatted };
262237
} catch (e) {
263238
console.error('[hackbot][stream][tool] get_events error', e);

app/(api)/_utils/hackbot/stream/responseStream.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export function createResponseStream(
2626
if (part.text) textHasBeenOutput = true;
2727
}
2828
} else if (part?.type === 'tool-call') {
29-
console.log(`[hackbot][stream][tool] calling: ${part.toolName}`);
3029
enq(
3130
`9:${JSON.stringify([
3231
{
@@ -80,12 +79,6 @@ export function createResponseStream(
8079
return;
8180
}
8281

83-
console.log('[hackbot][stream] usage', {
84-
promptTokens: finishPromptTokens,
85-
completionTokens: finishCompletionTokens,
86-
cachedPromptTokens: finishCachedTokens,
87-
});
88-
8982
if (finishPromptTokens > 0) {
9083
getDatabase()
9184
.then((db) =>

app/(api)/api/hackbot/stream/route.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ export async function POST(request: Request) {
4848
return Response.json({ error: 'Unauthorized' }, { status: 401 });
4949
}
5050

51-
console.log(
52-
`[hackbot][stream] message="${lastMessage.content?.slice(0, 80)}" name=${
53-
profile?.name ?? 'n/a'
54-
} position=${profile?.position ?? 'n/a'} beginner=${
55-
profile?.is_beginner ?? 'n/a'
56-
} path=${currentPath ?? '/'}`
57-
);
58-
5951
const contextSummary = buildContextSummary(docs);
6052

6153
const pageContext = getPageContext(currentPath);
@@ -71,10 +63,7 @@ export async function POST(request: Request) {
7163
...sanitizedMessages.slice(-MAX_HISTORY_MESSAGES),
7264
];
7365

74-
const { model, isReasoningModel, maxOutputTokens } = getModelConfig();
75-
console.log(
76-
`[hackbot][stream] model=${model} isReasoning=${isReasoningModel} maxOutputTokens=${maxOutputTokens}`
77-
);
66+
const { model, maxOutputTokens } = getModelConfig();
7867

7968
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8069
const result = streamText({

scripts/hackbotSeed.mjs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ async function seedHackbotDocs({ wipe }) {
5454
await client.connect();
5555
} catch (err) {
5656
console.error(
57-
'MongoDB connection failed. Check MONGODB_URI.\n' + `Details: ${err.message}`
57+
'MongoDB connection failed. Check MONGODB_URI.\n' +
58+
`Details: ${err.message}`
5859
);
5960
return;
6061
}
@@ -117,9 +118,7 @@ async function seedHackbotDocs({ wipe }) {
117118
}
118119
}
119120

120-
console.log(
121-
`Successfully upserted ${successCount}/${docs.length} docs.`
122-
);
121+
console.log(`Successfully upserted ${successCount}/${docs.length} docs.`);
123122

124123
await client.close();
125124
}

scripts/hackbotSeedCI.mjs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,16 @@ async function seedHackbotDocs() {
4747

4848
// Wipe only knowledge docs (not event docs — events are served live via tool calls)
4949
await collection.deleteMany({ _id: { $regex: '^knowledge-' } });
50-
console.log(`[hackbotSeedCI] Wiped knowledge docs from: ${HACKBOT_COLLECTION}`);
50+
console.log(
51+
`[hackbotSeedCI] Wiped knowledge docs from: ${HACKBOT_COLLECTION}`
52+
);
5153

5254
// Load knowledge docs from hackbot_knowledge collection
5355
let knowledgeDocs = [];
5456
try {
5557
knowledgeDocs = await db.collection('hackbot_knowledge').find({}).toArray();
5658
} catch (err) {
57-
console.warn(
58-
'[hackbotSeedCI] Failed to load knowledge docs:',
59-
err.message
60-
);
59+
console.warn('[hackbotSeedCI] Failed to load knowledge docs:', err.message);
6160
}
6261

6362
if (knowledgeDocs.length === 0) {

0 commit comments

Comments
 (0)