Files
moteva/server/internal/config/config.go
T
root 2f5291a0f9 feat(image): pass reference images to GPT image model for edits
Server: forward canvas/reference images to the image model so extract,
continue, and edit requests stay faithful to the source product.
- Add ImageRequestOptions.Images and route requests with inputs to the
  /v1/images/edits endpoint, via multipart upload (default) or JSON
  image_url payload, selectable through Agent.Image.InputImageTransport.
- Extract reference URLs from prompt directives, inline @image tokens,
  and chat message image/mask contents; fold them into the idempotency
  key and prepend a reference-fidelity instruction to the prompt.

Frontend:
- Shrink CanvasToast to a compact top pill.
- Paste an internal transparent clipboard node instead of re-uploading
  when it matches the clipboard image.
- Keep agent-project polling alive on stream error while streaming.
2026-07-08 01:19:20 +08:00

180 lines
6.0 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"`
}
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"`
}