Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ make atlas-hash
Before deployment, configure AI models in `backend/conf/model/`:
1. Copy template from `backend/conf/model/template/`
2. Set `id`, `meta.conn_config.api_key`, and `meta.conn_config.model`
3. Supported providers: OpenAI, Volcengine Ark, Claude, Gemini, Qwen, DeepSeek, Ollama
3. Supported providers: OpenAI, Volcengine Ark, Claude, Gemini, Qwen, DeepSeek, MiniMax, Ollama

## Testing Strategy

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The backend of Coze Studio is developed using Golang, the frontend uses React +
## Feature list
| **Module** | **Feature** |
| --- | --- |
| Model service | Manage the model list, integrate services such as OpenAI and Volcengine |
| Model service | Manage the model list, integrate services such as OpenAI, Volcengine, Claude, DeepSeek, Gemini, Qwen, MiniMax, and Ollama |
| Build agent | * Build, publish, and manage agent <br> * Support configuring workflows, knowledge bases, and other resources |
| Build apps | * Create and publish apps <br> * Build business logic through workflows |
| Build a workflow | Create, modify, publish, and delete workflows |
Expand Down
2 changes: 1 addition & 1 deletion README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Coze Studio 的后端采用 Golang 开发,前端使用 React + TypeScript,
## 功能清单
| **功能模块** | **功能点** |
| --- | --- |
| 模型服务 | 管理模型列表,可接入OpenAI、火山方舟 等在线或离线模型服务 |
| 模型服务 | 管理模型列表,可接入 OpenAI、火山方舟、Claude、DeepSeek、Gemini、Qwen、MiniMax、Ollama 等在线或离线模型服务 |
| 搭建智能体 | * 编排、发布、管理智能体 <br> * 支持配置工作流、知识库等资源 |
| 搭建应用 | * 创建、发布应用 <br> * 通过工作流搭建业务逻辑 |
| 搭建工作流 | 创建、修改、发布、删除工作流 |
Expand Down
3 changes: 3 additions & 0 deletions backend/bizpkg/config/modelmgr/deprecate_model_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ func strProtocolToModelClass(protocol Protocol) developer_api.ModelClass {
modelClass = developer_api.ModelClass_Llama
case ProtocolQwen:
modelClass = developer_api.ModelClass_QWen
case ProtocolMiniMax:
modelClass = developer_api.ModelClass_MiniMax
default:
modelClass = developer_api.ModelClass_SEED
}
Expand Down Expand Up @@ -348,6 +350,7 @@ const (
ProtocolArk Protocol = "ark"
ProtocolOllama Protocol = "ollama"
ProtocolQwen Protocol = "qwen"
ProtocolMiniMax Protocol = "minimax"
)

type MultilingualText struct {
Expand Down
12 changes: 12 additions & 0 deletions backend/bizpkg/config/modelmgr/mode_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ func getModelProviderList() []*config.ModelProvider {
},
ModelClass: developer_api.ModelClass_QWen,
},
{
Name: &config.I18nText{
ZhCn: "MiniMax 模型",
EnUs: "MiniMax Model",
},
IconURI: "default_icon/minimax.png",
Description: &config.I18nText{
ZhCn: "MiniMax 模型家族",
EnUs: "MiniMax model family",
},
ModelClass: developer_api.ModelClass_MiniMax,
},
}
}

Expand Down
105 changes: 105 additions & 0 deletions backend/bizpkg/llm/modelbuilder/minimax.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
* Copyright 2025 coze-dev Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package modelbuilder

import (
"context"

"github.com/cloudwego/eino-ext/components/model/openai"

"github.com/coze-dev/coze-studio/backend/api/model/admin/config"
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"
)

const defaultMiniMaxBaseURL = "https://api.minimax.io/v1"

type minimaxModelBuilder struct {
cfg *config.Model
}

func newMiniMaxModelBuilder(cfg *config.Model) Service {
return &minimaxModelBuilder{
cfg: cfg,
}
}

func (m *minimaxModelBuilder) getDefaultConfig() *openai.ChatModelConfig {
return &openai.ChatModelConfig{
BaseURL: defaultMiniMaxBaseURL,
ResponseFormat: &openai.ChatCompletionResponseFormat{
Type: openai.ChatCompletionResponseFormatTypeText,
},
}
}

// clampTemperature ensures temperature stays within MiniMax's valid range (0, 1.0].
// MiniMax rejects temperature=0, so we clamp it to a small positive value.
func clampTemperature(t float32) float32 {
if t <= 0 {
return 0.01
}
if t > 1.0 {
return 1.0
}
return t
}

func (m *minimaxModelBuilder) applyParamsToConfig(conf *openai.ChatModelConfig, params *LLMParams) {
if params == nil {
return
}

if params.Temperature != nil {
clamped := clampTemperature(*params.Temperature)
conf.Temperature = ptr.Of(clamped)
}

if params.MaxTokens != 0 {
conf.MaxCompletionTokens = ptr.Of(params.MaxTokens)
}

if params.FrequencyPenalty != 0 {
conf.FrequencyPenalty = ptr.Of(params.FrequencyPenalty)
}

if params.PresencePenalty != 0 {
conf.PresencePenalty = ptr.Of(params.PresencePenalty)
}

conf.TopP = params.TopP

// MiniMax does not support response_format (JSON mode), always use text.
conf.ResponseFormat = &openai.ChatCompletionResponseFormat{
Type: openai.ChatCompletionResponseFormatTypeText,
}
}

func (m *minimaxModelBuilder) Build(ctx context.Context, params *LLMParams) (ToolCallingChatModel, error) {
base := m.cfg.Connection.BaseConnInfo

conf := m.getDefaultConfig()
conf.APIKey = base.APIKey
conf.Model = base.Model

if base.BaseURL != "" {
conf.BaseURL = base.BaseURL
}

m.applyParamsToConfig(conf, params)

return openai.NewChatModel(ctx, conf)
}
Loading