Skip to content

Commit be123f0

Browse files
committed
feat: 创建任务时下发模型的 API 类型
1 parent 40ddae6 commit be123f0

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

backend/biz/task/usecase/task.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ func (a *TaskUsecase) Create(ctx context.Context, user *domain.User, req domain.
365365
ApiKey: m.APIKey,
366366
BaseURL: m.BaseURL,
367367
Model: m.Model,
368+
ApiType: apiType(m),
368369
},
369370
Configs: configs,
370371
McpConfigs: mcps,
@@ -398,6 +399,18 @@ func (a *TaskUsecase) Create(ctx context.Context, user *domain.User, req domain.
398399
return result, nil
399400
}
400401

402+
func apiType(m *db.Model) string {
403+
if m.InterfaceType == "anthropic" {
404+
return "anthropic"
405+
}
406+
407+
if strings.HasPrefix(m.InterfaceType, "openai") {
408+
return "openai"
409+
}
410+
411+
return ""
412+
}
413+
401414
func (a *TaskUsecase) getCodingConfigs(cli consts.CliName, m *db.Model, skillIDs []string) (taskflow.CodingAgent, []taskflow.ConfigFile, error) {
402415
var tmp string
403416
var path string

backend/pkg/taskflow/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ type LLM struct {
531531
ApiKey string `json:"api_key"`
532532
BaseURL string `json:"base_url"`
533533
Model string `json:"model"`
534+
ApiType string `json:"api_type,omitempty"` // 接口类型 anthropic | openai
534535
Temperature *float32 `json:"temperature,omitempty"`
535536
}
536537

0 commit comments

Comments
 (0)