feat: Add dbgpt client and add api v2

This commit is contained in:
Fangyin Cheng
2024-03-18 18:24:08 +08:00
parent 4970c9f813
commit 0ed30aa44a
39 changed files with 2663 additions and 143 deletions

49
dbgpt/client/flow.py Normal file
View File

@@ -0,0 +1,49 @@
from dbgpt.client.client import Client
from dbgpt.core.awel.flow.flow_factory import FlowPanel
async def create_flow(client: Client, flow: FlowPanel):
"""Create a new flow.
Args:
client (Client): The dbgpt client.
flow (FlowPanel): The flow panel.
"""
return await client.get("/awel/flows", flow.dict())
async def update_flow(client: Client, flow: FlowPanel):
"""Update a flow.
Args:
client (Client): The dbgpt client.
flow (FlowPanel): The flow panel.
"""
return await client.put("/awel/flows", flow.dict())
async def delete_flow(client: Client, flow_id: str):
"""
Delete a flow.
Args:
client (Client): The dbgpt client.
flow_id (str): The flow id.
"""
return await client.get("/awel/flows/" + flow_id)
async def get_flow(client: Client, flow_id: str):
"""
Get a flow.
Args:
client (Client): The dbgpt client.
flow_id (str): The flow id.
"""
return await client.get("/awel/flows/" + flow_id)
async def list_flow(client: Client):
"""
List flows.
Args:
client (Client): The dbgpt client.
"""
return await client.get("/awel/flows")