Replace legacy framework config with source selectors
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
|
||||
configkit "gitea.maximumdirect.net/eric/ConfigKit"
|
||||
renderformat "gitea.maximumdirect.net/eric/scriptorium/internal/format"
|
||||
@@ -62,8 +61,6 @@ func Load(options LoadOptions) (*configkit.Result[Document], error) {
|
||||
// Settings converts a validated document without another merge or normalization.
|
||||
func Settings(document Document) AppSettings {
|
||||
settings := AppSettings{
|
||||
PromptDir: document.PromptDir,
|
||||
ProfileDir: document.ProfileDir,
|
||||
SchemaDir: document.SchemaDir,
|
||||
ServerAddr: document.Server.Addr,
|
||||
ArtifactRoot: document.Server.ArtifactRoot,
|
||||
@@ -73,24 +70,8 @@ func Settings(document Document) AppSettings {
|
||||
DefaultRenderFormat: renderformat.PreparedRunOutputFormat(document.Defaults.RenderFormat),
|
||||
TransientRetries: document.TransientRetries,
|
||||
}
|
||||
if document.Backends != nil {
|
||||
ids := make([]string, 0, len(document.Backends))
|
||||
for id := range document.Backends {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
sort.Strings(ids)
|
||||
settings.Backends = make([]BackendSettings, 0, len(ids))
|
||||
for _, id := range ids {
|
||||
backend := document.Backends[id]
|
||||
settings.Backends = append(settings.Backends, BackendSettings{
|
||||
ID: id,
|
||||
Endpoint: backend.Endpoint,
|
||||
APIKeyEnv: backend.APIKeyEnv,
|
||||
ExtraParams: backend.ExtraParams,
|
||||
ConcurrencyLimit: backend.ConcurrencyLimit,
|
||||
QueueCapacity: backend.QueueCapacity,
|
||||
})
|
||||
}
|
||||
if document.PromptKitSources != nil {
|
||||
settings.PromptKitSources = append([]SourceSelection{}, document.PromptKitSources...)
|
||||
}
|
||||
return settings
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user