Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 608115ae
authored
Jul 07, 2026
by
岑成威
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 埋点
1 parent
2d017eb1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
0 deletions
components/AiAssistantBall/AiAssistantBall.vue
utils/aiAssistant/aiAssistantTrack.js
components/AiAssistantBall/AiAssistantBall.vue
View file @
608115a
...
@@ -236,6 +236,14 @@ import {
...
@@ -236,6 +236,14 @@ import {
import
{
storageApi
}
from
'@/utils/cache'
import
{
storageApi
}
from
'@/utils/cache'
import
RecordService
from
'@/utils/recordManager/RecordService.js'
import
RecordService
from
'@/utils/recordManager/RecordService.js'
import
{
getAiStreamSession
}
from
'@/utils/aiAssistant/aiStreamSession.js'
import
{
getAiStreamSession
}
from
'@/utils/aiAssistant/aiStreamSession.js'
import
{
trackAiBallClick
,
trackAiThinkingTrigger
,
trackAiQuestionSelect
,
trackAiAnswerRender
,
trackAiError
,
AI_ERROR_TYPE
}
from
'@/utils/aiAssistant/aiAssistantTrack.js'
import
{
TransportType
}
from
'@/utils/socket'
import
{
TransportType
}
from
'@/utils/socket'
const
DEMO_CAPTURE_SECONDS
=
60
const
DEMO_CAPTURE_SECONDS
=
60
const
HELP_ANSWER_REQUEST_TIMEOUT
=
90000
const
HELP_ANSWER_REQUEST_TIMEOUT
=
90000
...
@@ -397,6 +405,7 @@ export default {
...
@@ -397,6 +405,7 @@ export default {
// #ifdef APP-PLUS
// #ifdef APP-PLUS
if
(
this
.
uiState
===
'thinking'
)
return
if
(
this
.
uiState
===
'thinking'
)
return
if
(
this
.
menuVisible
||
this
.
questionMenuVisible
||
this
.
introVisible
)
return
if
(
this
.
menuVisible
||
this
.
questionMenuVisible
||
this
.
introVisible
)
return
trackAiBallClick
()
if
(
this
.
abnormalBubbleVisible
)
{
if
(
this
.
abnormalBubbleVisible
)
{
this
.
abnormalBubbleVisible
=
false
this
.
abnormalBubbleVisible
=
false
this
.
_pendingBallTap
=
true
this
.
_pendingBallTap
=
true
...
@@ -500,6 +509,7 @@ export default {
...
@@ -500,6 +509,7 @@ export default {
this
.
qaList
=
[]
this
.
qaList
=
[]
this
.
selectedQaIndex
=
-
1
this
.
selectedQaIndex
=
-
1
trackAiThinkingTrigger
(
DEMO_CAPTURE_SECONDS
)
this
.
_logAi
(
'info'
,
`startThinking session=
${
sessionId
}
`
)
this
.
_logAi
(
'info'
,
`startThinking session=
${
sessionId
}
`
)
await
this
.
$nextTick
()
await
this
.
$nextTick
()
...
@@ -522,6 +532,7 @@ export default {
...
@@ -522,6 +532,7 @@ export default {
return
return
}
}
this
.
_logAi
(
'error'
,
`startThinking failed:
${(
e
&&
e
.
message
)
||
e
}
`
)
this
.
_logAi
(
'error'
,
`startThinking failed:
${(
e
&&
e
.
message
)
||
e
}
`
)
trackAiError
(
this
.
_resolveAiErrorType
(
e
))
this
.
streamStatus
=
'error'
this
.
streamStatus
=
'error'
this
.
uiState
=
'idle'
this
.
uiState
=
'idle'
this
.
resultVisible
=
false
this
.
resultVisible
=
false
...
@@ -534,11 +545,18 @@ export default {
...
@@ -534,11 +545,18 @@ export default {
// #endif
// #endif
},
},
selectQa
(
idx
)
{
selectQa
(
idx
)
{
const
item
=
this
.
qaList
[
idx
]
if
(
item
)
{
trackAiQuestionSelect
(
idx
,
item
.
query
||
''
)
}
this
.
selectedQaIndex
=
idx
this
.
selectedQaIndex
=
idx
if
(
this
.
questionMenuVisible
)
{
if
(
this
.
questionMenuVisible
)
{
this
.
questionMenuVisible
=
false
this
.
questionMenuVisible
=
false
this
.
resultVisible
=
true
this
.
resultVisible
=
true
}
}
if
(
item
&&
item
.
answer
)
{
this
.
_trackAnswerRenderForIntent
(
idx
)
}
},
},
/** 打开面板即开始监听/模拟流式 markdown,边收边渲染 */
/** 打开面板即开始监听/模拟流式 markdown,边收边渲染 */
beginStreamSession
()
{
beginStreamSession
()
{
...
@@ -705,6 +723,7 @@ export default {
...
@@ -705,6 +723,7 @@ export default {
if
(
!
this
.
qaList
.
length
)
{
if
(
!
this
.
qaList
.
length
)
{
this
.
_logAi
(
'info'
,
'response empty, no questions to show'
)
this
.
_logAi
(
'info'
,
'response empty, no questions to show'
)
trackAiError
(
AI_ERROR_TYPE
.
NO_ANSWER
)
return
return
}
}
if
(
isCancelled
())
{
if
(
isCancelled
())
{
...
@@ -720,9 +739,26 @@ export default {
...
@@ -720,9 +739,26 @@ export default {
this
.
questionMenuVisible
=
false
this
.
questionMenuVisible
=
false
this
.
selectedQaIndex
=
0
this
.
selectedQaIndex
=
0
this
.
resultVisible
=
true
this
.
resultVisible
=
true
if
(
this
.
qaList
[
0
]
&&
this
.
qaList
[
0
].
answer
)
{
this
.
_trackAnswerRenderForIntent
(
0
)
}
}
}
// #endif
// #endif
},
},
_trackAnswerRenderForIntent
(
intentId
)
{
const
renderStart
=
Date
.
now
()
this
.
$nextTick
(()
=>
{
trackAiAnswerRender
(
intentId
,
Date
.
now
()
-
renderStart
)
})
},
_resolveAiErrorType
(
err
)
{
const
msg
=
String
((
err
&&
(
err
.
errMsg
||
err
.
message
))
||
''
)
if
(
/timeout/i
.
test
(
msg
))
return
AI_ERROR_TYPE
.
TIMEOUT
if
(
this
.
_isHelpAnswerNetworkError
(
err
)
||
/连接失败|network/i
.
test
(
msg
))
{
return
AI_ERROR_TYPE
.
NETWORK
}
return
AI_ERROR_TYPE
.
OTHER
},
_logAi
(
level
,
msg
)
{
_logAi
(
level
,
msg
)
{
// #ifdef APP-PLUS
// #ifdef APP-PLUS
const
text
=
`[AiAssistant]
${
msg
}
`
const
text
=
`[AiAssistant]
${
msg
}
`
...
...
utils/aiAssistant/aiAssistantTrack.js
0 → 100644
View file @
608115a
import
{
storageApi
}
from
'@/utils/cache'
const
EVENT
=
{
BALL_CLICK
:
'app_ai_ball_click'
,
THINKING_TRIGGER
:
'app_ai_thinking_trigger'
,
QUESTION_SELECT
:
'app_ai_question_select'
,
ANSWER_RENDER
:
'app_ai_answer_render'
,
ERROR
:
'app_ai_error'
}
function
getUserId
()
{
const
{
uuid
}
=
storageApi
.
getUserInfo
()
||
{}
return
uuid
||
''
}
function
getSessionId
()
{
return
storageApi
.
getSessionId
()
||
''
}
function
getPageContext
()
{
const
pages
=
getCurrentPages
()
const
currentPage
=
pages
[
pages
.
length
-
1
]
return
currentPage
?.
route
||
'/'
}
function
track
(
eventCode
,
businessParam
=
{})
{
if
(
!
uni
.
$track
)
return
uni
.
$track
.
add
({
eventCode
,
businessParam
:
{
user_id
:
getUserId
(),
session_id
:
getSessionId
(),
...
businessParam
}
})
}
export
function
trackAiBallClick
()
{
track
(
EVENT
.
BALL_CLICK
,
{
timestamp
:
Date
.
now
(),
page_context
:
getPageContext
()
})
}
export
function
trackAiThinkingTrigger
(
audioDuration
)
{
track
(
EVENT
.
THINKING_TRIGGER
,
{
audio_duration
:
audioDuration
})
}
export
function
trackAiQuestionSelect
(
intentId
,
intentText
)
{
track
(
EVENT
.
QUESTION_SELECT
,
{
intent_id
:
intentId
,
intent_text
:
intentText
})
}
export
function
trackAiAnswerRender
(
intentId
,
renderTime
)
{
track
(
EVENT
.
ANSWER_RENDER
,
{
intent_id
:
intentId
,
render_time
:
renderTime
})
}
export
function
trackAiError
(
errorType
)
{
track
(
EVENT
.
ERROR
,
{
error_type
:
errorType
,
timestamp
:
Date
.
now
()
})
}
export
const
AI_ERROR_TYPE
=
{
TIMEOUT
:
'timeout'
,
NETWORK
:
'network_disconnect'
,
NO_ANSWER
:
'no_answer'
,
OTHER
:
'other'
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment