Skip to content

Commit e4ea364

Browse files
feat(notifications): add Grok Code Fast 1 Optimized discontinued notification (#3496)
* feat(notifications): add Grok Code Fast 1 Optimized discontinued notification * fix(notifications): hoist posthog query and suggest Grok Build 0.1 --------- Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
1 parent 3838b3f commit e4ea364

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

apps/web/src/lib/notifications.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export async function generateUserNotifications(user: User): Promise<KiloNotific
115115
generateAutoTopUpNotification,
116116
generateAutoTopUpOrgsNotification,
117117
generateByokProvidersNotification,
118+
generateGrokCodeFast1OptimizedDiscontinuedNotification,
118119
generateKiloPassNotification,
119120
];
120121

@@ -293,6 +294,46 @@ async function generateByokProvidersNotification(
293294
}
294295
}
295296

297+
const getGrokCodeFast1OptimizedDiscontinuedUsers = cachedPosthogQuery(
298+
z.array(z.tuple([z.string()]).transform(([userId]) => userId))
299+
);
300+
301+
async function generateGrokCodeFast1OptimizedDiscontinuedNotification(
302+
user: User,
303+
_ctx: NotificationContext
304+
): Promise<KiloNotification[]> {
305+
try {
306+
const users = await getGrokCodeFast1OptimizedDiscontinuedUsers(
307+
'grok-code-fast-1-optimized-discontinued-users',
308+
'select kilo_user_id from notification_grok_code_may_15 limit 5e5'
309+
);
310+
311+
if (!users.includes(user.id)) {
312+
console.debug(
313+
'[generateGrokCodeFast1OptimizedDiscontinuedNotification] not showing notification for user'
314+
);
315+
return [];
316+
}
317+
318+
console.debug(
319+
'[generateGrokCodeFast1OptimizedDiscontinuedNotification] showing notification for user'
320+
);
321+
return [
322+
{
323+
id: 'grok-code-fast-1-optimized-discontinued-may-15',
324+
title: 'Grok Code Fast 1 Optimized is discontinued',
325+
message:
326+
'Grok Code Fast 1 Optimized has been discontinued. Give Grok Build 0.1 a try as a replacement.',
327+
suggestModelId: 'x-ai/grok-build-0.1',
328+
showIn: ['cli', 'extension'],
329+
},
330+
];
331+
} catch (e) {
332+
console.error('[generateGrokCodeFast1OptimizedDiscontinuedNotification]', e);
333+
return [];
334+
}
335+
}
336+
296337
async function generateKiloPassNotification(
297338
user: User,
298339
ctx: NotificationContext

0 commit comments

Comments
 (0)