Files
moteva/server/internal/config/config.go
T
root 44406b72db Initial commit: img-infinite-canvas AI design workbench MVP
Moteva-style AI design workbench replica. Home prompt creates a project;
the project page provides an infinite canvas with node drag, zoom/pan,
a design chat panel, history replay, image asset upload, and project
save/regenerate.

- Backend: go-zero, DDD layering, sqlc/pgx, optional PostgreSQL; memory
  or Redis cache; asynq job queue; MinIO/S3/R2/OSS object storage;
  sky-valley/pi agent runtime adapter.
- Frontend: Next.js App Router + Vite artifact build, TypeScript, i18n,
  shadcn/ui components, auth (OTP/Turnstile/Google/WeChat).
- Deploy: Docker Compose and k3s manifests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 23:15:37 +08:00

179 lines
5.9 KiB
Go

// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1
package config
import "github.com/zeromicro/go-zero/rest"
type Config struct {
rest.RestConf
Storage StorageConfig
Cache CacheConfig
JobQueue JobQueueConfig
Realtime RealtimeConfig
Outbox OutboxConfig
Auth AuthConfig
Agent AgentConfig
ObjectStorage ObjectStorageConfig
}
type StorageConfig struct {
Driver string `json:",default=memory"`
DataSource string `json:",optional"`
}
type CacheConfig struct {
Driver string `json:",default=memory"`
Addr string `json:",default=localhost:6379"`
Password string `json:",optional"`
DB int `json:",default=0"`
TTLSeconds int `json:",default=300"`
}
type JobQueueConfig struct {
Driver string `json:",default=memory"`
Addr string `json:",optional"`
Password string `json:",optional"`
DB int `json:",default=0"`
Queue string `json:",default=default"`
Concurrency int `json:",default=10"`
MaxRetry int `json:",default=3"`
TimeoutSeconds int `json:",default=900"`
ShutdownTimeoutSeconds int `json:",default=30"`
}
type RealtimeConfig struct {
Driver string `json:",default=memory"`
Addr string `json:",optional"`
Password string `json:",optional"`
DB int `json:",default=0"`
ChannelPrefix string `json:",default=canvas:realtime"`
FallbackPollMillis int `json:",default=3000"`
}
type OutboxConfig struct {
Driver string `json:",default=memory"`
DataSource string `json:",optional"`
PollMillis int `json:",default=3000"`
BatchSize int `json:",default=100"`
}
type AuthConfig struct {
Region string `json:",default=china"`
RegionMode string `json:",default=manual"`
TokenSecret string `json:",default=local-dev-change-me"`
TokenTTLSeconds int64 `json:",default=604800"`
RefreshTTLSeconds int64 `json:",default=2592000"`
CodeTTLSeconds int64 `json:",default=600"`
DevReturnCode bool `json:",default=true"`
Email EmailAuthConfig
Turnstile TurnstileAuthConfig
Google GoogleAuthConfig
Wechat WechatAuthConfig
}
type EmailAuthConfig struct {
Driver string `json:",default=none"`
Host string `json:",optional"`
Port int `json:",default=587"`
Username string `json:",optional"`
Password string `json:",optional"`
FromName string `json:",default=hello"`
FromEmail string `json:",default=hello@auth.moteva.local"`
BrandName string `json:",default=Moteva"`
UseTLS bool `json:",default=false"`
StartTLS bool `json:",default=true"`
InsecureSkipVerify bool `json:",default=false"`
TimeoutSeconds int `json:",default=10"`
}
type TurnstileAuthConfig struct {
Enabled bool `json:",default=false"`
SiteKey string `json:",optional"`
SecretKey string `json:",optional"`
SecretKeyEnv string `json:",default=TURNSTILE_SECRET_KEY"`
SiteVerifyURL string `json:",default=https://challenges.cloudflare.com/turnstile/v0/siteverify"`
TimeoutSeconds int `json:",default=5"`
}
type GoogleAuthConfig struct {
ClientID string `json:",optional"`
TokenInfoURL string `json:",default=https://oauth2.googleapis.com/tokeninfo"`
TimeoutSeconds int `json:",default=8"`
}
type WechatAuthConfig struct {
AppID string `json:",optional"`
AppSecret string `json:",optional"`
RedirectURI string `json:",optional"`
Scope string `json:",default=snsapi_login"`
AuthURL string `json:",default=https://open.weixin.qq.com/connect/qrconnect"`
TokenURL string `json:",default=https://api.weixin.qq.com/sns/oauth2/access_token"`
TimeoutSeconds int `json:",default=8"`
}
type AgentConfig struct {
Driver string `json:",default=pi"`
Image ImageGenerationConfig
Text TextExtractionConfig
Object ObjectRecognitionConfig
Planner CreativePlannerConfig
Research ResearchConfig
Background BackgroundRemovalConfig
}
type ImageGenerationConfig struct {
BaseURL string `json:",optional"`
APIKey string `json:",optional"`
APIKeyEnv string `json:",default=GPT_IMAGE_API_KEY"`
TimeoutSeconds int `json:",default=600"`
}
type TextExtractionConfig struct {
Driver string `json:",default=vision"`
Model string `json:",default=gpt-5.4-mini"`
TimeoutSeconds int `json:",default=240"`
CacheTTLSeconds int `json:",default=600"`
}
type ObjectRecognitionConfig struct {
Driver string `json:",default=vision"`
Model string `json:",default=gpt-5.4-mini"`
TimeoutSeconds int `json:",default=60"`
}
type BackgroundRemovalConfig struct {
Driver string `json:",default=onnxruntime"`
ModelPath string `json:",default=model/rmbg1.4.onnx"`
SharedLibraryPath string `json:",optional"`
ExecutionProvider string `json:",default=auto"`
InputSize int `json:",default=0"`
TimeoutSeconds int `json:",default=300"`
InputName string `json:",default=input"`
OutputName string `json:",default=output"`
}
type CreativePlannerConfig struct {
Driver string `json:",default=vision"`
Model string `json:",default=gpt-5.5"`
TimeoutSeconds int `json:",default=240"`
}
type ResearchConfig struct {
Driver string `json:",default=duckduckgo"`
TimeoutSeconds int `json:",default=10"`
MaxResults int `json:",default=5"`
}
type ObjectStorageConfig struct {
Driver string `json:",default=memory"`
Bucket string `json:",optional"`
Endpoint string `json:",optional"`
Region string `json:",optional"`
AccessKey string `json:",optional"`
SecretKey string `json:",optional"`
PublicBase string `json:",optional"`
UseSSL bool `json:",default=true"`
ExpiresIn int64 `json:",default=900"`
}