Not anywhere close to done, but getting back to this and staging some progress. Preliminary pass on loading a config and overriding params with request json.

This commit is contained in:
Dave Lee 2023-06-01 03:31:55 -04:00
parent fc3c105d42
commit 20a0cd2f66
No known key found for this signature in database
13 changed files with 812 additions and 388 deletions

View file

@ -5,7 +5,11 @@ generate:
output: apiv2/localai.gen.go
output-options:
exclude-depreciated: true
# user-templates:
additional-property-tags:
- yaml
- mapstructure
user-templates:
endpoint-body-mapping.tmpl: ./openai-openapi/endpoint-body-mapping.tmpl
# union.tmpl: "// SKIP"
# union-and-additional-properties.tmpl: "// SKIP"
# additional-properties.tmpl: "// SKIP"

View file

@ -0,0 +1,19 @@
// TEMP: Consider revising this in oapi-codegen to make cleaner or at least renaming....
//type EndpointSpecificConfig interface {
// GetRequestDefaults() interface{}
//}
var EndpointConfigMap = map[string]Config{
{{range .}}{{$opid := .OperationId -}}
{{if eq (len .Bodies) 1 -}}
{{with index .Bodies 0}}{{ $typeDef := .TypeDef $opid -}}
"{{$opid}}":SpecificConfig[{{$typeDef.TypeName}}]{},
{{end -}}
{{else -}}
{{range .Bodies -}}
{{if and .IsSupported .Default -}}
"{{$opid}}":SpecificConfig[{{.TypeName}}]{},{{break -}}
{{end -}}
{{end -}}
{{end -}}
{{end -}}
}