config

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAISummarySystemPrompt = "你是一名生物信息学分析助手,请根据给定的分析输出内容,生成简洁、准确的中文摘要。"

DefaultAISummarySystemPrompt 是生成 AI 摘要时使用的默认系统提示词。

Variables

This section is empty.

Functions

func ResolveAppsPathPrefix

func ResolveAppsPathPrefix(cfg *Config) string

func ResolveContainerRuntime

func ResolveContainerRuntime(cfg *Config) string

func SetCLIFlags

func SetCLIFlags(f *CLIFlags)

SetCLIFlags sets the CLI overrides to be applied by LoadConfig. Call this before LoadConfig is invoked (e.g. in main.go).

Types

type AISummaryConfig added in v0.1.2

type AISummaryConfig struct {
	// SystemPrompt 生成摘要时使用的系统提示词。
	SystemPrompt string `yaml:"system_prompt" json:"system_prompt"`
}

AISummaryConfig AI 摘要生成配置。

type AgentConfig added in v0.1.2

type AgentConfig struct {
	// Default 默认使用的 Provider 名称(claude_code | codex | copilot | mock | custom)。
	Default string `yaml:"default" json:"default"`
	// Providers 每个 Provider 的独立配置,key 为 Provider 名称。
	Providers map[string]AgentProviderConfig `yaml:"providers" json:"providers"`
}

AgentConfig 是 AI Agent 调用框架的配置。 用于灵活切换第三方 Agent(claude_code / codex / copilot)以及后续自研 Agent。

type AgentProviderConfig added in v0.1.2

type AgentProviderConfig struct {
	Model       string            `yaml:"model" json:"model"`
	BaseURL     string            `yaml:"base_url" json:"base_url"`
	APIKey      string            `yaml:"api_key" json:"api_key"`
	BearerToken string            `yaml:"bearer_token" json:"bearer_token"`
	WorkingDir  string            `yaml:"working_dir" json:"working_dir"`
	Extra       map[string]string `yaml:"extra" json:"extra"`
}

AgentProviderConfig 是单个 Provider 的配置;Extra 用于承载 Provider 特有配置。

type AudioConfig

type AudioConfig struct {
	Dir string
}

type CLIFlags

type CLIFlags struct {
	ConfigPath string // --config, config file path
	Port       int    // --port, server port
	Host       string // --host, server host
	LogPath    string // --log-path, server log path
	DBDriver   string // --db-driver, database driver (sqlite/postgres)
	DBHost     string // --db-host, database host
	DBPort     string // --db-port, database port
	DBUser     string // --db-user, database user
	DBPassword string // --db-password, database password
	DBName     string // --db-name, database name
	DBPath     string // --db-path, sqlite database file path
	DBSSLMode  string // --db-ssl-mode, database ssl mode
	Runtime    string // --runtime, container runtime (docker/k8s/k3s)
	BaseDir    string // --base-dir, storage base directory
	// contains filtered or unexported fields
}

CLIFlags holds command-line arguments that can override config.yml values.

func ParseCLIFlags

func ParseCLIFlags() *CLIFlags

ParseCLIFlags parses command-line flags into a CLIFlags struct. It does NOT call flag.Parse() — the caller should do that.

func (*CLIFlags) DisableRegistrationSet

func (f *CLIFlags) DisableRegistrationSet() (value bool, ok bool)

DisableRegistrationSet reports whether --disable-registration was explicitly provided on the command line and returns its value.

type Config

type Config struct {
	Server    *ServerConfig    `yaml:"server"   json:"server"`
	Database  *DatabaseConfig  `yaml:"database" json:"database"`
	Feed      *FeedConfig      `yaml:"feed"     json:"feed"`
	Proxy     *ProxyConfig     `yaml:"proxy"    json:"proxy"`
	Route     *RouteConfig     `yaml:"route"    json:"route"`
	Storage   *StorageConfig   `yaml:"storage"  json:"storage"`
	Realtime  *RealtimeConfig  `yaml:"realtime" json:"realtime"`
	LLM       *LLMConfig       `yaml:"llm" json:"llm"`
	Agent     *AgentConfig     `yaml:"agent" json:"agent"`
	Container *ContainerConfig `yaml:"container" json:"container"`
	// Ingest   *IngestConfig   `yaml:"ingest"   json:"ingest"`
	Tenant      *TenantConfig `yaml:"tenant"   json:"tenant"`
	DebugConfig *DebugConfig  `yaml:"debug"    json:"debug"`
	User        *UserConfig   `yaml:"user"     json:"user"`

	AISummary *AISummaryConfig `yaml:"ai_summary" json:"ai_summary"`
}

func LoadConfig

func LoadConfig() (*Config, error)

type ContainerConfig

type ContainerConfig struct {
	Runtime                             string                   `yaml:"runtime" json:"runtime"`
	Kubernetes                          *KubernetesRuntimeConfig `yaml:"kubernetes" json:"kubernetes"`
	RefreshImageStatusOnStart           bool                     `yaml:"refresh_image_status_on_start" json:"refresh_image_status_on_start"`
	RecoverRunningDagOnStart            bool                     `yaml:"recover_running_dag_on_start" json:"recover_running_dag_on_start"`
	CleanupDagNodeContainersBeforeStart bool                     `yaml:"cleanup_dag_node_containers_before_start" json:"cleanup_dag_node_containers_before_start"`
	DeleteContainerOnNodeSuccess        bool                     `yaml:"delete_container_on_node_success" json:"delete_container_on_node_success"`
	DagNodeCleanupOnFailed              string                   `yaml:"dag_node_cleanup_on_failed" json:"dag_node_cleanup_on_failed"`
	DagNodeCleanupOnDagFinished         string                   `yaml:"dag_node_cleanup_on_dag_finished" json:"dag_node_cleanup_on_dag_finished"`
	// CreateQueueMaxConcurrency limits how many containers can be created concurrently.
	CreateQueueMaxConcurrency int `yaml:"create_queue_max_concurrency" json:"create_queue_max_concurrency"`
	// CreateQueueMaxPending limits how many creation requests can wait in the queue.
	CreateQueueMaxPending int `yaml:"create_queue_max_pending" json:"create_queue_max_pending"`
}

type DatabaseConfig

type DatabaseConfig struct {
	Driver   string `yaml:"driver"   json:"driver"`
	Host     string `yaml:"host"     json:"host"`
	Port     string `yaml:"port"     json:"port"`
	User     string `yaml:"user"     json:"user"`
	Password string `yaml:"password" json:"password"`
	Name     string `yaml:"name"     json:"name"`
	SSLMode  string `yaml:"ssl_mode" json:"ssl_mode"`
	Path     string `yaml:"path"     json:"path"`
}

DatabaseConfig 数据库配置

type DebugConfig

type DebugConfig struct {
	EnableDagOrchestrator bool `yaml:"enable_dag_orchestrator" json:"enable_dag_orchestrator"`
}

type FeedConfig

type FeedConfig struct {
	WorkerCount      int  `yaml:"worker_count"      json:"worker_count"`
	QueueSize        int  `yaml:"queue_size"        json:"queue_size"`
	BackfillEnabled  bool `yaml:"backfill_enabled"  json:"backfill_enabled"`
	BackfillBatch    int  `yaml:"backfill_batch"    json:"backfill_batch"`
	RetryMaxAttempts int  `yaml:"retry_max_attempts" json:"retry_max_attempts"`
	RetryBaseDelayMs int  `yaml:"retry_base_delay_ms" json:"retry_base_delay_ms"`
	RetryMaxDelayMs  int  `yaml:"retry_max_delay_ms"  json:"retry_max_delay_ms"`
}

FeedConfig feed 异步构建配置

type K8sIngressRouteConfig

type K8sIngressRouteConfig struct {
	Namespace        string            `yaml:"namespace"          json:"namespace"`
	Kubeconfig       string            `yaml:"kubeconfig"         json:"kubeconfig"`
	InCluster        bool              `yaml:"in_cluster"         json:"in_cluster"`
	IngressClassName string            `yaml:"ingress_class_name" json:"ingress_class_name"`
	Host             string            `yaml:"host"               json:"host"`
	PathType         string            `yaml:"path_type"          json:"path_type"`
	Annotations      map[string]string `yaml:"annotations"        json:"annotations"`
}

type KubernetesRuntimeConfig

type KubernetesRuntimeConfig struct {
	Namespace  string `yaml:"namespace" json:"namespace"`
	Kubeconfig string `yaml:"kubeconfig" json:"kubeconfig"`
	InCluster  bool   `yaml:"in_cluster" json:"in_cluster"`
}

type LLMConfig

type LLMConfig struct {
	CLIURL      string             `yaml:"cli_url" json:"cli_url"`
	Model       string             `yaml:"model" json:"model"`
	GitHubToken string             `yaml:"github_token" json:"github_token"`
	Provider    *LLMProviderConfig `yaml:"provider" json:"provider"`
}

type LLMProviderConfig

type LLMProviderConfig struct {
	Type        string `yaml:"type" json:"type"`
	BaseURL     string `yaml:"base_url" json:"base_url"`
	APIKey      string `yaml:"api_key" json:"api_key"`
	BearerToken string `yaml:"bearer_token" json:"bearer_token"`
}

type ProxyConfig

type ProxyConfig struct {
	BraveAPI   string `yaml:"brave_api" json:"brave_api"`
	Container  string `yaml:"container" json:"container"`
	OnlyOffice string `yaml:"onlyoffice" json:"onlyoffice"`
}

type RealtimeConfig

type RealtimeConfig struct {
	Transport             string `yaml:"transport" json:"transport"`
	MaxConnectionsPerUser int    `yaml:"max_connections_per_user" json:"max_connections_per_user"`
	AckTimeoutSeconds     int    `yaml:"ack_timeout_seconds" json:"ack_timeout_seconds"`
	AckMaxRetries         int    `yaml:"ack_max_retries" json:"ack_max_retries"`
}

type RouteConfig

type RouteConfig struct {
	Registry   string                 `yaml:"registry"     json:"registry"`
	AppsPrefix string                 `yaml:"apps_prefix"  json:"apps_prefix"`
	Traefik    *TraefikRouteConfig    `yaml:"traefik"      json:"traefik"`
	K8sIngress *K8sIngressRouteConfig `yaml:"k8s_ingress"  json:"k8s_ingress"`
}

type ServerConfig

type ServerConfig struct {
	Port int `yaml:"port"             json:"port"`
	// GRPCPort        int           `yaml:"grpc_port"        json:"grpc_port"`
	Host            string        `yaml:"host"             json:"host"`
	LogPath         string        `yaml:"log_path"         json:"log_path"`
	ShutdownTimeout time.Duration `yaml:"shutdown_timeout" json:"shutdown_timeout" default:"30s"`
}

ServerConfig 服务器配置

type StorageConfig

type StorageConfig struct {
	// ImageDir string `yaml:"image_dir" json:"image_dir"`
	BaseDir string `yaml:"base_dir" json:"base_dir"`
}

type TenantConfig

type TenantConfig struct {
	AesKey string `yaml:"aes_key" json:"aes_key"`
}

type TraefikRouteConfig

type TraefikRouteConfig struct {
	Provider      string `yaml:"provider"        json:"provider"`
	BaseURL       string `yaml:"base_url"        json:"base_url"`
	UpsertPath    string `yaml:"upsert_path"     json:"upsert_path"`
	DeletePath    string `yaml:"delete_path"     json:"delete_path"`
	AuthToken     string `yaml:"auth_token"      json:"auth_token"`
	TimeoutSecond int    `yaml:"timeout_second"  json:"timeout_second"`
	FilePath      string `yaml:"file_path"       json:"file_path"`
}

type UserConfig

type UserConfig struct {
	DisableRegistration bool `yaml:"disable_registration" json:"disable_registration"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL