Allow prompt version selection without inputs
This commit is contained in:
@@ -76,17 +76,15 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
writeError(w, http.StatusBadRequest, "invalid_request", "prompt_id is required")
|
||||
return
|
||||
}
|
||||
if len(req.Inputs) == 0 {
|
||||
writeError(w, http.StatusBadRequest, "invalid_request", "inputs is required")
|
||||
return
|
||||
}
|
||||
|
||||
mappedInputs := make(map[string]promptkit.ArtifactRef, len(req.Inputs))
|
||||
for name, in := range req.Inputs {
|
||||
mappedInputs[name] = promptkit.ArtifactRef{
|
||||
Type: promptkit.ArtifactRefType(in.Type),
|
||||
URI: in.URI,
|
||||
Body: in.Body,
|
||||
var mappedInputs map[string]promptkit.ArtifactRef
|
||||
if len(req.Inputs) > 0 {
|
||||
mappedInputs = make(map[string]promptkit.ArtifactRef, len(req.Inputs))
|
||||
for name, in := range req.Inputs {
|
||||
mappedInputs[name] = promptkit.ArtifactRef{
|
||||
Type: promptkit.ArtifactRefType(in.Type),
|
||||
URI: in.URI,
|
||||
Body: in.Body,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user