1a1c0a6544
Give the image client a configurable ResponseHeaderTimeout (default 4m, capped at the overall timeout) so a stalled upstream fails fast, and retry such timeouts when an idempotency key is set so a slow-but-safe request can recover instead of terminating. Raise the Next.js API proxy maxDuration to 1200s to accommodate long generations. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
182 lines
6.2 KiB
Go
182 lines
6.2 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"`
|
|
InputImageTransport string `json:",default=file"`
|
|
TimeoutSeconds int `json:",default=600"`
|
|
ResponseHeaderTimeoutSeconds int `json:",default=240"`
|
|
}
|
|
|
|
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"`
|
|
MaxPageContentRunes int `json:",default=1800"`
|
|
}
|
|
|
|
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"`
|
|
}
|