Browse Source

Merge pull request 'zhengxx' (#214) from openioctopus/octopus:zhengxx into master

Reviewed-on: #214
master
liwei03 1 week ago
parent
commit
601361768c
25 changed files with 493 additions and 156 deletions
  1. +6
    -8
      admin-portal/src/error/index.js
  2. +4
    -7
      admin-portal/src/views/dataManager/components/preDatasetCreation.vue
  3. +2
    -2
      admin-portal/src/views/dataManager/datasetConfig.vue
  4. +1
    -1
      admin-portal/src/views/dataManager/templateList.vue
  5. +1
    -1
      admin-portal/src/views/dataManager/userList.vue
  6. +4
    -9
      admin-portal/src/views/devManager/components/algorithm/preAlgorithmCreation.vue
  7. +1
    -1
      admin-portal/src/views/devManager/components/algorithm/templateList.vue
  8. +1
    -1
      admin-portal/src/views/devManager/components/algorithm/userList.vue
  9. +4
    -11
      openai-portal/src/views/dataManager/components/myDatasetCreation.vue
  10. +3
    -3
      openai-portal/src/views/dataManager/myList.vue
  11. +3
    -3
      openai-portal/src/views/dataManager/presetList.vue
  12. +3
    -3
      openai-portal/src/views/dataManager/publicList.vue
  13. +6
    -11
      openai-portal/src/views/modelDev/components/algorithm/myAlgorithmCreation.vue
  14. +45
    -13
      server/admin-server/api/v1/algorithm.proto
  15. +35
    -2
      server/admin-server/api/v1/dataset.proto
  16. +39
    -0
      server/admin-server/internal/service/algorithm.go
  17. +37
    -0
      server/admin-server/internal/service/dataset.go
  18. +13
    -9
      server/base-server/api/v1/algorithm.proto
  19. +13
    -7
      server/base-server/api/v1/dataset.proto
  20. +51
    -34
      server/base-server/internal/service/algorithm/handle.go
  21. +29
    -15
      server/base-server/internal/service/dataset/dataset.go
  22. +41
    -11
      server/openai-server/api/v1/algorithm.proto
  23. +35
    -2
      server/openai-server/api/v1/dataset.proto
  24. +49
    -2
      server/openai-server/internal/service/algorithm.go
  25. +67
    -0
      server/openai-server/internal/service/dataset.go

+ 6
- 8
admin-portal/src/error/index.js View File

@@ -164,13 +164,6 @@ const error = {
19003: '没有权限操作',
19004: ' 数据集重复',
19005: '状态不允许操作',
19502: '标签名重复',
12012: '算法类型被引用',
12013: '算法框架被引用',
12014: '算法类型重复',
12015: '算法框架重复',
19006: '数据集类型被引用',
19007: '数据集类型重复',

/* 20001-21000 第三方平台管理错误*/
20001: '平台名称重复',
@@ -182,7 +175,12 @@ const error = {

/* 21001-22000 云际错误*/
21001: '云际请求失败',
21002: '无权限访问'
21002: '无权限访问',
// 标签错误发
19501: '标签被引用,不能删除',
19502: '标签重复',
19503: '标签不合法',
19504: '预置标签不可更改'
}
export function getErrorMsg(errorCode) {
let message = ''


+ 4
- 7
admin-portal/src/views/dataManager/components/preDatasetCreation.vue View File

@@ -7,13 +7,13 @@
<el-input v-model="ruleForm.name" :disabled="disabled" placeholder="请输入数据集名称" />
</el-form-item>
<el-form-item label="数据类型" :label-width="formLabelWidth" prop="typeId">
<el-select v-model="ruleForm.typeId" :disabled="disabled" placeholder="请选择数据类型">
<el-select v-model="ruleForm.typeId" :disabled="disabled" placeholder="请选择数据类型">
<el-option v-for="item in typeOptions" :key="item.id" :label="item.lableDesc" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="数据用途" :label-width="formLabelWidth" prop="typeId">
<el-select v-model="ruleForm.applyId" :disabled="disabled" placeholder="请选择数据集用途">
<el-form-item label="标注类型" :label-width="formLabelWidth">
<el-select v-model="ruleForm.applyId" :disabled="disabled" placeholder="请选择标注类型">
<el-option v-for="item in useOptions" :key="item.id" :label="item.lableDesc" :value="item.id">
</el-option>
</el-select>
@@ -68,10 +68,7 @@
{ min: 4, max: 30, message: '长度在 4 到 30 个字符', trigger: 'blur' }
],
typeId: [
{ required: true, message: '请选择数据集类型', trigger: 'change' }
],
applyId: [
{ required: true, message: '请选择数据集用途', trigger: 'change' }
{ required: true, message: '请选择数据类型', trigger: 'change' }
],
path: [
{ required: true, message: '请上传数据集', trigger: 'change' }


+ 2
- 2
admin-portal/src/views/dataManager/datasetConfig.vue View File

@@ -1,6 +1,6 @@
<template>
<div>
<div class="title">数据类型</div>
<div class="title">数据类型</div>
<div>
<el-tag v-for="(tag,index) in dynamicType" :key="index" :closable="tag.sourceType!==1"
:disable-transitions="false" @click="editTag(tag,index,'TYPE')" @close="handleClose(tag,'TYPE')">
@@ -14,7 +14,7 @@
<el-button v-else class="button-new-tag" size="small" @click="showInput('TYPE')">{{'+ 新标签'}}</el-button>
</div>
<el-divider></el-divider>
<div class="title">数据集用途</div>
<div class="title">标注类型</div>
<div>
<el-tag v-for="(tag,index) in dynamicFrame" :key="index" :closable="tag.sourceType!==1"
:disable-transitions="false" @click="editTag(tag,index,'FRAME')" @close="handleClose(tag,'FRAME')">


+ 1
- 1
admin-portal/src/views/dataManager/templateList.vue View File

@@ -33,7 +33,7 @@
<span>{{ scope.row.typeDesc }}</span>
</template>
</el-table-column>
<el-table-column label="数据用途">
<el-table-column label="标注类型">
<template slot-scope="scope">
<span>{{ scope.row.applyDesc }}</span>
</template>


+ 1
- 1
admin-portal/src/views/dataManager/userList.vue View File

@@ -25,7 +25,7 @@
<span>{{ scope.row.typeDesc }}</span>
</template>
</el-table-column>
<el-table-column label="数据用途">
<el-table-column label="标注类型">
<template slot-scope="scope">
<span>{{ scope.row.applyDesc }}</span>
</template>


+ 4
- 9
admin-portal/src/views/devManager/components/algorithm/preAlgorithmCreation.vue View File

@@ -6,14 +6,14 @@
<el-form-item label="算法名称" :label-width="formLabelWidth" prop="algorithmName">
<el-input v-model="ruleForm.algorithmName" :disabled="disabled" placeholder="请输入算法名称" />
</el-form-item>
<el-form-item label="模型类别" :label-width="formLabelWidth" prop="applyId">
<el-select v-model="ruleForm.applyId" placeholder="请选择">
<el-form-item label="模型类别" :label-width="formLabelWidth">
<el-select v-model="ruleForm.applyId" placeholder="请选择模型类别">
<el-option v-for="item in optionType" :key="item.id" :label="item.lableDesc" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="框架类型" :label-width="formLabelWidth" prop="frameworkId">
<el-select v-model="ruleForm.frameworkId" placeholder="请选择">
<el-form-item label="框架类型" :label-width="formLabelWidth" >
<el-select v-model="ruleForm.frameworkId" placeholder="请选择框架类型">
<el-option v-for="item in optionFrame" :key="item.id" :label="item.lableDesc" :value="item.id">
</el-option>
</el-select>
@@ -99,8 +99,6 @@
trigger: "blur"
}
],
applyId: [{ required: true, message: '请选择算法类型', trigger: 'change' }],
frameworkId: [{ required: true, message: '请选择算法框架', trigger: 'change' }]
},
CreateFormVisible: true,
formLabelWidth: "120px",
@@ -124,9 +122,6 @@
this.$refs[formName].validate((valid) => {
if (valid) {
const param = {
spaceId: '',
userId: null,
IsPrefab: true,
algorithmName: this.ruleForm.algorithmName,
algorithmDescript: this.ruleForm.desc,
modelname: this.ruleForm.modelName,


+ 1
- 1
admin-portal/src/views/devManager/components/algorithm/templateList.vue View File

@@ -31,7 +31,7 @@
<span>{{ scope.row.algorithmVersion }}</span>
</template>
</el-table-column>
<el-table-column label="算法类型">
<el-table-column label="模型类别">
<template slot-scope="scope">
<span>{{ scope.row.applyName }}</span>
</template>


+ 1
- 1
admin-portal/src/views/devManager/components/algorithm/userList.vue View File

@@ -23,7 +23,7 @@
<span>{{ scope.row.algorithmVersion }}</span>
</template>
</el-table-column>
<el-table-column label="算法类型">
<el-table-column label="模型类别">
<template slot-scope="scope">
<span>{{ scope.row.applyName }}</span>
</template>


+ 4
- 11
openai-portal/src/views/dataManager/components/myDatasetCreation.vue View File

@@ -6,14 +6,14 @@
<el-form-item label="数据集名称" :label-width="formLabelWidth" prop="name">
<el-input v-model="ruleForm.name" :disabled="disabled" placeholder="请输入数据集名称,长度在 4 到 30 个字符" />
</el-form-item>
<el-form-item label="数据类型" :label-width="formLabelWidth" prop="type">
<el-select v-model="ruleForm.typeId" :disabled="disabled" placeholder="请选择数据类型">
<el-form-item label="数据类型" :label-width="formLabelWidth" prop="typeId">
<el-select v-model="ruleForm.typeId" :disabled="disabled" placeholder="请选择数据类型">
<el-option v-for="item in typeOptions" :key="item.id" :label="item.lableDesc" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="数据集用途" :label-width="formLabelWidth" prop="type">
<el-select v-model="ruleForm.applyId" :disabled="disabled" placeholder="请选择数据集用途">
<el-form-item label="标注类型" :label-width="formLabelWidth">
<el-select v-model="ruleForm.applyId" :disabled="disabled" placeholder="请选择标注类型">
<el-option v-for="item in useOptions" :key="item.id" :label="item.lableDesc" :value="item.id">
</el-option>
</el-select>
@@ -77,13 +77,6 @@
trigger: "change"
}
],
applyId: [
{
required: true,
message: "请选择数据集用途",
trigger: "change"
}
],
path: [
{
required: true,


+ 3
- 3
openai-portal/src/views/dataManager/myList.vue View File

@@ -18,17 +18,17 @@
:header-cell-style="{'text-align':'left','color':'black'}"
:cell-style="{'text-align':'left'}"
>
<el-table-column label="名称">
<el-table-column label="数据集名称">
<template slot-scope="scope">
<span>{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column label="类型">
<el-table-column label="数据类型">
<template slot-scope="scope">
<span>{{ scope.row.typeDesc }}</span>
</template>
</el-table-column>
<el-table-column label="数据集用途">
<el-table-column label="标注类型">
<template slot-scope="scope">
<span>{{ scope.row.applyDesc }}</span>
</template>


+ 3
- 3
openai-portal/src/views/dataManager/presetList.vue View File

@@ -15,17 +15,17 @@
:header-cell-style="{'text-align':'left','color':'black'}"
:cell-style="{'text-align':'left'}"
>
<el-table-column label="名称">
<el-table-column label="数据集名称">
<template slot-scope="scope">
<span>{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column label="类型">
<el-table-column label="数据类型">
<template slot-scope="scope">
<span>{{ scope.row.typeDesc }}</span>
</template>
</el-table-column>
<el-table-column label="数据集用途">
<el-table-column label="标注类型">
<template slot-scope="scope">
<span>{{ scope.row.applyDesc }}</span>
</template>


+ 3
- 3
openai-portal/src/views/dataManager/publicList.vue View File

@@ -15,17 +15,17 @@
:header-cell-style="{'text-align':'left','color':'black'}"
:cell-style="{'text-align':'left'}"
>
<el-table-column label="名称">
<el-table-column label="数据集名称">
<template slot-scope="scope">
<span>{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column label="类型">
<el-table-column label="数据类型">
<template slot-scope="scope">
<span>{{ scope.row.typeDesc }}</span>
</template>
</el-table-column>
<el-table-column label="数据集用途">
<el-table-column label="标注类型">
<template slot-scope="scope">
<span>{{ scope.row.applyDesc }}</span>
</template>


+ 6
- 11
openai-portal/src/views/modelDev/components/algorithm/myAlgorithmCreation.vue View File

@@ -6,14 +6,14 @@
<el-form-item label="算法名称" :label-width="formLabelWidth" prop="algorithmName">
<el-input v-model="ruleForm.algorithmName" :disabled="disabled" placeholder="请输入算法名称" />
</el-form-item>
<el-form-item label="算法类型" :label-width="formLabelWidth" prop="applyId">
<el-select v-model="ruleForm.applyId" placeholder="请选择">
<el-form-item label="模型类别" :label-width="formLabelWidth">
<el-select v-model="ruleForm.applyId" placeholder="请选择模型类别">
<el-option v-for="item in optionType" :key="item.id" :label="item.lableDesc" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="算法框架" :label-width="formLabelWidth" prop="frameworkId">
<el-select v-model="ruleForm.frameworkId" placeholder="请选择">
<el-form-item label="算法框架" :label-width="formLabelWidth" >
<el-select v-model="ruleForm.frameworkId" placeholder="请选择算法框架">
<el-option v-for="item in optionFrame" :key="item.id" :label="item.lableDesc" :value="item.id">
</el-option>
</el-select>
@@ -103,9 +103,7 @@
message: "长度在 4 到 30 个字符",
trigger: "blur"
}
],
applyId: [{ required: true, message: '请选择算法类型', trigger: 'change' }],
frameworkId: [{ required: true, message: '请选择算法框架', trigger: 'change' }]
]
},
CreateFormVisible: true,
formLabelWidth: "120px",
@@ -133,10 +131,7 @@
nextStep(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
const param = {
spaceId: '',
userId: null,
IsPrefab: false,
const param = {
algorithmName: this.ruleForm.algorithmName,
algorithmDescript: this.ruleForm.desc,
modelName: this.ruleForm.modelName,


+ 45
- 13
server/admin-server/api/v1/algorithm.proto View File

@@ -133,6 +133,22 @@ service Algorithm {
};
};

// 修改预置算法
rpc UpdatePreAlgorithm(UpdatePreAlgorithmRequest) returns (UpdatePreAlgorithmReply) {
option (google.api.http) = {
put: "/v1/algorithmmanage/prealgorithm/{algorithmId}"
body: "*"
};
};

// 修改预置算法版本
rpc UpdatePreAlgorithmVersion(UpdatePreAlgorithmVersionRequest) returns (UpdatePreAlgorithmVersionReply) {
option (google.api.http) = {
put: "/v1/algorithmmanage/prealgorithm/{algorithmId}/version/{version}"
body: "*"
};
};

// 上传预置算法
rpc UploadPreAlgorithm(UploadPreAlgorithmRequest) returns (UploadPreAlgorithmReply) {
option (google.api.http) = {
@@ -317,21 +333,38 @@ message DeletePreAlgorithmReply {
}

message AddAlgorithmRequest {
string spaceId = 1;
string userId = 2;
bool isPrefab = 3;
bool isEmpty = 4;
string algorithmName = 5[(validate.rules).string = {min_len:1,max_len:128}];
string modelName = 6[(validate.rules).string = {min_len:1,max_len:128}];
string algorithmDescript = 7;
string applyId = 8;
string frameworkId = 9;
bool isEmpty = 1;
string algorithmName = 2[(validate.rules).string = {min_len:1,max_len:128}];
string modelName = 3[(validate.rules).string = {min_len:1,max_len:128}];
string algorithmDescript = 4;
string applyId = 5;
string frameworkId = 6;
}
message AddAlgorithmReply {
string algorithmId = 1;
string version = 2;
int64 createdAt = 3;
}

message UpdatePreAlgorithmRequest {
string algorithmId = 1[(validate.rules).string = {len:32,pattern:"^[A-Za-z0-9]+$"}];
string algorithmDescript = 2;
string applyId = 3;
string frameworkId = 4;
}
message UpdatePreAlgorithmReply {
int64 updatedAt = 1;
}

message UpdatePreAlgorithmVersionRequest {
string algorithmId = 1[(validate.rules).string = {len:32,pattern:"^[A-Za-z0-9]+$"}];
string version = 2[(validate.rules).string = {min_len:2,pattern:"^V[0-9]+$"}];
string algorithmDescript = 3;
}
message UpdatePreAlgorithmVersionReply {
int64 updatedAt = 1;
}

message UploadPreAlgorithmRequest {
string algorithmId = 1[(validate.rules).string = {len:32,pattern:"^[A-Za-z0-9]+$"}];
string version = 2[(validate.rules).string = {min_len:2,pattern:"^V[0-9]+$"}];
@@ -341,6 +374,7 @@ message UploadPreAlgorithmRequest {
message UploadPreAlgorithmReply {
string uploadUrl = 1;
}

message ConfirmUploadPreAlgorithmRequest {
string algorithmId = 1;
string version = 2[(validate.rules).string = {min_len:2,pattern:"^V[0-9]+$"}];
@@ -369,10 +403,8 @@ message DownloadAlgorithmVersionReply {
}

message AddPreAlgorithmVersionRequest {
string spaceId = 1;
string userId = 2;
string algorithmId = 3;
string algorithmDescript = 4;
string algorithmId = 1;
string algorithmDescript = 2;
}
message AddPreAlgorithmVersionReply {
string algorithmId = 1;


+ 35
- 2
server/admin-server/api/v1/dataset.proto View File

@@ -128,6 +128,18 @@ service DatasetService {
get: "/v1/datasetmanage/dataset/{datasetId}/version/{version}/file"
};
}
// 修改预置数据集
rpc UpdatePreDataset (UpdatePreDatasetRequest) returns (UpdatePreDatasetReply) {
option (google.api.http) = {
put: "/v1/datasetmanage/predataset/{datasetId}"
};
}
// 修改预置数据集版本
rpc UpdatePreDatasetVersion (UpdatePreDatasetVersionRequest) returns (UpdatePreDatasetVersionReply) {
option (google.api.http) = {
put: "/v1/datasetmanage/predataset/{datasetId}/version/{version}"
};
}
}

message DatasetLable {
@@ -208,8 +220,8 @@ message UpdateDatasetApplyReply {

message CreateDatasetRequest {
string name = 1[(validate.rules).string = {min_len: 1, max_len: 30}];
string typeId = 2[(validate.rules).string = {min_len: 1 max_len: 64}];
string applyId = 3[(validate.rules).string = {min_len: 1 max_len: 64}];
string typeId = 2;
string applyId = 3;
string desc = 4[(validate.rules).string = {max_len: 300}];
}

@@ -352,3 +364,24 @@ message ListDatasetVersionFileReply {
}
repeated File files = 1;
}

message UpdatePreDatasetRequest {
string datasetId = 1[(validate.rules).string = {min_len: 1}];
string typeId = 2;
string applyId = 3;
string desc = 4[(validate.rules).string = {max_len: 300}];
}

message UpdatePreDatasetReply {
int64 updatedAt = 1;
}

message UpdatePreDatasetVersionRequest {
string datasetId = 1[(validate.rules).string = {min_len: 1}];
string version = 2[(validate.rules).string = {min_len: 1}];
string desc = 5[(validate.rules).string = {max_len: 300}];
}

message UpdatePreDatasetVersionReply {
int64 updatedAt = 1;
}

+ 39
- 0
server/admin-server/internal/service/algorithm.go View File

@@ -373,6 +373,45 @@ func (s *AlgorithmService) AddPreAlgorithm(ctx context.Context, req *api.AddAlgo
}, nil
}

// 修改预置算法
func (s *AlgorithmService) UpdatePreAlgorithm(ctx context.Context, req *api.UpdatePreAlgorithmRequest) (*api.UpdatePreAlgorithmReply, error) {
reply, err := s.data.AlgorithmClient.UpdateAlgorithm(ctx, &innterapi.UpdateAlgorithmRequest{
SpaceId: "",
UserId: "",
IsPrefab: true,
AlgorithmId: req.AlgorithmId,
AlgorithmDescript: req.AlgorithmDescript,
ApplyId: req.ApplyId,
FrameworkId: req.FrameworkId,
})
if err != nil {
return nil, err
}

return &api.UpdatePreAlgorithmReply{
UpdatedAt: reply.UpdatedAt,
}, nil
}

// 修改预置算法版本
func (s *AlgorithmService) UpdatePreAlgorithmVersion(ctx context.Context, req *api.UpdatePreAlgorithmVersionRequest) (*api.UpdatePreAlgorithmVersionReply, error) {
reply, err := s.data.AlgorithmClient.UpdateAlgorithmVersion(ctx, &innterapi.UpdateAlgorithmVersionRequest{
SpaceId: "",
UserId: "",
AlgorithmId: req.AlgorithmId,
Version: req.Version,
IsPrefab: true,
AlgorithmDescript: req.AlgorithmDescript,
})
if err != nil {
return nil, err
}

return &api.UpdatePreAlgorithmVersionReply{
UpdatedAt: reply.UpdatedAt,
}, nil
}

// 上传算法
func (s *AlgorithmService) UploadPreAlgorithm(ctx context.Context, req *api.UploadPreAlgorithmRequest) (*api.UploadPreAlgorithmReply, error) {



+ 37
- 0
server/admin-server/internal/service/dataset.go View File

@@ -351,6 +351,43 @@ func (s *DatasetService) ListDatasetVersionFile(ctx context.Context, req *api.Li
return reply, nil
}

func (s *DatasetService) UpdatePreDataset(ctx context.Context, req *api.UpdatePreDatasetRequest) (*api.UpdatePreDatasetReply, error) {
reply, err := s.data.DatasetClient.UpdateDataset(ctx, &innerapi.UpdateDatasetRequest{
SpaceId: "",
UserId: "",
Id: req.DatasetId,
SourceType: innerapi.DatasetSourceType_DST_PRE,
TypeId: req.TypeId,
ApplyId: req.ApplyId,
Desc: req.Desc,
})
if err != nil {
return nil, err
}

return &api.UpdatePreDatasetReply{
UpdatedAt: reply.UpdatedAt,
}, nil
}

func (s *DatasetService) UpdatePreDatasetVersion(ctx context.Context, req *api.UpdatePreDatasetVersionRequest) (*api.UpdatePreDatasetVersionReply, error) {
reply, err := s.data.DatasetClient.UpdateDatasetVersion(ctx, &innerapi.UpdateDatasetVersionRequest{
SpaceId: "",
UserId: "",
DatasetId: req.DatasetId,
Version: req.Version,
SourceType: innerapi.DatasetSourceType_DST_PRE,
Desc: req.Desc,
})
if err != nil {
return nil, err
}

return &api.UpdatePreDatasetVersionReply{
UpdatedAt: reply.UpdatedAt,
}, nil
}

func (s *DatasetService) assignValue(ctx context.Context, datasets []*api.Dataset) error {
if len(datasets) > 0 {
userIdMap := map[string]interface{}{}


+ 13
- 9
server/base-server/api/v1/algorithm.proto View File

@@ -300,8 +300,6 @@ message CopyAlgorithmVersionRequest {
string newAlgorithmName = 5[(validate.rules).string = {min_len:1,max_len:128}];
string modelName = 6[(validate.rules).string = {min_len:1,max_len:128}];
string algorithmDescript = 7[(validate.rules).string = {max_len: 300}];
string applyId = 8;
string frameworkId = 9;
}
message CopyAlgorithmVersionReply {
string newAlgorithmId = 1;
@@ -321,10 +319,13 @@ message ConfirmUploadAlgorithmReply {
}

message UpdateAlgorithmRequest {
string id = 1[(validate.rules).string = {min_len: 1}];
string applyId = 2;
string frameworkId = 3;
string algorithmDescript = 4[(validate.rules).string = {max_len: 300}];
string spaceId = 1;
string userId = 2;
bool IsPrefab = 3;
string algorithmId = 4[(validate.rules).string = {min_len:1,max_len:32,pattern:"^[A-Za-z0-9]+$"}];
string applyId = 5;
string frameworkId = 6;
string algorithmDescript = 7[(validate.rules).string = {max_len: 300}];
}

message UpdateAlgorithmReply {
@@ -402,9 +403,12 @@ message DeletePreAlgorithmReply {
}

message UpdateAlgorithmVersionRequest {
string algorithmId = 1[(validate.rules).string = {min_len:1,max_len:32,pattern:"^[A-Za-z0-9]+$"}];
string version = 2[(validate.rules).string = {min_len:2,pattern:"^V[0-9]+$"}];
string algorithmDescript = 3[(validate.rules).string = {max_len: 300}];
string spaceId = 1;
string userId = 2;
bool IsPrefab = 3;
string algorithmId = 4[(validate.rules).string = {min_len:1,max_len:32,pattern:"^[A-Za-z0-9]+$"}];
string version = 5[(validate.rules).string = {min_len:2,pattern:"^V[0-9]+$"}];
string algorithmDescript = 6[(validate.rules).string = {max_len: 300}];
}

message UpdateAlgorithmVersionReply {


+ 13
- 7
server/base-server/api/v1/dataset.proto View File

@@ -192,10 +192,13 @@ message DeleteDatasetReply {
}

message UpdateDatasetRequest {
string id = 1[(validate.rules).string = {min_len: 1}];
string typeId = 2;
string applyId = 3;
string desc = 4[(validate.rules).string = {max_len: 300}];
string spaceId = 1;
string userId = 2;
string id = 3[(validate.rules).string = {min_len: 1}];
DatasetSourceType sourceType = 4;
string typeId = 5;
string applyId = 6;
string desc = 7[(validate.rules).string = {max_len: 300}];
}

message UpdateDatasetReply {
@@ -274,9 +277,12 @@ message ListDatasetVersionFileReply {
}

message UpdateDatasetVersionRequest {
string datasetId = 1[(validate.rules).string = {min_len: 1}];
string version = 2[(validate.rules).string = {min_len: 1}];
string desc = 3[(validate.rules).string = {max_len: 300}];
string spaceId = 1;
string userId = 2;
string datasetId = 3[(validate.rules).string = {min_len: 1}];
string version = 4[(validate.rules).string = {min_len: 1}];
DatasetSourceType sourceType = 5;
string desc = 6[(validate.rules).string = {max_len: 300}];
}

message UpdateDatasetVersionReply {


+ 51
- 34
server/base-server/internal/service/algorithm/handle.go View File

@@ -804,17 +804,6 @@ func (h *algorithmHandle) AddAlgorithmHandle(ctx context.Context, req *api.AddAl
fileStatus = FILESTATUS_FINISH
}

// 检查数据类型id
algorithmApply, err := h.lableService.GetLable(ctx, &api.GetLableRequest{Id: req.ApplyId})
if err != nil {
return nil, err
}
// 检查框架id
algorithmFramework, err := h.lableService.GetLable(ctx, &api.GetLableRequest{Id: req.FrameworkId})
if err != nil {
return nil, err
}

myAlgorithm, err := algorithmDao.AddAlgorithm(ctx, &model.Algorithm{
AlgorithmId: algorithmId,
SpaceId: req.SpaceId,
@@ -839,10 +828,24 @@ func (h *algorithmHandle) AddAlgorithmHandle(ctx context.Context, req *api.AddAl
return nil, err
}

// 新增算法类型引用
_, _ = h.lableService.IncreaseLableReferTimes(ctx, &api.IncreaseLableReferTimesRequest{Id: algorithmApply.Lable.Id})
// 新增算法框架引用
_, _ = h.lableService.IncreaseLableReferTimes(ctx, &api.IncreaseLableReferTimesRequest{Id: algorithmFramework.Lable.Id})
// 检查数据类型id
if req.ApplyId != "" {
algorithmApply, err := h.lableService.GetLable(ctx, &api.GetLableRequest{Id: req.ApplyId})
if err != nil {
return nil, err
}
// 新增算法类型引用
_, _ = h.lableService.IncreaseLableReferTimes(ctx, &api.IncreaseLableReferTimesRequest{Id: algorithmApply.Lable.Id})
}
// 检查框架id
if req.FrameworkId != "" {
algorithmFramework, err := h.lableService.GetLable(ctx, &api.GetLableRequest{Id: req.FrameworkId})
if err != nil {
return nil, err
}
// 新增算法框架引用
_, _ = h.lableService.IncreaseLableReferTimes(ctx, &api.IncreaseLableReferTimesRequest{Id: algorithmFramework.Lable.Id})
}

return &api.AddAlgorithmReply{
AlgorithmId: myAlgorithm.AlgorithmId,
@@ -988,10 +991,13 @@ func (h *algorithmHandle) ConfirmUploadAlgorithmHandle(ctx context.Context, req
// 修改算法
func (h *algorithmHandle) UpdateAlgorithmHandle(ctx context.Context, req *api.UpdateAlgorithmRequest) (*api.UpdateAlgorithmReply, error) {
algorithmDao := h.data.AlgorithmDao
algorithm, err := algorithmDao.QueryAlgorithm(ctx, &model.AlgorithmQuery{AlgorithmId: req.Id})
algorithm, err := algorithmDao.QueryAlgorithm(ctx, &model.AlgorithmQuery{AlgorithmId: req.AlgorithmId})
if err != nil {
return nil, err
}
if algorithm.SpaceId != req.SpaceId || algorithm.UserId != algorithm.UserId || algorithm.IsPrefab != req.IsPrefab {
return nil, errors.Errorf(nil, errors.ErrorFindAlgorithmAuthWrong)
}

// 减少算法类型引用
_, _ = h.lableService.ReduceLableReferTimes(ctx, &api.ReduceLableReferTimesRequest{Id: algorithm.ApplyId})
@@ -1397,9 +1403,17 @@ func (h *algorithmHandle) DeletePreAlgorithmHandle(ctx context.Context, req *api
}, nil
}

// 修改算法
// 修改算法版本
func (h *algorithmHandle) UpdateAlgorithmVersionHandle(ctx context.Context, req *api.UpdateAlgorithmVersionRequest) (*api.UpdateAlgorithmVersionReply, error) {
algorithmDao := h.data.AlgorithmDao
algorithm, err := algorithmDao.QueryAlgorithm(ctx, &model.AlgorithmQuery{AlgorithmId: req.AlgorithmId})
if err != nil {
return nil, err
}
if algorithm.SpaceId != req.SpaceId || algorithm.UserId != algorithm.UserId || algorithm.IsPrefab != req.IsPrefab {
return nil, errors.Errorf(nil, errors.ErrorFindAlgorithmAuthWrong)
}

algorithmVersion, err := algorithmDao.QueryAlgorithmVersion(ctx, &model.AlgorithmVersionQuery{AlgorithmId: req.AlgorithmId, Version: req.Version})
if err != nil {
return nil, err
@@ -1586,17 +1600,6 @@ func (h *algorithmHandle) CopyAlgorithmVersionHandle(ctx context.Context, req *a
return nil, err
}

// 检查数据类型id
algorithmApply, err := h.lableService.GetLable(ctx, &api.GetLableRequest{Id: req.ApplyId})
if err != nil {
return nil, err
}
// 检查框架id
algorithmFramework, err := h.lableService.GetLable(ctx, &api.GetLableRequest{Id: req.FrameworkId})
if err != nil {
return nil, err
}

algorithmId := utils.GetUUIDWithoutSeparator()
algorithmVersionId := utils.GetUUIDWithoutSeparator()
algorithmVersion := common.VersionStrBuild(1)
@@ -1609,8 +1612,8 @@ func (h *algorithmHandle) CopyAlgorithmVersionHandle(ctx context.Context, req *a
AlgorithmDescript: req.AlgorithmDescript,
ModelName: req.ModelName,
LatestVersion: algorithmVersion,
ApplyId: req.ApplyId,
FrameworkId: req.FrameworkId,
ApplyId: oriAlgorithm.ApplyId,
FrameworkId: oriAlgorithm.FrameworkId,
AlgorithmVersions: []*model.AlgorithmVersion{
{
Id: algorithmVersionId,
@@ -1624,10 +1627,24 @@ func (h *algorithmHandle) CopyAlgorithmVersionHandle(ctx context.Context, req *a
return nil, err
}

// 新增算法类型引用
_, _ = h.lableService.IncreaseLableReferTimes(ctx, &api.IncreaseLableReferTimesRequest{Id: algorithmApply.Lable.Id})
// 新增算法框架引用
_, _ = h.lableService.IncreaseLableReferTimes(ctx, &api.IncreaseLableReferTimesRequest{Id: algorithmFramework.Lable.Id})
// 检查数据类型id
if oriAlgorithm.ApplyId != "" {
algorithmApply, err := h.lableService.GetLable(ctx, &api.GetLableRequest{Id: oriAlgorithm.ApplyId})
if err != nil {
return nil, err
}
// 新增算法类型引用
_, _ = h.lableService.IncreaseLableReferTimes(ctx, &api.IncreaseLableReferTimesRequest{Id: algorithmApply.Lable.Id})
}
// 检查框架id
if oriAlgorithm.FrameworkId != "" {
algorithmFramework, err := h.lableService.GetLable(ctx, &api.GetLableRequest{Id: oriAlgorithm.FrameworkId})
if err != nil {
return nil, err
}
// 新增算法框架引用
_, _ = h.lableService.IncreaseLableReferTimes(ctx, &api.IncreaseLableReferTimesRequest{Id: algorithmFramework.Lable.Id})
}

fromBucektName := ""
fromObjectName := ""


+ 29
- 15
server/base-server/internal/service/dataset/dataset.go View File

@@ -69,17 +69,6 @@ func (s *datasetService) CreateDataset(ctx context.Context, req *api.CreateDatas
return nil, errors.Errorf(nil, errors.ErrorDatasetRepeat)
}

// 检查数据类型id
datasetType, err := s.lableService.GetLable(ctx, &api.GetLableRequest{Id: req.TypeId})
if err != nil {
return nil, err
}
// 检查数据用途id
datasetApply, err := s.lableService.GetLable(ctx, &api.GetLableRequest{Id: req.ApplyId})
if err != nil {
return nil, err
}

err = s.data.DatasetDao.CreateDataset(ctx, dataset)
if err != nil {
return nil, err
@@ -99,10 +88,24 @@ func (s *datasetService) CreateDataset(ctx context.Context, req *api.CreateDatas
return nil, err
}

// 新增数据类型引用
_, _ = s.lableService.IncreaseLableReferTimes(ctx, &api.IncreaseLableReferTimesRequest{Id: datasetType.Lable.Id})
// 新增数据用途引用
_, _ = s.lableService.IncreaseLableReferTimes(ctx, &api.IncreaseLableReferTimesRequest{Id: datasetApply.Lable.Id})
// 检查数据类型id
if req.TypeId != "" {
datasetType, err := s.lableService.GetLable(ctx, &api.GetLableRequest{Id: req.TypeId})
if err != nil {
return nil, err
}
// 新增数据类型引用
_, _ = s.lableService.IncreaseLableReferTimes(ctx, &api.IncreaseLableReferTimesRequest{Id: datasetType.Lable.Id})
}
// 检查数据用途id
if req.ApplyId != "" {
datasetApply, err := s.lableService.GetLable(ctx, &api.GetLableRequest{Id: req.ApplyId})
if err != nil {
return nil, err
}
// 新增数据用途引用
_, _ = s.lableService.IncreaseLableReferTimes(ctx, &api.IncreaseLableReferTimesRequest{Id: datasetApply.Lable.Id})
}

return &api.CreateDatasetReply{
Id: datasetId,
@@ -594,6 +597,9 @@ func (s *datasetService) UpdateDataset(ctx context.Context, req *api.UpdateDatas
if err != nil {
return nil, err
}
if dataset.SpaceId != req.SpaceId || dataset.UserId != req.UserId || dataset.SourceType != int(req.SourceType) {
return nil, errors.Errorf(nil, errors.ErrorDatasetNoPermission)
}

// 减小数据类型引用
_, _ = s.lableService.ReduceLableReferTimes(ctx, &api.ReduceLableReferTimesRequest{Id: dataset.TypeId})
@@ -713,6 +719,14 @@ func (s *datasetService) ListDatasetVersionFile(ctx context.Context, req *api.Li
}

func (s *datasetService) UpdateDatasetVersion(ctx context.Context, req *api.UpdateDatasetVersionRequest) (*api.UpdateDatasetVersionReply, error) {
dataset, err := s.data.DatasetDao.GetDataset(ctx, req.DatasetId)
if err != nil {
return nil, err
}
if dataset.SpaceId != req.SpaceId || dataset.UserId != req.UserId || dataset.SourceType != int(req.SourceType) {
return nil, errors.Errorf(nil, errors.ErrorDatasetNoPermission)
}

version, err := s.data.DatasetDao.GetDatasetVersion(ctx, req.DatasetId, req.Version)
if err != nil {
return nil, err


+ 41
- 11
server/openai-server/api/v1/algorithm.proto View File

@@ -152,6 +152,22 @@ service Algorithm {
body: "*"
};
}

// 修改我的算法
rpc UpdateMyAlgorithm(UpdateMyAlgorithmRequest) returns (UpdateMyAlgorithmReply) {
option (google.api.http) = {
put: "/v1/algorithmmanage/myalgorithm/{algorithmId}"
body: "*"
};
};

// 修改我的算法版本
rpc UpdateMyAlgorithmVersion(UpdateMyAlgorithmVersionRequest) returns (UpdateMyAlgorithmVersionReply) {
option (google.api.http) = {
put: "/v1/algorithmmanage/myalgorithm/{algorithmId}/version/{version}"
body: "*"
};
};
}

message AlgorithmLable {
@@ -336,8 +352,6 @@ message CopyAlgorithmVersionRequest {
string newAlgorithmName = 3[(validate.rules).string = {min_len:1,max_len:128}];
string modelName = 4[(validate.rules).string = {min_len:1,max_len:128}];
string algorithmDescript = 5;
string applyId = 6;
string frameworkId = 7;
}
message CopyAlgorithmVersionReply {
string newAlgorithmId = 1;
@@ -346,15 +360,12 @@ message CopyAlgorithmVersionReply {
}

message AddMyAlgorithmRequest {
string spaceId = 1;
string userId = 2;
bool isPrefab = 3;
bool isEmpty = 4;
string algorithmName = 5[(validate.rules).string = {min_len:1,max_len:128}];
string modelName = 6[(validate.rules).string = {min_len:1,max_len:128}];
string algorithmDescript = 7;
string applyId = 8;
string frameworkId = 9;
bool isEmpty = 1;
string algorithmName = 2[(validate.rules).string = {min_len:1,max_len:128}];
string modelName = 3[(validate.rules).string = {min_len:1,max_len:128}];
string algorithmDescript = 4;
string applyId = 5;
string frameworkId = 6;
}
message AddMyAlgorithmReply {
string algorithmId = 1;
@@ -414,4 +425,23 @@ message BatchQueryAlgorithmRequest {
message BatchQueryAlgorithmReply {
int64 totalSize = 1;
repeated AlgorithmInfo algorithms = 2;
}

message UpdateMyAlgorithmRequest {
string algorithmId = 1[(validate.rules).string = {len:32,pattern:"^[A-Za-z0-9]+$"}];
string algorithmDescript = 2;
string applyId = 3;
string frameworkId = 4;
}
message UpdateMyAlgorithmReply {
int64 updatedAt = 1;
}

message UpdateMyAlgorithmVersionRequest {
string algorithmId = 1[(validate.rules).string = {len:32,pattern:"^[A-Za-z0-9]+$"}];
string version = 2[(validate.rules).string = {min_len:2,pattern:"^V[0-9]+$"}];
string algorithmDescript = 3;
}
message UpdateMyAlgorithmVersionReply {
int64 updatedAt = 1;
}

+ 35
- 2
server/openai-server/api/v1/dataset.proto View File

@@ -108,6 +108,18 @@ service DatasetService {
get: "/v1/datasetmanage/dataset/{datasetId}/version/{version}/file"
};
}
// 修改我的数据集
rpc UpdatePreDataset (UpdateMyDatasetRequest) returns (UpdateMyDatasetReply) {
option (google.api.http) = {
put: "/v1/datasetmanage/mydataset/{datasetId}"
};
}
// 修改我的数据集版本
rpc UpdatePreDatasetVersion (UpdateMyDatasetVersionRequest) returns (UpdateMyDatasetVersionReply) {
option (google.api.http) = {
put: "/v1/datasetmanage/mydataset/{datasetId}/version/{version}"
};
}
}

message DatasetLable {
@@ -138,8 +150,8 @@ message ListDatasetApplyReply {

message CreateDatasetRequest {
string name = 1[(validate.rules).string = {min_len: 1, max_len: 30}];
string typeId = 2[(validate.rules).string = {min_len: 1, max_len: 64}];
string applyId = 3[(validate.rules).string = {min_len: 1, max_len: 64}];
string typeId = 2;
string applyId = 3;
string desc = 4[(validate.rules).string = {max_len: 300}];
}

@@ -316,3 +328,24 @@ message ListDatasetVersionFileReply {
}
repeated File files = 1;
}

message UpdateMyDatasetRequest {
string datasetId = 1[(validate.rules).string = {min_len: 1}];
string typeId = 2;
string applyId = 3;
string desc = 4[(validate.rules).string = {max_len: 300}];
}

message UpdateMyDatasetReply {
int64 updatedAt = 1;
}

message UpdateMyDatasetVersionRequest {
string datasetId = 1[(validate.rules).string = {min_len: 1}];
string version = 2[(validate.rules).string = {min_len: 1}];
string desc = 5[(validate.rules).string = {max_len: 300}];
}

message UpdateMyDatasetVersionReply {
int64 updatedAt = 1;
}

+ 49
- 2
server/openai-server/internal/service/algorithm.go View File

@@ -418,8 +418,6 @@ func (s *AlgorithmService) CopyAlgorithmVersion(ctx context.Context, req *api.Co
Version: req.Version,
NewAlgorithmName: req.NewAlgorithmName,
AlgorithmDescript: req.AlgorithmDescript,
ApplyId: req.ApplyId,
FrameworkId: req.FrameworkId,
})
if err != nil {
return nil, err
@@ -565,6 +563,55 @@ func (s *AlgorithmService) BatchQueryAlgorithm(ctx context.Context, req *api.Bat
}, nil
}

// 修改我的算法
func (s *AlgorithmService) UpdateMyAlgorithm(ctx context.Context, req *api.UpdateMyAlgorithmRequest) (*api.UpdateMyAlgorithmReply, error) {
userId, spaceId, err := s.getUserIdAndSpaceId(ctx)
if err != nil {
return nil, err
}

reply, err := s.data.AlgorithmClient.UpdateAlgorithm(ctx, &innterapi.UpdateAlgorithmRequest{
SpaceId: spaceId,
UserId: userId,
AlgorithmId: req.AlgorithmId,
IsPrefab: false,
AlgorithmDescript: req.AlgorithmDescript,
ApplyId: req.ApplyId,
FrameworkId: req.FrameworkId,
})
if err != nil {
return nil, err
}

return &api.UpdateMyAlgorithmReply{
UpdatedAt: reply.UpdatedAt,
}, nil
}

// 修改我的算法版本
func (s *AlgorithmService) UpdatePreAlgorithmVersion(ctx context.Context, req *api.UpdateMyAlgorithmVersionRequest) (*api.UpdateMyAlgorithmVersionReply, error) {
userId, spaceId, err := s.getUserIdAndSpaceId(ctx)
if err != nil {
return nil, err
}

reply, err := s.data.AlgorithmClient.UpdateAlgorithmVersion(ctx, &innterapi.UpdateAlgorithmVersionRequest{
SpaceId: spaceId,
UserId: userId,
IsPrefab: false,
AlgorithmId: req.AlgorithmId,
Version: req.Version,
AlgorithmDescript: req.AlgorithmDescript,
})
if err != nil {
return nil, err
}

return &api.UpdateMyAlgorithmVersionReply{
UpdatedAt: reply.UpdatedAt,
}, nil
}

func (s *AlgorithmService) algorithmInfoTransfer(algorithm *innterapi.AlgorithmInfo) *api.AlgorithmInfo {

return &api.AlgorithmInfo{


+ 67
- 0
server/openai-server/internal/service/dataset.go View File

@@ -3,9 +3,11 @@ package service
import (
"context"
innerapi "server/base-server/api/v1"
commctx "server/common/context"
"server/common/errors"
"server/common/log"
"server/common/session"
ss "server/common/session"
api "server/openai-server/api/v1"
"server/openai-server/internal/conf"
"server/openai-server/internal/data"
@@ -499,3 +501,68 @@ func (s *DatasetService) ListDatasetVersionFile(ctx context.Context, req *api.Li

return reply, nil
}

func (s *DatasetService) UpdateMyDataset(ctx context.Context, req *api.UpdateMyDatasetRequest) (*api.UpdateMyDatasetReply, error) {
userId, spaceId, err := s.getUserIdAndSpaceId(ctx)
if err != nil {
return nil, err
}

reply, err := s.data.DatasetClient.UpdateDataset(ctx, &innerapi.UpdateDatasetRequest{
SpaceId: spaceId,
UserId: userId,
Id: req.DatasetId,
SourceType: innerapi.DatasetSourceType_DST_USER,
TypeId: req.TypeId,
ApplyId: req.ApplyId,
Desc: req.Desc,
})
if err != nil {
return nil, err
}

return &api.UpdateMyDatasetReply{
UpdatedAt: reply.UpdatedAt,
}, nil
}

func (s *DatasetService) UpdateMyDatasetVersion(ctx context.Context, req *api.UpdateMyDatasetVersionRequest) (*api.UpdateMyDatasetVersionReply, error) {
userId, spaceId, err := s.getUserIdAndSpaceId(ctx)
if err != nil {
return nil, err
}

reply, err := s.data.DatasetClient.UpdateDatasetVersion(ctx, &innerapi.UpdateDatasetVersionRequest{
SpaceId: spaceId,
UserId: userId,
DatasetId: req.DatasetId,
Version: req.Version,
SourceType: innerapi.DatasetSourceType_DST_USER,
Desc: req.Desc,
})
if err != nil {
return nil, err
}

return &api.UpdateMyDatasetVersionReply{
UpdatedAt: reply.UpdatedAt,
}, nil
}

func (s *DatasetService) getUserIdAndSpaceId(ctx context.Context) (string, string, error) {
userId := commctx.UserIdFromContext(ctx)
if userId == "" {
err := errors.Errorf(nil, errors.ErrorInvalidRequestParameter)
s.log.Errorw(ctx, err)
return "", "", err
}

session := ss.SessionFromContext(ctx)
if session == nil {
err := errors.Errorf(nil, errors.ErrorUserNoAuthSession)
s.log.Errorw(ctx, err)
return "", "", err
}

return userId, session.GetWorkspace(), nil
}

Loading…
Cancel
Save