mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
106 lines
5.6 KiB
Go
106 lines
5.6 KiB
Go
// Copyright 2019 Yunion
|
|
//
|
|
// 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 options
|
|
|
|
import (
|
|
"strings"
|
|
|
|
common_options "yunion.io/x/onecloud/pkg/cloudcommon/options"
|
|
)
|
|
|
|
type LLMOptions struct {
|
|
common_options.CommonOptions
|
|
common_options.DBOptions
|
|
|
|
LLMWorkingDirectory string `help:"llm working directory" default:"/opt/cloud/workspace/llm/"`
|
|
|
|
InstantModelSyncTaskWorkerCount int `help:"backup task worker count" default:"128"`
|
|
ModelSyncTaskWaitSecs int `help:"model sync task wait seconds" default:"30"`
|
|
|
|
BackupTaskWorkerCount int `help:"backup task worker count" default:"128"`
|
|
ImportTaskWorkerCount int `help:"import task worker count" default:"8"`
|
|
StartTaskWorkerCount int `help:"start task worker count" default:"128"`
|
|
|
|
LLMBenchmarkWorkDir string `help:"llm benchmark working directory" default:"/opt/cloud/workspace/llm/benchmarks"`
|
|
LLMBenchmarkDefaultImage string `help:"default GuideLLM benchmark image" default:"registry.cn-beijing.aliyuncs.com/cloudpods/guidellm:v0.7.0-amd64"`
|
|
LLMBenchmarkRunnerCPU int `help:"llm benchmark runner cpu" default:"1"`
|
|
LLMBenchmarkRunnerMemoryMB int `help:"llm benchmark runner memory MB" default:"2048"`
|
|
LLMBenchmarkDefaultRequestRate int `help:"default benchmark request rate" default:"1"`
|
|
LLMBenchmarkDefaultTotalRequests int `help:"default benchmark total requests" default:"100"`
|
|
LLMBenchmarkDefaultInputTokens int `help:"default synthetic prompt tokens" default:"1024"`
|
|
LLMBenchmarkDefaultOutputTokens int `help:"default synthetic output tokens" default:"128"`
|
|
LLMBenchmarkMaxDurationSeconds int `help:"max benchmark duration seconds" default:"3600"`
|
|
LLMBenchmarkMaxRequestRate int `help:"max benchmark request rate" default:"100"`
|
|
LLMBenchmarkMaxTotalRequests int `help:"max benchmark total requests" default:"100000"`
|
|
ArtifactS3Endpoint string `help:"MinIO/S3 endpoint for benchmark artifacts; empty disables upload" default:"http://monitor-minio.onecloud-monitoring.svc:9000"`
|
|
ArtifactS3AccessKey string `help:"MinIO/S3 access key for benchmark artifacts" default:"monitor-admin"`
|
|
ArtifactS3SecretKey string `help:"MinIO/S3 secret key for benchmark artifacts" default:"monitor-admin"`
|
|
ArtifactS3Bucket string `help:"MinIO/S3 bucket for benchmark artifacts" default:"llm-benchmark"`
|
|
ArtifactS3Secure bool `help:"Use HTTPS for benchmark artifact endpoint without scheme" default:"false"`
|
|
ArtifactS3Prefix string `help:"MinIO/S3 object key prefix for benchmark artifacts" default:"llm-benchmarks"`
|
|
|
|
// MCP Agent 配置
|
|
MCPServerURL string `help:"MCP Server URL" default:"http://default-mcp-server:30876"`
|
|
MCPAgentTimeout int `help:"MCP Agent request timeout in seconds" default:"180"`
|
|
|
|
MCPAgentUserCharLimit int `help:"MCP Agent user char limit" default:"3200"`
|
|
MCPAgentAssistantCharLimit int `help:"MCP Agent assistant char limit" default:"6400"`
|
|
MCPAgentMaxToolRounds int `help:"Max MCP tool-call rounds per chat request" default:"16"`
|
|
|
|
// LLM model catalog (browsable curated entries). Value can be either an
|
|
// http(s) URL or a local file path; sources without an http:// or https://
|
|
// prefix are treated as local files.
|
|
ModelCatalogURL string `help:"URL of the LLM model catalog YAML; values without http(s):// prefix are treated as local file paths" default:"https://www.cloudpods.org/model-catalog.yaml"`
|
|
LLMImagesCatalogURL string `help:"URL of the LLM community images YAML; values without http(s):// prefix are treated as local file paths" default:"https://www.cloudpods.org/llmimages.yaml"`
|
|
LLMCatalogRefreshIntervalMinutes int `help:"Catalog refresh interval in minutes; 0 disables periodic refresh" default:"60"`
|
|
|
|
// Server-side proxy for outbound HuggingFace / ModelScope calls (used by
|
|
// the dashboard for model browsing). Mirrors GPUStack's /v1/proxy design.
|
|
HuggingFaceEndpoint string `help:"Replacement endpoint for huggingface.co (e.g., https://hf-mirror.com); empty means no substitution"`
|
|
HuggingFaceToken string `help:"Optional HuggingFace bearer token; injected as Authorization header on huggingface.co requests"`
|
|
|
|
ModelScopeEndpoint string `help:"ModelScope API endpoint (e.g., https://www.modelscope.cn)" default:"https://www.modelscope.cn"`
|
|
ModelScopeToken string `help:"Optional ModelScope bearer token; injected as Authorization header on modelscope.cn requests"`
|
|
}
|
|
|
|
var (
|
|
Options LLMOptions
|
|
)
|
|
|
|
const DefaultPlatformName = "Cloudpods"
|
|
|
|
// ResolvedPlatformName 返回配置中的平台展示名,空则回退 DefaultPlatformName。
|
|
func ResolvedPlatformName() string {
|
|
name := strings.TrimSpace(Options.PlatformName)
|
|
if name == "" {
|
|
return DefaultPlatformName
|
|
}
|
|
return name
|
|
}
|
|
|
|
func OnOptionsChange(oldO, newO interface{}) bool {
|
|
oldOpts := oldO.(*LLMOptions)
|
|
newOpts := newO.(*LLMOptions)
|
|
|
|
changed := false
|
|
if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
|
|
changed = true
|
|
}
|
|
if common_options.OnDBOptionsChange(&oldOpts.DBOptions, &newOpts.DBOptions) {
|
|
changed = true
|
|
}
|
|
return changed
|
|
}
|