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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
### 🚩 Core Function Modules

#### **1. Model Management (Model Hub)**
▸ Supports the unified access and lifecycle management of **hundreds of proprietary/open-source large models** (including GPT, Claude, Llama, etc.)
▸ Supports the unified access and lifecycle management of **hundreds of proprietary/open-source large models** (including GPT, Claude, Llama, MiniMax, etc.)

▸ Deeply adapts to **OpenAI API standards** and **Unicom Yuanjing** ecological models, realizing seamless switching of heterogeneous models

Expand Down Expand Up @@ -285,7 +285,7 @@ To help you quickly get started with this project, we strongly recommend that yo

| Feature | Detailed Description |
| :----------------------------------------------------------- | :----------------------------------------------------------- |
| [Model Management](https://github.com/UnicomAI/wanwu/blob/main/configs/microservice/bff-service/static/manual/1.%E6%A8%A1%E5%9E%8B%E7%AE%A1%E7%90%86.md) | Supports users to import LLM, Embedding, and Rerank models from various model providers, including Unicom Yuanjing, OpenAI-API-compatible, Ollama, Tongyi Qianwen, and Volcano Engine. [Model Import Methods - Detailed Version](https://github.com/UnicomAI/wanwu/blob/main/configs/microservice/bff-service/static/manual/%E6%A8%A1%E5%9E%8B%E5%AF%BC%E5%85%A5%E6%96%B9%E5%BC%8F-%E8%AF%A6%E7%BB%86%E7%89%88.md) |
| [Model Management](https://github.com/UnicomAI/wanwu/blob/main/configs/microservice/bff-service/static/manual/1.%E6%A8%A1%E5%9E%8B%E7%AE%A1%E7%90%86.md) | Supports users to import LLM, Embedding, and Rerank models from various model providers, including Unicom Yuanjing, OpenAI-API-compatible, Ollama, Tongyi Qianwen, Volcano Engine, and MiniMax. [Model Import Methods - Detailed Version](https://github.com/UnicomAI/wanwu/blob/main/configs/microservice/bff-service/static/manual/%E6%A8%A1%E5%9E%8B%E5%AF%BC%E5%85%A5%E6%96%B9%E5%BC%8F-%E8%AF%A6%E7%BB%86%E7%89%88.md) |
| [Knowledge Base](https://github.com/UnicomAI/wanwu/tree/main/configs/microservice/bff-service/static/manual/2.%E7%9F%A5%E8%AF%86%E5%BA%93) | In terms of document parsing capabilities: supports uploading of 12 file types and URL parsing; Supports private deployment and integration for document parsing via two methods: OCR and [a proprietary MinerU model (for scenarios like titles, tables, and formulas)](https://github.com/UnicomAI/DocParserServer/tree/main) ; document segmentation settings support both general segmentation and parent-child segmentation. In terms of optimization capabilities: supports metadata management 、Graph RAG and metadata filtering queries, supports adding, deleting, and modifying segmented content, supports setting keyword tags for segments to improve recall performance, supports segment enable/disable operations, and supports hit testing. In terms of retrieval capabilities: supports multiple retrieval modes including vector search, full-text search, and hybrid search. In terms of Q&A capabilities: supports automatic citation of sources and generating answers with both text and images.<br |
| [Resource Library](https://github.com/UnicomAI/wanwu/blob/main/configs/microservice/bff-service/static/manual/3.%E5%B7%A5%E5%85%B7%E5%B9%BF%E5%9C%BA.md) | Supports importing your own MCP services or custom tools for use in workflows and agents. |
| [Safety Guardrails](https://github.com/UnicomAI/wanwu/blob/main/configs/microservice/bff-service/static/manual/4.%E5%AE%89%E5%85%A8%E6%8A%A4%E6%A0%8F.md) | Users can create sensitive word lists to control the safety of the model's output. |
Expand Down
4 changes: 2 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

#### **1. 模型纳管(Model Hub)**

▸ 支持 **数百种专有/开源大模型**(包括GPT、Claude、Llama等系列)的统一接入与生命周期管理
▸ 支持 **数百种专有/开源大模型**(包括GPT、Claude、Llama、MiniMax等系列)的统一接入与生命周期管理

▸ 深度适配 **OpenAI API 标准** 及 **联通元景** 生态模型,实现异构模型的无缝切换

Expand Down Expand Up @@ -303,7 +303,7 @@

| 功能 | 详细描述 |
| :----------------------------------------------------------: | :----------------------------------------------------------: |
| [模型管理](https://github.com/UnicomAI/wanwu/blob/main/configs/microservice/bff-service/static/manual/1.%E6%A8%A1%E5%9E%8B%E7%AE%A1%E7%90%86.md) | 支持用户导入包括联通元景、OpenAI-API-compatible、Ollama、通义千问、火山引擎等模型供应商的LLM、Embedding、Rerank模型。[ 模型导入方式-详细版](https://github.com/UnicomAI/wanwu/blob/main/configs/microservice/bff-service/static/manual/%E6%A8%A1%E5%9E%8B%E5%AF%BC%E5%85%A5%E6%96%B9%E5%BC%8F-%E8%AF%A6%E7%BB%86%E7%89%88.md) |
| [模型管理](https://github.com/UnicomAI/wanwu/blob/main/configs/microservice/bff-service/static/manual/1.%E6%A8%A1%E5%9E%8B%E7%AE%A1%E7%90%86.md) | 支持用户导入包括联通元景、OpenAI-API-compatible、Ollama、通义千问、火山引擎、MiniMax等模型供应商的LLM、Embedding、Rerank模型。[ 模型导入方式-详细版](https://github.com/UnicomAI/wanwu/blob/main/configs/microservice/bff-service/static/manual/%E6%A8%A1%E5%9E%8B%E5%AF%BC%E5%85%A5%E6%96%B9%E5%BC%8F-%E8%AF%A6%E7%BB%86%E7%89%88.md) |
| [知识库](https://github.com/UnicomAI/wanwu/tree/main/configs/microservice/bff-service/static/manual/2.%E7%9F%A5%E8%AF%86%E5%BA%93) | 在文档解析能力方面:支持12种文件类型的上传,支持url解析;文档解析方式支持OCR和[ MinerU模型解析(标题/表格/公式等场景)](https://github.com/UnicomAI/DocParserServer/tree/main)的私有化部署及接入,文档分段设置支持通用分段和父子分段。在调优能力方面:支持知识图谱、元数据管理及元数据过滤查询,支持分段内容增删改,支持对分段设置关键词标签提升召回效果,支持分段启停操作,支持命中测试等功能。在检索能力方面:支持向量检索、全文检索、混合检索多种检索模式;在问答能力方面:支持自动引用出处,支持图文并茂的生成答案。 |
| [资源库](https://github.com/UnicomAI/wanwu/blob/main/configs/microservice/bff-service/static/manual/3.%E5%B7%A5%E5%85%B7%E5%B9%BF%E5%9C%BA.md) | 同时支持导入自己的MCP服务或自定义工具或提示词,并在工作流和智能体中使用;支持用户创建MCP Server |
| [安全护栏](https://github.com/UnicomAI/wanwu/blob/main/configs/microservice/bff-service/static/manual/4.%E5%AE%89%E5%85%A8%E6%8A%A4%E6%A0%8F.md) | 用户可以创建敏感词表,控制模型反馈结果的安全性 |
Expand Down
1 change: 1 addition & 0 deletions pkg/model-provider/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
ProviderQianfan = "QianFan"
ProviderDeepSeek = "DeepSeek"
ProviderJina = "Jina"
ProviderMiniMax = "MiniMax"
)

var (
Expand Down
24 changes: 24 additions & 0 deletions pkg/model-provider/model_config_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
mp_huoshan "github.com/UnicomAI/wanwu/pkg/model-provider/mp-huoshan"
mp_infini "github.com/UnicomAI/wanwu/pkg/model-provider/mp-infini"
mp_jina "github.com/UnicomAI/wanwu/pkg/model-provider/mp-jina"
mp_minimax "github.com/UnicomAI/wanwu/pkg/model-provider/mp-minimax"
mp_ollama "github.com/UnicomAI/wanwu/pkg/model-provider/mp-ollama"
mp_openai_compatible "github.com/UnicomAI/wanwu/pkg/model-provider/mp-openai-compatible"
mp_qianfan "github.com/UnicomAI/wanwu/pkg/model-provider/mp-qianfan"
Expand Down Expand Up @@ -322,6 +323,17 @@ func ToModelTags(provider, modelType, cfg string) ([]mp_common.Tag, error) {
default:
return nil, fmt.Errorf("ToModelTags:invalid provider %v model type %v", provider, modelType)
}
case ProviderMiniMax:
switch modelType {
case ModelTypeLLM:
llm := &mp_minimax.LLM{}
if err := json.Unmarshal([]byte(cfg), llm); err != nil {
return nil, fmt.Errorf("unmarshal model config err: %v", err)
}
tags = llm.Tags()
default:
return nil, fmt.Errorf("ToModelTags:invalid provider %v model type %v", provider, modelType)
}
default:
return nil, fmt.Errorf("ToModelTags:invalid provider: %v", provider)
}
Expand Down Expand Up @@ -470,6 +482,13 @@ func ToModelConfig(provider, modelType, cfg string) (interface{}, error) {
default:
return nil, fmt.Errorf("ToModelConfig:invalid provider %v model type %v", provider, modelType)
}
case ProviderMiniMax:
switch modelType {
case ModelTypeLLM:
ret = &mp_minimax.LLM{}
default:
return nil, fmt.Errorf("ToModelConfig:invalid provider %v model type %v", provider, modelType)
}
default:
return nil, fmt.Errorf("ToModelConfig:invalid provider: %v", provider)
}
Expand All @@ -489,6 +508,7 @@ type ProviderModelConfig struct {
ProviderInfini ProviderModelByInfini `json:"providerInfini"`
ProviderQianFan ProviderModelByQianFan `json:"providerQianFan"`
ProviderDeepSeek ProviderModelByDeepSeek `json:"providerDeepSeek"`
ProviderMiniMax ProviderModelByMiniMax `json:"providerMiniMax"`
}

type ProviderModelByOpenAICompatible struct {
Expand Down Expand Up @@ -537,3 +557,7 @@ type ProviderModelByQianFan struct {
type ProviderModelByDeepSeek struct {
Llm mp_deepseek.LLM `json:"llm"`
}

type ProviderModelByMiniMax struct {
Llm mp_minimax.LLM `json:"llm"`
}
16 changes: 16 additions & 0 deletions pkg/model-provider/model_params_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ func ToModelParams(provider, modelType, cfg string) (interface{}, map[string]int
default:
return nil, nil, fmt.Errorf("invalid model type: %v", modelType)
}
case ProviderMiniMax:
switch modelType {
case ModelTypeLLM:
llm := &mp_common.LLMParams{}
if err = json.Unmarshal([]byte(cfg), llm); err == nil {
ret = llm
params = llm.GetParams()
}
default:
return nil, nil, fmt.Errorf("invalid model type: %v", modelType)
}
default:
return nil, nil, fmt.Errorf("invalid provider: %v", modelType)
}
Expand All @@ -159,6 +170,7 @@ type AppModelParams struct {
ProviderInfini AppModelParamsInfini `json:"providerInfini"`
ProviderQianFan AppModelParamsQianFan `json:"providerQianFan"`
ProviderDeepSeek AppModelParamsDeepSeek `json:"providerDeepSeek"`
ProviderMiniMax AppModelParamsMiniMax `json:"providerMiniMax"` // MiniMax模型配置
}

type AppModelParamsOpenAICompatible struct {
Expand Down Expand Up @@ -192,3 +204,7 @@ type AppModelParamsQianFan struct {
type AppModelParamsDeepSeek struct {
LLM mp_common.LLMParams `json:"llm"` // 大语言模型配置
}

type AppModelParamsMiniMax struct {
LLM mp_common.LLMParams `json:"llm"` // 大语言模型配置
}
64 changes: 64 additions & 0 deletions pkg/model-provider/mp-minimax/mp-minimax-llm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package mp_minimax

import (
"context"
"fmt"
"net/url"

mp_common "github.com/UnicomAI/wanwu/pkg/model-provider/mp-common"
)

type LLM struct {
ApiKey string `json:"apiKey"` // ApiKey
EndpointUrl string `json:"endpointUrl"` // Inference URL (default: https://api.minimax.io/v1)
FunctionCalling string `json:"functionCalling" validate:"oneof=noSupport toolCall"` // Function calling support
VisionSupport string `json:"visionSupport" validate:"oneof=noSupport support"` // Vision support
ThinkingSupport string `json:"thinkingSupport" validate:"oneof=noSupport support"` // Deep thinking support
MaxTokens *int `json:"maxTokens"` // Max output tokens
ContextSize *int `json:"contextSize"` // Context window size
MaxImageSize *int64 `json:"maxImageSize"` // Max image size limit
}

func (cfg *LLM) Tags() []mp_common.Tag {
tags := []mp_common.Tag{
{
Text: mp_common.TagChat,
},
}
tags = append(tags, mp_common.GetTagsByFunctionCall(cfg.FunctionCalling)...)
tags = append(tags, mp_common.GetTagsByVisionSupport(cfg.VisionSupport)...)
tags = append(tags, mp_common.GetTagsByContentSize(cfg.ContextSize)...)
return tags
}

func (cfg *LLM) NewReq(req *mp_common.LLMReq) (mp_common.ILLMReq, error) {
if req.MaxTokens != nil && cfg.ContextSize != nil && *req.MaxTokens > *cfg.ContextSize {
return nil, fmt.Errorf("max_tokens too large (max allowed: %d)", *cfg.ContextSize)
}
m, err := req.Data()
if err != nil {
return nil, err
}
// MiniMax temperature range is [0, 1.0]; clamp if needed
if req.Temperature != nil && *req.Temperature > 1.0 {
clamped := 1.0
m["temperature"] = clamped
}
if req.Stream != nil && *req.Stream {
if req.StreamOptions != nil && req.StreamOptions.IncludeUsage != nil {
m["stream_options"] = map[string]bool{"include_usage": *req.StreamOptions.IncludeUsage}
} else {
m["stream_options"] = map[string]bool{"include_usage": true}
}
}
return mp_common.NewLLMReq(m), nil
}

func (cfg *LLM) ChatCompletions(ctx context.Context, req mp_common.ILLMReq, headers ...mp_common.Header) (mp_common.ILLMResp, <-chan mp_common.ILLMResp, error) {
return mp_common.ChatCompletions(ctx, "minimax", cfg.ApiKey, cfg.chatCompletionsUrl(), req, mp_common.NewLLMResp, headers...)
}

func (cfg *LLM) chatCompletionsUrl() string {
ret, _ := url.JoinPath(cfg.EndpointUrl, "/chat/completions")
return ret
}