Skip to content

Commit

Permalink
Create set_description endpoint (#693)
Browse files Browse the repository at this point in the history
Create set_description endpoint


TSIA

## Test Plan
Follow dev README to setup the local editor:
https://github.com/lastmile-ai/aiconfig/tree/main/python/src/aiconfig/editor#dev,
then run this command
```
curl http://localhost:8080/api/set_description -d '{"description":"yo this is a cool new description get rekt dont @ me bro"}' -X POST -H 'Content-Type: application/json'
```


https://github.com/lastmile-ai/aiconfig/assets/151060367/0db278b3-8273-4178-8010-380538dcd0ca

---
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with
[ReviewStack](https://reviewstack.dev/lastmile-ai/aiconfig/pull/693).
* __->__ #693
* #692
* #691
* #690
* #688
* #670
* #668
  • Loading branch information
rossdanlm authored Jan 2, 2024
2 parents 700e977 + b74da46 commit 7cf4a63
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions python/src/aiconfig/editor/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,16 @@ def set_name() -> FlaskResponse:
operation = make_op_run_method(MethodName("set_name"))
operation_args: Result[OpArgs, str] = result.Ok(OpArgs({"name": name}))
return run_aiconfig_operation_with_op_args(aiconfig, "set_name", operation, operation_args)


@app.route("/api/set_description", methods=["POST"])
def set_description() -> FlaskResponse:
state = get_server_state(app)
aiconfig = state.aiconfig
request_json = request.get_json()

description: str | None = request_json.get("description")

operation = make_op_run_method(MethodName("set_description"))
operation_args: Result[OpArgs, str] = result.Ok(OpArgs({"description": description}))
return run_aiconfig_operation_with_op_args(aiconfig, "set_description", operation, operation_args)

0 comments on commit 7cf4a63

Please sign in to comment.