mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-15 14:11:14 +00:00
feat: Add dbgpt client and add api v2
This commit is contained in:
49
dbgpt/client/flow.py
Normal file
49
dbgpt/client/flow.py
Normal 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")
|
Reference in New Issue
Block a user