Validate providers and retain complete run debugging context
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package pipeline
|
||||
|
||||
import (
|
||||
"git.a-wan.net/alan/pipelines/internal/stage"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// WithDefaultModel applies only to unpublished starter/example source. Never
|
||||
// rewrite a persisted definition, retained draft, or pinned retry version.
|
||||
func WithDefaultModel(source, model string) string {
|
||||
provider, id, ok := strings.Cut(model, "/")
|
||||
if !ok || !stage.ValidModel(provider, id) {
|
||||
return source
|
||||
}
|
||||
return strings.NewReplacer("provider=opencode-go\n", "provider="+provider+"\n", "model="+stage.ModelID+"\n", "model="+id+"\n").Replace(source)
|
||||
}
|
||||
Reference in New Issue
Block a user