mirror of
https://github.com/Warky-Devs/vecna.git
synced 2026-05-05 01:26:58 +00:00
feat(server): add support for extra maps in adapter configuration
* Introduced ExtraMapConfig to allow multiple adapter configurations. * Updated server and handler to utilize extra maps for routing. * Added dashboard handler for metrics visualization.
This commit is contained in:
@@ -12,10 +12,11 @@ import (
|
||||
|
||||
// Config is the root configuration for vecna.
|
||||
type Config struct {
|
||||
Server ServerConfig `mapstructure:"server" json:"server" yaml:"server" xml:"server"`
|
||||
Metrics MetricsConfig `mapstructure:"metrics" json:"metrics" yaml:"metrics" xml:"metrics"`
|
||||
Forward ForwardConfig `mapstructure:"forward" json:"forward" yaml:"forward" xml:"forward"`
|
||||
Adapter AdapterConfig `mapstructure:"adapter" json:"adapter" yaml:"adapter" xml:"adapter"`
|
||||
Server ServerConfig `mapstructure:"server" json:"server" yaml:"server" xml:"server"`
|
||||
Metrics MetricsConfig `mapstructure:"metrics" json:"metrics" yaml:"metrics" xml:"metrics"`
|
||||
Forward ForwardConfig `mapstructure:"forward" json:"forward" yaml:"forward" xml:"forward"`
|
||||
Adapter AdapterConfig `mapstructure:"adapter" json:"adapter" yaml:"adapter" xml:"adapter"`
|
||||
ExtraMaps map[string]ExtraMapConfig `mapstructure:"extra_maps" json:"extra_maps" yaml:"extra_maps" xml:"extra_maps"`
|
||||
}
|
||||
|
||||
// ServerConfig controls the HTTP listener and inbound auth.
|
||||
@@ -57,6 +58,20 @@ type EndpointConfig struct {
|
||||
APIKey string `mapstructure:"api_key" json:"api_key" yaml:"api_key" xml:"api_key"`
|
||||
}
|
||||
|
||||
// ExtraMapConfig is a per-mapping override: all adapter fields fall back to the
|
||||
// global adapter when unset; ForwardTarget selects a named target from
|
||||
// forward.targets (empty = global forward.default).
|
||||
type ExtraMapConfig struct {
|
||||
ForwardTarget string `mapstructure:"forward_target" json:"forward_target,omitempty" yaml:"forward_target,omitempty" xml:"forward_target,omitempty"`
|
||||
Type string `mapstructure:"type" json:"type,omitempty" yaml:"type,omitempty" xml:"type,omitempty"`
|
||||
SourceDim int `mapstructure:"source_dim" json:"source_dim,omitempty" yaml:"source_dim,omitempty" xml:"source_dim,omitempty"`
|
||||
TargetDim int `mapstructure:"target_dim" json:"target_dim,omitempty" yaml:"target_dim,omitempty" xml:"target_dim,omitempty"`
|
||||
TruncateMode string `mapstructure:"truncate_mode" json:"truncate_mode,omitempty" yaml:"truncate_mode,omitempty" xml:"truncate_mode,omitempty"`
|
||||
PadMode string `mapstructure:"pad_mode" json:"pad_mode,omitempty" yaml:"pad_mode,omitempty" xml:"pad_mode,omitempty"`
|
||||
Seed int64 `mapstructure:"seed" json:"seed,omitempty" yaml:"seed,omitempty" xml:"seed,omitempty"`
|
||||
MatrixFile string `mapstructure:"matrix_file" json:"matrix_file,omitempty" yaml:"matrix_file,omitempty" xml:"matrix_file,omitempty"`
|
||||
}
|
||||
|
||||
// AdapterConfig selects and tunes the dimension adapter.
|
||||
type AdapterConfig struct {
|
||||
Type string `mapstructure:"type" json:"type" yaml:"type" xml:"type"`
|
||||
|
||||
Reference in New Issue
Block a user