mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-12 20:53:48 +00:00
Merge branch 'awel-flow2.0' into chore/update-api
This commit is contained in:
@@ -11,6 +11,7 @@ _UI_TYPE = Literal[
|
||||
"select",
|
||||
"cascader",
|
||||
"checkbox",
|
||||
"radio",
|
||||
"date_picker",
|
||||
"input",
|
||||
"text_area",
|
||||
@@ -175,6 +176,12 @@ class UICheckbox(UIComponent):
|
||||
self._check_options(parameter_dict.get("options", {}))
|
||||
|
||||
|
||||
class UIRadio(UICheckbox):
|
||||
"""Radio component."""
|
||||
|
||||
ui_type: Literal["radio"] = Field("radio", frozen=True) # type: ignore
|
||||
|
||||
|
||||
class UIDatePicker(UIComponent):
|
||||
"""Date picker component."""
|
||||
|
||||
@@ -232,23 +239,31 @@ class UIInput(UIComponent):
|
||||
class UITextArea(PanelEditorMixin, UIInput):
|
||||
"""Text area component."""
|
||||
|
||||
class AutoSize(BaseModel):
|
||||
"""Auto size configuration."""
|
||||
class UIAttribute(UIInput.UIAttribute):
|
||||
"""Text area attribute."""
|
||||
|
||||
min_rows: Optional[int] = Field(
|
||||
class AutoSize(BaseModel):
|
||||
"""Auto size configuration."""
|
||||
|
||||
min_rows: Optional[int] = Field(
|
||||
None,
|
||||
description="The minimum number of rows",
|
||||
)
|
||||
max_rows: Optional[int] = Field(
|
||||
None,
|
||||
description="The maximum number of rows",
|
||||
)
|
||||
|
||||
auto_size: Optional[Union[bool, AutoSize]] = Field(
|
||||
None,
|
||||
description="The minimum number of rows",
|
||||
)
|
||||
max_rows: Optional[int] = Field(
|
||||
None,
|
||||
description="The maximum number of rows",
|
||||
description="Whether the height of the textarea automatically adjusts "
|
||||
"based on the content",
|
||||
)
|
||||
|
||||
ui_type: Literal["text_area"] = Field("text_area", frozen=True) # type: ignore
|
||||
autosize: Optional[Union[bool, AutoSize]] = Field(
|
||||
attr: Optional[UIAttribute] = Field(
|
||||
None,
|
||||
description="Whether the height of the textarea automatically adjusts based "
|
||||
"on the content",
|
||||
description="The attributes of the component",
|
||||
)
|
||||
|
||||
|
||||
@@ -430,8 +445,9 @@ class UICodeEditor(UITextArea):
|
||||
class DefaultUITextArea(UITextArea):
|
||||
"""Default text area component."""
|
||||
|
||||
autosize: Union[bool, UITextArea.AutoSize] = Field(
|
||||
default_factory=lambda: UITextArea.AutoSize(min_rows=2, max_rows=40),
|
||||
description="Whether the height of the textarea automatically adjusts based "
|
||||
"on the content",
|
||||
attr: Optional[UITextArea.UIAttribute] = Field(
|
||||
default_factory=lambda: UITextArea.UIAttribute(
|
||||
auto_size=UITextArea.UIAttribute.AutoSize(min_rows=2, max_rows=40)
|
||||
),
|
||||
description="The attributes of the component",
|
||||
)
|
||||
|
@@ -1,20 +1,12 @@
|
||||
import json
|
||||
from functools import cache
|
||||
from typing import Dict, List, Literal, Optional, Union
|
||||
from typing import Dict, List, Optional, Union
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Request
|
||||
from fastapi.security.http import HTTPAuthorizationCredentials, HTTPBearer
|
||||
|
||||
from dbgpt.component import SystemApp
|
||||
from dbgpt.core.awel.flow import ResourceMetadata, ViewMetadata
|
||||
from dbgpt.core.interface.variables import (
|
||||
BUILTIN_VARIABLES_CORE_FLOW_NODES,
|
||||
BUILTIN_VARIABLES_CORE_FLOWS,
|
||||
BUILTIN_VARIABLES_CORE_SECRETS,
|
||||
BUILTIN_VARIABLES_CORE_VARIABLES,
|
||||
BuiltinVariablesProvider,
|
||||
StorageVariables,
|
||||
)
|
||||
from dbgpt.serve.core import Result, blocking_func_to_async
|
||||
from dbgpt.util import PaginationResult
|
||||
|
||||
@@ -330,6 +322,12 @@ async def update_variables(
|
||||
return Result.succ(res)
|
||||
|
||||
|
||||
@router.post("/flow/debug")
|
||||
async def debug():
|
||||
"""Debug the flow."""
|
||||
# TODO: Implement the debug endpoint
|
||||
|
||||
|
||||
def init_endpoints(system_app: SystemApp) -> None:
|
||||
"""Initialize the endpoints"""
|
||||
from .variables_provider import (
|
||||
|
@@ -1,6 +1,7 @@
|
||||
from typing import Any, List, Literal, Optional
|
||||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
|
||||
from dbgpt._private.pydantic import BaseModel, ConfigDict, Field
|
||||
from dbgpt.core.awel import CommonLLMHttpRequestBody
|
||||
from dbgpt.core.awel.flow.flow_factory import FlowPanel
|
||||
from dbgpt.core.awel.util.parameter_util import RefreshOptionRequest
|
||||
|
||||
@@ -113,3 +114,26 @@ class RefreshNodeRequest(BaseModel):
|
||||
title="The refresh options",
|
||||
description="The refresh options",
|
||||
)
|
||||
|
||||
|
||||
class FlowDebugRequest(BaseModel):
|
||||
"""Flow response model"""
|
||||
|
||||
model_config = ConfigDict(title=f"FlowDebugRequest")
|
||||
flow: ServeRequest = Field(
|
||||
...,
|
||||
title="The flow to debug",
|
||||
description="The flow to debug",
|
||||
)
|
||||
request: Union[CommonLLMHttpRequestBody, Dict[str, Any]] = Field(
|
||||
...,
|
||||
title="The request to debug",
|
||||
description="The request to debug",
|
||||
)
|
||||
variables: Optional[Dict[str, Any]] = Field(
|
||||
None,
|
||||
title="The variables to debug",
|
||||
description="The variables to debug",
|
||||
)
|
||||
user_name: Optional[str] = Field(None, description="User name")
|
||||
sys_code: Optional[str] = Field(None, description="System code")
|
||||
|
Reference in New Issue
Block a user