File tree Expand file tree Collapse file tree 2 files changed +1
-24
lines changed
Expand file tree Collapse file tree 2 files changed +1
-24
lines changed Original file line number Diff line number Diff 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' ,
Original file line number Diff line number Diff line change @@ -6,15 +6,10 @@ import { useChatStore } from '../state/chat-store'
66import { getAuthToken } from '../utils/auth'
77import { logger } from '../utils/logger'
88
9- import type { Message } from '@codebuff/common/types/messages/codebuff-message'
10-
11- const MAX_MESSAGES_FOR_AD = 100
129const AD_DISPLAY_DURATION_MS = 60 * 1000 // 60 seconds per ad
1310const PREFETCH_BEFORE_MS = 5 * 1000 // Fetch next ad 5 seconds before swap
1411const 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)
1914export 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-
4724export type GravityAdState = {
4825 ad : AdResponse | null
4926 isLoading : boolean
You can’t perform that action at this time.
0 commit comments