Skip to content

Commit 01892c9

Browse files
hiveerHiveerLi
and
HiveerLi
authored
Sync bug fix endpoint finetune logs (#1012)
* Update billing conditions and paths for column display and inference URL See merge request product/community/csghub-portal!592 * Merge branch 'main__bug-fix-billing-detail' into 'main' fix(BillingDetail): reorder conditions in computed See merge request product/community/csghub-portal!595 --------- Co-authored-by: HiveerLi <[email protected]>
1 parent fd49460 commit 01892c9

File tree

7 files changed

+33
-14
lines changed

7 files changed

+33
-14
lines changed

frontend/src/components/endpoints/EndpointDetail.vue

+6-4
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
const isStatusSSEConnected = ref(false)
8989
const replicaList = ref([])
9090
91-
9291
const appEndpoint = computed(() => {
9392
const endpointUrl = repoDetailStore.endpoint
9493
if (endpointUrl) {
@@ -172,11 +171,14 @@
172171
console.log(`SyncStatus: ${eventResponse.status}`)
173172
console.log(`SyncStatus: ${eventResponse.details && eventResponse.details[0].name}`)
174173
if (repoDetailStore.status !== eventResponse.status) {
175-
if (eventResponse.status == 'Running') {
176-
fetchRepoDetail()
177-
}
178174
repoDetailStore.status = eventResponse.status
175+
fetchRepoDetail()
176+
}
177+
178+
if (eventResponse.details && eventResponse.details[0].name) {
179+
repoDetailStore.activeInstance = eventResponse.details[0].name
179180
}
181+
180182
if (eventResponse.details) {
181183
replicaList.value = eventResponse.details
182184
}

frontend/src/components/endpoints/EndpointLogs.vue

+17-4
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,38 @@
2828
</template>
2929

3030
<script setup>
31-
import { ref, inject, nextTick, computed, onMounted } from 'vue'
31+
import { ref, inject, nextTick, computed, onMounted, watch } from 'vue'
3232
import refreshJWT from '../../packs/refreshJWT.js'
3333
import { fetchEventSource } from '@microsoft/fetch-event-source';
3434
import { useCookies } from "vue3-cookies";
35+
import useRepoDetailStore from '../../stores/RepoDetailStore.js'
3536
3637
const props = defineProps({
3738
instances: Array,
3839
modelId: String,
3940
deployId: Number
4041
})
4142
43+
const repoDetailStore = useRepoDetailStore()
4244
const csghubServer = inject('csghubServer')
4345
const { cookies } = useCookies()
4446
const instanceLogDiv = ref(null)
4547
const instanceLogLineNum = ref(0)
4648
const isLogsSSEConnected = ref(false)
47-
4849
const currentInstance = computed(() => {
49-
return props.instances ? props.instances[0]?.name : ''
50+
return repoDetailStore.activeInstance
51+
})
52+
53+
watch([() => props.modelId, () => props.deployId], () => {
54+
if (currentInstance.value && isLogsSSEConnected.value === false) {
55+
syncInstanceLogs(currentInstance.value)
56+
}
57+
})
58+
59+
watch(() => repoDetailStore.status, () => {
60+
if (currentInstance.value && isLogsSSEConnected.value === false) {
61+
syncInstanceLogs(currentInstance.value)
62+
}
5063
})
5164
5265
const syncInstanceLogs = (instanceName) => {
@@ -146,7 +159,7 @@
146159
}
147160
148161
onMounted(() => {
149-
if (!!currentInstance.value && isLogsSSEConnected.value === false) {
162+
if (currentInstance.value && isLogsSSEConnected.value === false) {
150163
syncInstanceLogs(currentInstance.value)
151164
}
152165
})

frontend/src/components/endpoints/EndpointSettings.vue

+2
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@
389389
const { response, error } = await useFetchApi(stopUrl).put().json()
390390
391391
if (!error.value) {
392+
// after stop, all instance will be turn off
393+
repoDetailStore.activeInstance = ''
392394
ElMessage({
393395
message: t('endpoints.settings.toggleStatusSuccess'),
394396
type: 'success'

frontend/src/components/shared/BillingDetail.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
})
138138
139139
const canFetchBillingDetail = computed(() => {
140-
return props.instanceName && userStore.uuid
140+
return userStore.uuid && props.instanceName
141141
})
142142
143143
watch(canFetchBillingDetail, (newValue) => {

frontend/src/components/shared/RepoClone.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,14 @@
242242
243243
const { actionLimited, isLoggedIn } = storeToRefs(userStore)
244244
const httpCloneUrl = computed(() => {
245-
return repoDetailStore.repository.http_clone_url
245+
return repoDetailStore.repository.http_clone_url || ""
246246
})
247247
const sshCloneUrl = computed(() => {
248248
return repoDetailStore.repository.ssh_clone_url
249249
})
250250
const httpCloneProtocol = computed(() => {
251-
const url = new URL(repoDetailStore.repository.http_clone_url)
252-
return url.protocol
251+
const url = repoDetailStore.repository.http_clone_url
252+
return url ? new URL(url).protocol : 'https'
253253
})
254254
255255
const httpsCloneCode = computed(() => {

frontend/src/components/shared/RepoHeader.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
}
249249
250250
const likesNumberDisplayName = computed(() => {
251-
const likesNumber = repoDetailStore.likes
251+
const likesNumber = repoDetailStore.likes || 0
252252
if (likesNumber > 9999) {
253253
return '1w+'
254254
} else if (likesNumber > 999) {
@@ -302,7 +302,7 @@
302302
} else if (props.repoType === 'collections') {
303303
return `/collections/${props.collectionsId}`
304304
} else {
305-
return `/${props.repoType}s/${props.path}`
305+
return `/${props.repoType}s/${props.path}`
306306
}
307307
})
308308
</script>

frontend/src/stores/RepoDetailStore.js

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const useRepoDetailStore = defineStore('repoDetail', () => {
6969
const task = ref('')
7070
const actualReplica = ref(0)
7171
const instances = ref([])
72+
const activeInstance = ref('')
7273

7374
// getters
7475
const isPrivate = computed(() => !!privateVisibility.value)
@@ -219,6 +220,7 @@ const useRepoDetailStore = defineStore('repoDetail', () => {
219220
task,
220221
actualReplica,
221222
instances,
223+
activeInstance,
222224
clearStore
223225
}
224226
}, {

0 commit comments

Comments
 (0)