-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: frontend copilot metrics #8479
Changes from all commits
a45be1a
cb9d194
5424277
12004d5
f550b19
8653540
99f289e
71bdfd9
783bf3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import track from '@affine/track'; | ||
import type { EditorHost } from '@blocksuite/affine/block-std'; | ||
import { isInsideEdgelessEditor } from '@blocksuite/affine/blocks'; | ||
|
||
export function getTracker(host: EditorHost, inline: boolean) { | ||
return track[isInsideEdgelessEditor(host) ? 'doc' : 'edgeless'].editor[ | ||
inline ? 'slashMenu' : 'formatToolbar' | ||
]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,6 +109,17 @@ type PaymentEvents = | |
| 'confirmResumingSubscription'; | ||
// END SECTION | ||
|
||
// SECTION: copilot events | ||
darkskygit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type CopilotEvents = | ||
| 'startChat' | ||
| 'resetChat' | ||
| 'abortChat' | ||
| 'addChatAttachment' | ||
| 'invokeAction' | ||
| 'discardAction' | ||
| 'acceptAction'; | ||
// END SECTION | ||
|
||
type UserEvents = | ||
| GeneralEvents | ||
| AppEvents | ||
|
@@ -122,7 +133,9 @@ type UserEvents = | |
| ShareEvents | ||
| AuthEvents | ||
| AccountEvents | ||
| PaymentEvents; | ||
| PaymentEvents | ||
| CopilotEvents; | ||
|
||
interface PageDivision { | ||
[page: string]: { | ||
[segment: string]: { | ||
|
@@ -244,6 +257,15 @@ const PageEvents = { | |
}, | ||
appTabsHeader: { | ||
$: ['tabAction'], | ||
chat: [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reconsider the segment module of ai events, they are in a mess There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. current ai track events are chaos, and it may not be possible to complete all the changes in this pr There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see #8546 |
||
'startChat', | ||
'abortChat', | ||
'resetChat', | ||
'addChatAttachment', | ||
'invokeAction', | ||
'discardAction', | ||
'acceptAction', | ||
], | ||
}, | ||
header: { | ||
actions: [ | ||
|
@@ -272,10 +294,24 @@ const PageEvents = { | |
}, | ||
doc: { | ||
editor: { | ||
slashMenu: ['linkDoc', 'createDoc', 'bookmark'], | ||
slashMenu: [ | ||
'linkDoc', | ||
'createDoc', | ||
'bookmark', | ||
// copilot actions | ||
'invokeAction', | ||
'discardAction', | ||
'acceptAction', | ||
], | ||
atMenu: ['linkDoc', 'import'], | ||
quickSearch: ['createDoc'], | ||
formatToolbar: ['bold'], | ||
formatToolbar: [ | ||
'bold', | ||
// copilot actions | ||
'invokeAction', | ||
'discardAction', | ||
'acceptAction', | ||
], | ||
pageRef: ['navigate'], | ||
toolbar: ['copyBlockToLink'], | ||
}, | ||
|
@@ -288,9 +324,17 @@ const PageEvents = { | |
property: ['addProperty'], | ||
}, | ||
}, | ||
// remove when type added | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
edgeless: {}, | ||
edgeless: { | ||
editor: { | ||
slashMenu: [ | ||
// copilot actions | ||
'invokeAction', | ||
'discardAction', | ||
'acceptAction', | ||
], | ||
formatToolbar: ['invokeAction', 'discardAction', 'acceptAction'], | ||
}, | ||
}, | ||
workspace: { | ||
$: { | ||
$: ['upgradeWorkspace'], | ||
|
@@ -424,6 +468,31 @@ export type EventArgs = { | |
}; | ||
editProperty: { type: string }; | ||
addProperty: { type: string; control: 'at menu' | 'property list' }; | ||
// copilot | ||
invokeAction: { | ||
action: string; | ||
retry?: boolean; | ||
}; | ||
discardAction: { | ||
action: string; | ||
control: | ||
| 'stop_button' | ||
| 'discard_button' | ||
| 'paywall' | ||
| 'backend_policy' | ||
| 'backend_error' | ||
| 'login_required' | ||
| 'retry'; | ||
}; | ||
acceptAction: { | ||
action: string; | ||
control: | ||
| 'insert' | ||
| 'insert_note' | ||
| 'replace' | ||
| 'as_caption' | ||
| 'continue_in_chat'; | ||
}; | ||
}; | ||
|
||
// for type checking | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ternary operation appears to be swapped. When
isInsideEdgelessEditor(host)
istrue
, it should return'edgeless'
, not'doc'
. The corrected line should be:Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.