Skip to content

Commit 134c9cb

Browse files
committed
list commit info
Change-Id: I8194f0db96952a81c93a032791aed3732d25ba36
1 parent d2a8b66 commit 134c9cb

File tree

4 files changed

+223
-1
lines changed

4 files changed

+223
-1
lines changed

backend/kitex_gen/coze/loop/prompt/manage/coze.loop.prompt.manage.go

Lines changed: 107 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/kitex_gen/coze/loop/prompt/manage/k-coze.loop.prompt.manage.go

Lines changed: 95 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/modules/prompt/application/manage.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,6 @@ func (app *PromptManageApplicationImpl) ListCommit(ctx context.Context, request
633633
}
634634
r.Users = convertor.BatchUserInfoDO2DTO(userDOs)
635635

636-
// 填充commit版本标签映射
637636
if len(r.PromptCommitInfos) > 0 {
638637
var commitVersions []string
639638
for _, commitInfo := range r.PromptCommitInfos {
@@ -642,6 +641,7 @@ func (app *PromptManageApplicationImpl) ListCommit(ctx context.Context, request
642641
}
643642
}
644643

644+
// 填充commit版本标签映射
645645
if len(commitVersions) > 0 {
646646
// 查询这些版本的标签映射,使用labelService
647647
commitLabelMapping, err := app.promptService.BatchGetCommitLabels(ctx, request.GetPromptID(), commitVersions)
@@ -663,6 +663,25 @@ func (app *PromptManageApplicationImpl) ListCommit(ctx context.Context, request
663663

664664
r.CommitVersionLabelMapping = commitVersionLabelMapping
665665
}
666+
// 填充被引用次数映射
667+
if len(commitVersions) > 0 {
668+
// 查询这些版本的被引用次数,使用labelService
669+
parentPromptCommitVersions, err := app.manageRepo.ListParentPrompt(ctx, repo.ListParentPromptParam{
670+
SubPromptID: request.GetPromptID(),
671+
SubPromptVersions: commitVersions,
672+
})
673+
if err != nil {
674+
return r, err
675+
}
676+
677+
// 构建版本到被引用次数的映射
678+
commitVersionReferencesMapping := make(map[string]int32)
679+
for version, parents := range parentPromptCommitVersions {
680+
commitVersionReferencesMapping[version] = int32(len(parents.CommitVersions))
681+
}
682+
683+
r.ParentReferencesMapping = commitVersionReferencesMapping
684+
}
666685
}
667686

668687
return r, nil

idl/thrift/coze/loop/prompt/coze.loop.prompt.manage.thrift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ struct ListCommitRequest {
213213
struct ListCommitResponse {
214214
1: optional list<prompt.CommitInfo> prompt_commit_infos
215215
2: optional map<string, list<prompt.Label>> commit_version_label_mapping
216+
3: optional map<string, i32> parent_references_mapping
216217

217218
11: optional list<user.UserInfoDetail> users
218219

0 commit comments

Comments
 (0)