Skip to content

Commit a44a7a4

Browse files
committed
cleanup / say you earn credits from enabling ads
1 parent 76ddb0d commit a44a7a4

File tree

2 files changed

+1
-24
lines changed

2 files changed

+1
-24
lines changed

cli/src/data/slash-commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const SLASH_COMMANDS: SlashCommand[] = [
1818
{
1919
id: 'ads:enable',
2020
label: 'ads:enable',
21-
description: 'Enable contextual ads',
21+
description: 'Enable contextual ads and earn credits',
2222
},
2323
{
2424
id: 'ads:disable',

cli/src/hooks/use-gravity-ad.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@ import { useChatStore } from '../state/chat-store'
66
import { getAuthToken } from '../utils/auth'
77
import { logger } from '../utils/logger'
88

9-
import type { Message } from '@codebuff/common/types/messages/codebuff-message'
10-
11-
const MAX_MESSAGES_FOR_AD = 100
129
const AD_DISPLAY_DURATION_MS = 60 * 1000 // 60 seconds per ad
1310
const PREFETCH_BEFORE_MS = 5 * 1000 // Fetch next ad 5 seconds before swap
1411
const MAX_ADS_AFTER_ACTIVITY = 3 // Show up to 3 ads after last activity, then stop
1512

16-
type AdMessage = { role: 'user' | 'assistant'; content: string }
17-
1813
// Ad response type (matches Gravity API response, credits added after impression)
1914
export type AdResponse = {
2015
adText: string
@@ -26,24 +21,6 @@ export type AdResponse = {
2621
credits?: number // Set after impression is recorded (in cents)
2722
}
2823

29-
/**
30-
* Extract text content from a Message's content array
31-
*/
32-
const extractTextFromMessageContent = (content: Message['content']): string => {
33-
if (!Array.isArray(content)) return ''
34-
35-
return content
36-
.filter(
37-
(part): part is { type: 'text'; text: string } =>
38-
typeof part === 'object' &&
39-
part !== null &&
40-
'type' in part &&
41-
part.type === 'text',
42-
)
43-
.map((part) => part.text)
44-
.join('\n')
45-
}
46-
4724
export type GravityAdState = {
4825
ad: AdResponse | null
4926
isLoading: boolean

0 commit comments

Comments
 (0)