Skip to content

Commit 01c7d78

Browse files
ci-botbunsenstraat
authored andcommitted
ai changes
(cherry picked from commit e68a98a)
1 parent dc3bc84 commit 01c7d78

File tree

7 files changed

+96
-52
lines changed

7 files changed

+96
-52
lines changed

apps/remix-ide/src/app/plugins/remix-ai-assistant.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ export class RemixAIAssistant extends ViewPlugin {
102102
}
103103

104104
async handleActivity(type: string, payload: any) {
105-
// Use the proper type-safe tracking helper with RemixAI events
106-
trackMatomoEvent(this, { category: 'ai', action: 'remixAI', name: `${type}-${payload}`, isClick: true })
105+
// Dynamic event name from ActivityType: 'typing', 'button', 'promptSend', 'streamStart', 'streamEnd'
106+
// Original: _paq.push(['trackEvent', 'remixai-assistant', `${type}-${payload}`])
107+
trackMatomoEvent(this, { category: 'ai', action: 'remixAI', name: `remixai-assistant-${type}-${payload}` as any, isClick: true })
107108
}
108109

109110
updateComponent(state: {

apps/remix-ide/src/assets/list.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,18 @@
10661066
"urls": [
10671067
"dweb:/ipfs/QmXFsguaaxZj2FZmf2pGLTPDDkDD8nHX4grC4jDVugnMxv"
10681068
]
1069+
},
1070+
{
1071+
"path": "soljson-v0.8.31-pre.1+commit.b59566f6.js",
1072+
"version": "0.8.31",
1073+
"prerelease": "pre.1",
1074+
"build": "commit.b59566f6",
1075+
"longVersion": "0.8.31-pre.1+commit.b59566f6",
1076+
"keccak256": "0x5cbab72123ec1f65e72592375e568788d88c96ffd90a1a3e9107fcd5a3b9cf87",
1077+
"sha256": "0xaf2b74e3c674c09ce89189edfaa81a0d01f1a0dce9100968e0d442de8a93b926",
1078+
"urls": [
1079+
"dweb:/ipfs/QmafWKo2uVeEPMi1GbY2DVPreWtbA6aqXjynnn4wViA6a4"
1080+
]
10691081
}
10701082
],
10711083
"releases": {

libs/remix-api/src/lib/plugins/matomo/events/ai-events.ts

Lines changed: 52 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,102 @@
33
*
44
* This file contains all AI-related Matomo events including RemixAI interactions,
55
* Ollama local AI, and code completion features.
6+
*
7+
* STANDARDIZED PATTERN:
8+
* - category: 'ai' (always)
9+
* - action: 'remixAI' (always)
10+
* - name: specific event identifier (type-safe)
611
*/
712

813
import { MatomoEventBase } from '../core/base-types';
914

1015
export interface AIEvent extends MatomoEventBase {
1116
category: 'ai';
12-
action:
13-
| 'remixAI'
14-
| 'vulnerability_check_pasted_code'
15-
| 'generateDocumentation'
16-
| 'explainFunction'
17+
action: 'remixAI';
18+
name:
19+
// Code completion & generation
1720
| 'Copilot_Completion_Accepted'
1821
| 'code_generation'
1922
| 'code_insertion'
2023
| 'code_completion'
24+
| 'code_generation_did_show'
25+
| 'code_insertion_did_show'
26+
| 'code_completion_did_show'
27+
| 'code_generation_partial_accept'
28+
| 'code_insertion_partial_accept'
29+
| 'code_completion_partial_accept'
30+
| 'vulnerability_check_pasted_code'
31+
| 'generateDocumentation'
32+
| 'explainFunction'
33+
| 'error_explaining_SolidityError'
34+
// AI Context
2135
| 'AddingAIContext'
36+
// RemixAI workspace & chat
37+
| 'GenerateNewAIWorkspace'
38+
| 'WorkspaceAgentEdit'
39+
| 'remixAI_chat'
40+
| 'GenerateNewAIWorkspaceFromEditMode'
41+
| 'GenerateNewAIWorkspaceFromModal'
42+
// AI Provider selection
43+
| 'SetAIProvider'
44+
| 'SetOllamaModel'
45+
| 'ModeSwitch'
46+
// Ollama host discovery
2247
| 'ollama_host_cache_hit'
2348
| 'ollama_port_check'
2449
| 'ollama_host_discovered_success'
2550
| 'ollama_port_connection_failed'
2651
| 'ollama_host_discovery_failed'
2752
| 'ollama_availability_check'
2853
| 'ollama_availability_result'
54+
| 'ollama_reset_host'
55+
// Ollama models
2956
| 'ollama_list_models_start'
3057
| 'ollama_list_models_failed'
31-
| 'ollama_reset_host'
3258
| 'ollama_pull_model_start'
3359
| 'ollama_pull_model_failed'
3460
| 'ollama_pull_model_success'
3561
| 'ollama_pull_model_error'
3662
| 'ollama_get_best'
3763
| 'ollama_get_best_model_error'
38-
| 'ollama_initialize_failed'
39-
| 'ollama_host_discovered'
4064
| 'ollama_models_found'
4165
| 'ollama_model_auto_selected'
66+
| 'ollama_model_selected'
67+
| 'ollama_model_set_backend_success'
68+
| 'ollama_model_set_backend_failed'
69+
| 'ollama_default_model_selected'
70+
// Ollama initialization
71+
| 'ollama_initialize_failed'
72+
| 'ollama_host_discovered'
4273
| 'ollama_initialize_success'
4374
| 'ollama_model_selection_error'
75+
// Ollama code operations
4476
| 'ollama_fim_native'
4577
| 'ollama_fim_token_based'
4678
| 'ollama_completion_no_fim'
4779
| 'ollama_suffix_overlap_removed'
4880
| 'ollama_code_completion_complete'
4981
| 'ollama_code_insertion'
82+
| 'ollama_code_generation'
5083
| 'ollama_generate_contract'
5184
| 'ollama_generate_workspace'
5285
| 'ollama_chat_answer'
5386
| 'ollama_code_explaining'
5487
| 'ollama_error_explaining'
5588
| 'ollama_vulnerability_check'
89+
// Ollama provider
5690
| 'ollama_provider_selected'
5791
| 'ollama_fallback_to_provider'
58-
| 'ollama_default_model_selected'
5992
| 'ollama_unavailable'
6093
| 'ollama_connection_error'
61-
| 'ollama_model_selected'
62-
| 'ollama_model_set_backend_success'
63-
| 'ollama_model_set_backend_failed';
94+
// Assistant feedback (kebab-case to match original)
95+
| 'like-response'
96+
| 'dislike-response';
6497
}
6598

66-
67-
6899
/**
69-
* RemixAI Events - Specific to RemixAI interactions
100+
* @deprecated Use AIEvent with category: 'ai', action: 'remixAI' instead
101+
* This interface is kept for backward compatibility during migration
70102
*/
71103
export interface RemixAIEvent extends MatomoEventBase {
72104
category: 'remixAI';
@@ -78,15 +110,14 @@ export interface RemixAIEvent extends MatomoEventBase {
78110
| 'GenerateNewAIWorkspaceFromModal';
79111
}
80112

81-
82-
83113
/**
84-
* RemixAI Assistant Events - Specific to assistant interactions
114+
* @deprecated Use AIEvent with name: 'like-response' | 'dislike-response' instead
115+
* This interface is kept for backward compatibility during migration
85116
*/
86117
export interface RemixAIAssistantEvent extends MatomoEventBase {
87-
category: 'remixAIAssistant';
118+
category: 'remixai-assistant';
88119
action:
89-
| 'likeResponse'
90-
| 'dislikeResponse';
120+
| 'like-response'
121+
| 'dislike-response';
91122
}
92123

libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
202202
})
203203

204204
const data = await this.props.plugin.call('remixAI', 'code_insertion', word, word_after)
205-
this.trackMatomoEvent?.({ category: 'ai', action: 'code_generation', isClick: false })
205+
this.trackMatomoEvent?.({ category: 'ai', action: 'remixAI', name: 'code_generation', isClick: false })
206206
this.task = 'code_generation'
207207

208208
const parsedData = data.trimStart()
@@ -228,7 +228,7 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
228228
try {
229229
CompletionParams.stop = ['\n\n', '```']
230230
const output = await this.props.plugin.call('remixAI', 'code_insertion', word, word_after, CompletionParams)
231-
this.trackMatomoEvent?.({ category: 'ai', action: 'code_insertion', isClick: false })
231+
this.trackMatomoEvent?.({ category: 'ai', action: 'remixAI', name: 'code_insertion', isClick: false })
232232
const generatedText = output
233233

234234
this.task = 'code_insertion'
@@ -259,7 +259,7 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
259259
CompletionParams.stop = ['\n', '```']
260260
this.task = 'code_completion'
261261
const output = await this.props.plugin.call('remixAI', 'code_completion', word, word_after, CompletionParams)
262-
this.trackMatomoEvent?.({ category: 'ai', action: 'code_completion', isClick: false })
262+
this.trackMatomoEvent?.({ category: 'ai', action: 'remixAI', name: 'code_completion', isClick: false })
263263
const generatedText = output
264264
let clean = generatedText
265265

@@ -307,7 +307,7 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
307307
this.currentCompletion.task = this.task
308308

309309
this.rateLimiter.trackCompletionShown()
310-
this.trackMatomoEvent?.({ category: 'ai', action: 'remixAI', name: this.task + '_did_show', isClick: true })
310+
this.trackMatomoEvent?.({ category: 'ai', action: 'remixAI', name: `${this.task}_did_show` as any, isClick: true })
311311
}
312312

313313
handlePartialAccept?(
@@ -319,7 +319,7 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
319319
this.currentCompletion.task = this.task
320320

321321
this.rateLimiter.trackCompletionAccepted()
322-
this.trackMatomoEvent?.({ category: 'ai', action: 'remixAI', name: this.task + '_partial_accept', isClick: true })
322+
this.trackMatomoEvent?.({ category: 'ai', action: 'remixAI', name: `${this.task}_partial_accept` as any, isClick: true })
323323
}
324324

325325
freeInlineCompletions(

libs/remix-ui/editor/src/lib/remix-ui-editor.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ export const EditorUI = (props: EditorUIProps) => {
794794
setTimeout(async () => {
795795
props.plugin.call('remixAI', 'chatPipe', 'vulnerability_check', pastedCodePrompt)
796796
}, 500)
797-
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'vulnerability_check_pasted_code', isClick: true })
797+
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'remixAI', name: 'vulnerability_check_pasted_code', isClick: true })
798798
})();
799799
}
800800
};
@@ -862,7 +862,7 @@ export const EditorUI = (props: EditorUIProps) => {
862862
if (changes.some(change => change.text === inlineCompletionProvider.currentCompletion.item.insertText)) {
863863
inlineCompletionProvider.currentCompletion.onAccepted()
864864
inlineCompletionProvider.currentCompletion.accepted = true
865-
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'Copilot_Completion_Accepted', isClick: true })
865+
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'remixAI', name: 'Copilot_Completion_Accepted', isClick: true })
866866
}
867867
}
868868
});
@@ -998,7 +998,7 @@ export const EditorUI = (props: EditorUIProps) => {
998998
}, 150)
999999
}
10001000
}
1001-
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'generateDocumentation', isClick: true })
1001+
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'remixAI', name: 'generateDocumentation', isClick: true })
10021002
},
10031003
}
10041004
}
@@ -1017,7 +1017,7 @@ export const EditorUI = (props: EditorUIProps) => {
10171017
setTimeout(async () => {
10181018
await props.plugin.call('remixAI' as any, 'chatPipe', 'code_explaining', message, context)
10191019
}, 500)
1020-
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'explainFunction', isClick: true })
1020+
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'remixAI', name: 'explainFunction', isClick: true })
10211021
},
10221022
}
10231023

@@ -1041,7 +1041,7 @@ export const EditorUI = (props: EditorUIProps) => {
10411041
setTimeout(async () => {
10421042
await props.plugin.call('remixAI' as any, 'chatPipe', 'code_explaining', selectedCode, content, pipeMessage)
10431043
}, 500)
1044-
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'explainFunction', isClick: true })
1044+
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'remixAI', name: 'explainFunction', isClick: true })
10451045
},
10461046
}
10471047

libs/remix-ui/remix-ai-assistant/src/components/prompt.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
129129
className={`btn btn-sm ${aiMode === 'ask' ? 'btn-primary' : 'btn-outline-secondary'} px-2`}
130130
onClick={() => {
131131
setAiMode('ask')
132-
trackMatomoEvent({ category: 'remixAI', action: 'ModeSwitch', name: 'ask', isClick: true })
132+
trackMatomoEvent({ category: 'ai', action: 'remixAI', name: 'ModeSwitch', value: 'ask', isClick: true })
133133
}}
134134
title="Ask mode - Chat with AI"
135135
>
@@ -140,7 +140,7 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
140140
className={`btn btn-sm ${aiMode === 'edit' ? 'btn-primary' : 'btn-outline-secondary'} px-2`}
141141
onClick={() => {
142142
setAiMode('edit')
143-
trackMatomoEvent({ category: 'remixAI', action: 'ModeSwitch', name: 'edit', isClick: true })
143+
trackMatomoEvent({ category: 'ai', action: 'remixAI', name: 'ModeSwitch', value: 'edit', isClick: true })
144144
}}
145145
title="Edit mode - Edit workspace code"
146146
>

0 commit comments

Comments
 (0)