mirror of
https://github.com/mudler/LocalAI.git
synced 2025-06-30 06:30:43 +00:00
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:
parent
fc3c105d42
commit
20a0cd2f66
13 changed files with 812 additions and 388 deletions
|
@ -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"
|
19
openai-openapi/endpoint-body-mapping.tmpl
Normal file
19
openai-openapi/endpoint-body-mapping.tmpl
Normal 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 -}}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue