[UI] Plan and Apply commands with additional options#510
Conversation
2d2b212 to
933dc1f
Compare
|
Need some help to understand how to pass |
|
You can use a Pydantic validator to parse the comma separated string into a list. So you'd use a Pydantic model for inputs, which means not using query parameters but a json post body, then add a validator for @validator("restate_models")
def validate_restate_models(cls, v: str | list[str]) -> list[str]:
if isinstance(v, str):
return v.split(",")
return v |
18370eb to
cf3ed81
Compare
fb7905e to
6aa2d28
Compare
vchan
left a comment
There was a problem hiding this comment.
Looking good on the server side.
web/server/api/endpoints/commands.py
Outdated
There was a problem hiding this comment.
Does this work? I'd normally create a Pydantic model, e.g. ApplyInput, to encapsulate the POST body. It's how the FastAPI documentation usually does it as well.
web/server/api/endpoints/plan.py
Outdated
There was a problem hiding this comment.
See my comment above regarding using a Pydantic model.
web/server/models.py
Outdated
There was a problem hiding this comment.
Let's use a more descriptive name. Maybe PlanOptions? And if you add ApplyInput and/or PlanInput, you can subclass PlanOptions. Or rename this to PlanInput and ApplyInput can extend it.
e6dad7f to
601896e
Compare
Planshared state intoContextto keep state closer to thePlancomponent