-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 支持动态增加需要向量化访问日志的项目 #2651 * feat: 支持动态增加需要向量化访问日志的项目 #2651 * feat: 支持动态增加需要向量化访问日志的项目 #2651 * feat: 支持动态增加需要向量化访问日志的项目 #2651 * feat: 支持动态增加需要向量化访问日志的项目 #2651 * feat: 支持动态增加需要向量化访问日志的项目 #2651 * feat: 支持动态增加需要向量化访问日志的项目 #2651
- Loading branch information
Showing
2 changed files
with
150 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...biz-job/src/main/kotlin/com/tencent/bkrepo/job/controller/user/UserEmbeddingController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.tencent.bkrepo.job.controller.user | ||
|
||
import com.tencent.bkrepo.common.api.exception.ErrorCodeException | ||
import com.tencent.bkrepo.common.api.message.CommonMessageCode | ||
import com.tencent.bkrepo.common.security.permission.Principal | ||
import com.tencent.bkrepo.common.security.permission.PrincipalType | ||
import com.tencent.bkrepo.job.batch.task.cache.preload.ArtifactAccessLogEmbeddingJob | ||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor | ||
import org.springframework.web.bind.annotation.PathVariable | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/api/embedding") | ||
@Principal(type = PrincipalType.ADMIN) | ||
class UserEmbeddingController( | ||
private val artifactAccessLogEmbeddingJob: ArtifactAccessLogEmbeddingJob?, | ||
private val executor: ThreadPoolTaskExecutor, | ||
) { | ||
@PostMapping("/project/{projectId}") | ||
fun embed(@PathVariable projectId: String) { | ||
if (artifactAccessLogEmbeddingJob == null) { | ||
throw ErrorCodeException(CommonMessageCode.SYSTEM_ERROR, "unsupported operation") | ||
} | ||
executor.execute { artifactAccessLogEmbeddingJob.embedAccessLog(projectId) } | ||
} | ||
} |