Skip to content
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

feature: 流水线日志支持AI修复 #10913 #11005

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f76f0ba
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 5, 2024
0c0b374
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 5, 2024
f8010a2
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 5, 2024
2f37e3a
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 5, 2024
beba676
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 6, 2024
391ffd2
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 6, 2024
42d9df8
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 19, 2024
30ca7e8
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 20, 2024
e47fc52
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 20, 2024
a9fa266
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 20, 2024
a0db969
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 20, 2024
9e4a70e
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 23, 2024
8c417bf
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 23, 2024
bc09260
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 23, 2024
7b32dbf
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 23, 2024
4f9c5fa
Merge branch 'master' of https://github.com/TencentBlueKing/bk-ci int…
zhanxu33 Sep 24, 2024
e974e31
Merge branch 'master' of https://github.com/TencentBlueKing/bk-ci int…
zhanxu33 Sep 24, 2024
0919863
feature: 流水线日志支持AI修复 #10913
zhanxu33 Sep 24, 2024
f8d05c5
feature: 流水线日志支持AI修复 #10913
zhanxu33 Oct 9, 2024
014c07e
Merge branch 'master' of https://github.com/TencentBlueKing/bk-ci int…
zhanxu33 Oct 9, 2024
8685069
feature: 流水线日志支持AI修复 #10913
zhanxu33 Oct 9, 2024
9ae4577
feature: 流水线日志支持AI修复 #10913
zhanxu33 Oct 11, 2024
1a10d23
feature: 流水线日志支持AI修复 #10913
zhanxu33 Oct 11, 2024
725d8a3
feature: 流水线日志支持AI修复 #10913
zhanxu33 Oct 11, 2024
c04e058
feature: 流水线日志支持AI修复 #10913
zhanxu33 Oct 12, 2024
0424cec
feature: 流水线日志支持AI修复 #10913
zhanxu33 Oct 12, 2024
92449f9
feature: 流水线日志支持AI修复 #10913
zhanxu33 Oct 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/frontend/devops-pipeline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"public:external": "cross-env NODE_ENV=external npm run public --"
},
"dependencies": {
"@blueking/log": "2.1.5",
"@blueking/log": "2.2.0-beta.28",
"@blueking/search-select": "0.0.1-beta.2",
"@icon-cool/bk-icon-devops": "^0.2.1",
"axios": "0.28.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
:log-list="pluginList"
@open-log="openLog"
@tag-change="tagChange"
@praise-ai="handlePraiseAi"
@down-praise-ai="handleDownPraiseAi"
@load-ai-message="handleLoadAiMessage"
@reload-ai-message="handleReloadAiMessage"
@cancel-praise-ai="handleCancelPraiseAI"
@cancel-down-praise-ai="handleCancelDownPraiseAI"
>
<template slot-scope="log">
<status-icon
Expand Down Expand Up @@ -83,9 +89,96 @@
methods: {
...mapActions('atom', [
'getInitLog',
'getAfterLog'
'getAfterLog',
'praiseAi',
'cancelPraiseAi',
'getPraiseAiInfo',
'getLogAIMessage'
]),

handlePraiseAi ({ id, item }) {
this.praiseAi({
...this.logPostData[id],
score: true
}).then(() => {
this.handleGetPraiseAiInfo({ id, item })
this.$bkMessage({ theme: 'success', message: this.$t('successPraise') })
})
},

handleDownPraiseAi ({ id, item }) {
this.praiseAi({
...this.logPostData[id],
score: false
}).then(() => {
this.handleGetPraiseAiInfo({ id, item })
this.$bkMessage({ theme: 'success', message: this.$t('successDownPraise') })
})
},

handleCancelPraiseAI ({ id, item }) {
this.cancelPraiseAi({
...this.logPostData[id],
score: true
}).then(() => {
this.handleGetPraiseAiInfo({ id, item })
this.$bkMessage({ theme: 'success', message: this.$t('successCancelPraise') })
})
},

handleCancelDownPraiseAI ({ id, item }) {
this.cancelPraiseAi({
...this.logPostData[id],
score: false
}).then(() => {
this.handleGetPraiseAiInfo({ id, item })
this.$bkMessage({ theme: 'success', message: this.$t('successCancelDownPraise') })
})
},

handleGetPraiseAiInfo ({ id, item }) {
const ref = this.$refs.multipleLog
this.getPraiseAiInfo({
...this.logPostData[id]
})
.then((res) => {
item.goodUsers = res.data.goodUsers
item.badUsers = res.data.badUsers
ref.setSingleLogData(item, id)
})
},

handleLoadAiMessage ({ id, item }) {
item.aiMessage = ''
const ref = this.$refs.multipleLog
this.handleGetPraiseAiInfo({ id, item })
this.getLogAIMessage({
...this.logPostData[id],
refresh: false,
callBack (val) {
item.aiMessage += val
ref.setSingleLogData(item, id)
ref.scrollAILogToBottom(id)
}
})
},

handleReloadAiMessage ({ id, item }) {
item.aiMessage = ''
const ref = this.$refs.multipleLog
this.getLogAIMessage({
...this.logPostData[id],
refresh: true,
callBack (val) {
item.aiMessage += val
ref.setSingleLogData(item, id)
ref.scrollAILogToBottom(id)
}
}).then(() => {
this.handleGetPraiseAiInfo({ id, item })
})
},

toggleShowDebugLog () {
this.showDebug = !this.showDebug
this.clearAllLog()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@
class="bk-log"
ref="scroll"
@tag-change="tagChange"
></bk-log>
@praise-ai="handlePraiseAi"
@down-praise-ai="handleDownPraiseAi"
@load-ai-message="handleLoadAiMessage"
@reload-ai-message="handleReloadAiMessage"
@cancel-praise-ai="handleCancelPraiseAI"
@cancel-down-praise-ai="handleCancelDownPraiseAI"
/>
</section>
</template>

Expand Down Expand Up @@ -156,9 +162,96 @@
'getInitLog',
'getAfterLog',
'getLogStatus',
'getDownloadLogFromArtifactory'
'getDownloadLogFromArtifactory',
'praiseAi',
'cancelPraiseAi',
'getPraiseAiInfo',
'getLogAIMessage'
]),

handlePraiseAi (item) {
this.praiseAi({
...this.postData,
score: true
}).then(() => {
this.handleGetPraiseAiInfo(item)
this.$bkMessage({ theme: 'success', message: this.$t('successPraise') })
})
},

handleDownPraiseAi (item) {
this.praiseAi({
...this.postData,
score: false
}).then(() => {
this.handleGetPraiseAiInfo(item)
this.$bkMessage({ theme: 'success', message: this.$t('successDownPraise') })
})
},

handleCancelPraiseAI (item) {
this.cancelPraiseAi({
...this.postData,
score: true
}).then(() => {
this.handleGetPraiseAiInfo(item)
this.$bkMessage({ theme: 'success', message: this.$t('successCancelPraise') })
})
},

handleCancelDownPraiseAI (item) {
this.cancelPraiseAi({
...this.postData,
score: false
}).then(() => {
this.handleGetPraiseAiInfo(item)
this.$bkMessage({ theme: 'success', message: this.$t('successCancelDownPraise') })
})
},

handleGetPraiseAiInfo (item) {
const scrollRef = this.$refs.scroll
this.getPraiseAiInfo({
...this.postData
})
.then((res) => {
item.goodUsers = res.data.goodUsers
item.badUsers = res.data.badUsers
scrollRef.setSingleLogData(item)
})
},

handleLoadAiMessage (item) {
item.aiMessage = ''
const scrollRef = this.$refs.scroll
this.handleGetPraiseAiInfo(item)
this.getLogAIMessage({
...this.postData,
refresh: false,
callBack (val) {
item.aiMessage += val
scrollRef.setSingleLogData(item)
scrollRef.scrollAILogToBottom()
}
})
},

handleReloadAiMessage (item) {
item.aiMessage = ''
const scrollRef = this.$refs.scroll
this.getLogAIMessage({
...this.postData,
refresh: true,
callBack (val) {
item.aiMessage += val
scrollRef.setSingleLogData(item)
scrollRef.scrollAILogToBottom()
}
}).then(() => {
this.handleGetPraiseAiInfo(item)
})
},

getLog () {
const id = hashID()
this.getLog.id = id
Expand Down
55 changes: 55 additions & 0 deletions src/frontend/devops-pipeline/src/store/modules/atom/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,61 @@ export default {
})
},

praiseAi ({ commit }, { projectId, pipelineId, buildId, tag, currentExe, score }) {
let url = `/misc/api/user/gpt/script_error_analysis_score/${projectId}/${pipelineId}/${buildId}?taskId=${tag}&score=${score}`
if (currentExe) {
url += `&executeCount=${currentExe}`
}
return request.post(url)
},

cancelPraiseAi ({ commit }, { projectId, pipelineId, buildId, tag, currentExe, score }) {
let url = `/misc/api/user/gpt/script_error_analysis_score/${projectId}/${pipelineId}/${buildId}?taskId=${tag}&score=${score}`
if (currentExe) {
url += `&executeCount=${currentExe}`
}
return request.delete(url)
},

getPraiseAiInfo ({ commit }, { projectId, pipelineId, buildId, tag, currentExe }) {
let url = `/misc/api/user/gpt/script_error_analysis_score/${projectId}/${pipelineId}/${buildId}?taskId=${tag}&score=true`
if (currentExe) {
url += `&executeCount=${currentExe}`
}
return request.get(url)
},

getLogAIMessage ({ commit }, { projectId, pipelineId, buildId, tag, currentExe, refresh, callBack }) {
let url = `/misc/api/user/gpt/script_error_analysis/${projectId}/${pipelineId}/${buildId}?taskId=${tag}&refresh=${refresh}`
if (currentExe) {
url += `&executeCount=${currentExe}`
}
return window.fetch(url, {
method: 'post'
}).then((response) => {
const reader = response.body.getReader()
const decoder = new TextDecoder()

const readChunk = () => {
return reader.read().then(appendChunks)
}

const appendChunks = (result) => {
const chunk = decoder.decode(result.value || new Uint8Array(), {
stream: !result.done
})
if (chunk) {
callBack(chunk)
}
if (!result.done) {
readChunk()
}
}

readChunk()
})
},

getMacSysVersion () {
return request.get(`${MACOS_API_URL_PREFIX}/user/systemVersions/v2`)
},
Expand Down
8 changes: 6 additions & 2 deletions src/frontend/locale/pipeline/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@
"downloadLog": "Download Log",
"hideDebugLog": "Hide Debug Log",
"showDebugLog": "Show Debug Log",
"successPraise": "Like Success",
"successDownPraise": "Down Like Success",
"successCancelPraise": "Cancel Like",
"successCancelDownPraise": "Cancel Down Like",
"stageReview": {
"stageInConditions": "Stage-In conditions",
"approvalFlow": "Approval flow",
Expand Down Expand Up @@ -601,7 +605,7 @@
"downloading": "Downloading ",
"copySuc": " Copy {0} to custom artifactory successfully",
"buildMsg": "Build Message"
},
},
"preview": {
"build": "Build",
"introVersion": "Recommended Version",
Expand Down Expand Up @@ -1578,4 +1582,4 @@
"debugHint": "Debugging and execution do not share build numbers, but they share concurrency control. Debug records are only valid during the draft version debugging period and will be automatically cleared after the version is released.",
"templateRollbackBackTips": "The current pipeline is in constraint mode (template instance). You need to jump to the template to roll back the version.",
"versionNotMatch": "The current version is not the latest version and cannot be executed"
}
}
4 changes: 4 additions & 0 deletions src/frontend/locale/pipeline/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@
"downloadLog": "下载日志",
"hideDebugLog": "隐藏调试日志",
"showDebugLog": "展示调试日志",
"successPraise": "已赞",
"successDownPraise": "已踩",
"successCancelPraise": "取消赞",
"successCancelDownPraise": "取消踩",
"stageReview": {
"stageInConditions": "准入规则",
"approvalFlow": "审核流",
Expand Down
Loading
Loading