docs: Config documents & i18n supports (#2365)

This commit is contained in:
Fangyin Cheng
2025-02-24 16:45:26 +08:00
committed by GitHub
parent 22598ca79f
commit 96bcb6d138
406 changed files with 34513 additions and 10732 deletions

View File

@@ -1,6 +1,11 @@
from dataclasses import dataclass, field
from typing import Optional
from dbgpt.core.awel.flow import (
TAGS_ORDER_HIGH,
ResourceCategory,
auto_register_resource,
)
from dbgpt.util.i18n_utils import _
from dbgpt_serve.core import BaseServeConfig
@@ -13,6 +18,13 @@ SERVE_SERVICE_COMPONENT_NAME = f"{SERVE_APP_NAME}_service"
SERVER_APP_TABLE_NAME = "dbgpt_serve_conversation"
@auto_register_resource(
label=_("Conversation Serve Configurations"),
category=ResourceCategory.COMMON,
tags={"order": TAGS_ORDER_HIGH},
description=_("This configuration is for the conversation serve module."),
show_in_ui=False,
)
@dataclass
class ServeConfig(BaseServeConfig):
"""Parameters for the serve command"""

View File

@@ -1,12 +1,12 @@
import logging
import sys
from typing import TYPE_CHECKING, List
from typing import TYPE_CHECKING, Any, List
from fastapi import HTTPException, Request
from fastapi.exceptions import RequestValidationError
from fastapi.responses import JSONResponse
from dbgpt._private.pydantic import BaseModel, Field
from dbgpt._private.pydantic import BaseModel, Field, model_serializer
from dbgpt.core.schema.api import Result
from dbgpt.util.parameter_utils import ParameterDescription
@@ -82,6 +82,16 @@ class ResourceParameters(BaseModel):
default_factory=list, description="Resource parameters."
)
@model_serializer
def ser_model(self) -> dict[str, Any]:
"""Serialize the model to a dict."""
return {
"name": self.name,
"label": self.label,
"description": self.description,
"parameters": [p.to_dict() for p in self.parameters],
}
class ResourceTypes(BaseModel):
"""Resource types model.

View File

@@ -1,5 +1,11 @@
from dataclasses import dataclass
from dbgpt.core.awel.flow import (
TAGS_ORDER_HIGH,
ResourceCategory,
auto_register_resource,
)
from dbgpt.util.i18n_utils import _
from dbgpt_serve.core import BaseServeConfig
APP_NAME = "datasource"
@@ -9,6 +15,13 @@ SERVE_CONFIG_KEY_PREFIX = "dbgpt_datasource"
SERVE_SERVICE_COMPONENT_NAME = f"{SERVE_APP_NAME}_service"
@auto_register_resource(
label=_("Datasource Serve Configurations"),
category=ResourceCategory.COMMON,
tags={"order": TAGS_ORDER_HIGH},
description=_("This configuration is for the datasource serve module."),
show_in_ui=False,
)
@dataclass
class ServeConfig(BaseServeConfig):
"""Parameters for the serve command"""

View File

@@ -124,8 +124,9 @@ class ConnectorManager(BaseComponent):
parameters = _get_parameter_descriptions(param_cls)
label = db_type.value()
description = label
if hasattr(param_cls, "_resource_metadata"):
flow_metadata: ResourceMetadata = param_cls._resource_metadata # type: ignore
metadata_name = f"_resource_metadata_{param_cls.__name__}"
if hasattr(param_cls, metadata_name):
flow_metadata: ResourceMetadata = getattr(param_cls, metadata_name)
label = flow_metadata.label
description = flow_metadata.description
support_type_params.append(

View File

@@ -1,5 +1,11 @@
from dataclasses import dataclass
from dbgpt.core.awel.flow import (
TAGS_ORDER_HIGH,
ResourceCategory,
auto_register_resource,
)
from dbgpt.util.i18n_utils import _
from dbgpt_serve.core import BaseServeConfig
APP_NAME = "dbgpts_hub"
@@ -11,6 +17,13 @@ SERVE_SERVICE_COMPONENT_NAME = f"{SERVE_APP_NAME}_service"
SERVER_APP_TABLE_NAME = SERVE_APP_NAME
@auto_register_resource(
label=_("Hub dbgpts Serve Configurations"),
category=ResourceCategory.COMMON,
tags={"order": TAGS_ORDER_HIGH},
description=_("This configuration is for the hub dbgpts serve module."),
show_in_ui=False,
)
@dataclass
class ServeConfig(BaseServeConfig):
"""Parameters for the serve command"""

View File

@@ -1,5 +1,11 @@
from dataclasses import dataclass
from dbgpt.core.awel.flow import (
TAGS_ORDER_HIGH,
ResourceCategory,
auto_register_resource,
)
from dbgpt.util.i18n_utils import _
from dbgpt_serve.core import BaseServeConfig
APP_NAME = "dbgpts_my"
@@ -11,6 +17,13 @@ SERVE_SERVICE_COMPONENT_NAME = f"{SERVE_APP_NAME}_service"
SERVER_APP_TABLE_NAME = SERVE_APP_NAME
@auto_register_resource(
label=_("My dbgpts Serve Configurations"),
category=ResourceCategory.COMMON,
tags={"order": TAGS_ORDER_HIGH},
description=_("This configuration is for the my dbgpts serve module."),
show_in_ui=False,
)
@dataclass
class ServeConfig(BaseServeConfig):
"""Parameters for the serve command"""

View File

@@ -1,6 +1,11 @@
from dataclasses import dataclass, field
from typing import Optional
from dbgpt.core.awel.flow import (
TAGS_ORDER_HIGH,
ResourceCategory,
auto_register_resource,
)
from dbgpt.util.i18n_utils import _
from dbgpt_serve.core import BaseServeConfig
@@ -13,6 +18,13 @@ SERVE_SERVICE_COMPONENT_NAME = f"{SERVE_APP_NAME}_service"
SERVER_APP_TABLE_NAME = "dbgpt_serve_evaluate"
@auto_register_resource(
label=_("Evaluate Serve Configurations"),
category=ResourceCategory.COMMON,
tags={"order": TAGS_ORDER_HIGH},
description=_("This configuration is for the evaluate serve module."),
show_in_ui=False,
)
@dataclass
class ServeConfig(BaseServeConfig):
"""Parameters for the serve command"""

View File

@@ -1,5 +1,11 @@
from dataclasses import dataclass
from dbgpt.core.awel.flow import (
TAGS_ORDER_HIGH,
ResourceCategory,
auto_register_resource,
)
from dbgpt.util.i18n_utils import _
from dbgpt_serve.core import BaseServeConfig
APP_NAME = "feedback"
@@ -11,6 +17,13 @@ SERVE_SERVICE_COMPONENT_NAME = f"{SERVE_APP_NAME}_service"
SERVER_APP_TABLE_NAME = "dbgpt_serve_feedback"
@auto_register_resource(
label=_("Feedback Serve Configurations"),
category=ResourceCategory.COMMON,
tags={"order": TAGS_ORDER_HIGH},
description=_("This configuration is for the feedback serve module."),
show_in_ui=False,
)
@dataclass
class ServeConfig(BaseServeConfig):
"""Parameters for the serve command"""

View File

@@ -1,6 +1,11 @@
from dataclasses import dataclass, field
from typing import Optional
from dbgpt.core.awel.flow import (
TAGS_ORDER_HIGH,
ResourceCategory,
auto_register_resource,
)
from dbgpt.util.i18n_utils import _
from dbgpt_serve.core import BaseServeConfig
@@ -13,6 +18,16 @@ SERVE_SERVICE_COMPONENT_NAME = f"{SERVE_APP_NAME}_service"
SERVER_APP_TABLE_NAME = "dbgpt_serve_file"
@auto_register_resource(
label=_("File Serve Configurations"),
category=ResourceCategory.COMMON,
tags={"order": TAGS_ORDER_HIGH},
description=_(
"This configuration is for the file serve module. In DB-GPT, you can store your"
"files in the file server."
),
show_in_ui=False,
)
@dataclass
class ServeConfig(BaseServeConfig):
"""Parameters for the serve command"""

View File

@@ -1,6 +1,11 @@
from dataclasses import dataclass, field
from typing import Optional
from dbgpt.core.awel.flow import (
TAGS_ORDER_HIGH,
ResourceCategory,
auto_register_resource,
)
from dbgpt.util.i18n_utils import _
from dbgpt_serve.core import BaseServeConfig
@@ -15,6 +20,13 @@ SERVER_APP_TABLE_NAME = "dbgpt_serve_flow"
SERVER_APP_VARIABLES_TABLE_NAME = "dbgpt_serve_variables"
@auto_register_resource(
label=_("AWEL Flow Serve Configurations"),
category=ResourceCategory.COMMON,
tags={"order": TAGS_ORDER_HIGH},
description=_("This configuration is for the flow serve module."),
show_in_ui=False,
)
@dataclass
class ServeConfig(BaseServeConfig):
"""Parameters for the serve command"""

View File

@@ -1,5 +1,11 @@
from dataclasses import dataclass
from dbgpt.core.awel.flow import (
TAGS_ORDER_HIGH,
ResourceCategory,
auto_register_resource,
)
from dbgpt.util.i18n_utils import _
from dbgpt_serve.core import BaseServeConfig
APP_NAME = "libro"
@@ -11,6 +17,13 @@ SERVE_SERVICE_COMPONENT_NAME = f"{SERVE_APP_NAME}_service"
SERVER_APP_TABLE_NAME = "dbgpt_serve_libro"
@auto_register_resource(
label=_("Libro Serve Configurations"),
category=ResourceCategory.COMMON,
tags={"order": TAGS_ORDER_HIGH},
description=_("This configuration is for the libro serve module."),
show_in_ui=False,
)
@dataclass
class ServeConfig(BaseServeConfig):
"""Parameters for the serve command"""

View File

@@ -1,6 +1,11 @@
from dataclasses import dataclass, field
from typing import Optional
from dbgpt.core.awel.flow import (
TAGS_ORDER_HIGH,
ResourceCategory,
auto_register_resource,
)
from dbgpt.util.i18n_utils import _
from dbgpt_serve.core import BaseServeConfig
@@ -13,6 +18,13 @@ SERVE_SERVICE_COMPONENT_NAME = f"{SERVE_APP_NAME}_service"
SERVER_APP_TABLE_NAME = "dbgpt_serve_model"
@auto_register_resource(
label=_("Model Serve Configurations"),
category=ResourceCategory.COMMON,
tags={"order": TAGS_ORDER_HIGH},
description=_("This configuration is for the model serve module."),
show_in_ui=False,
)
@dataclass
class ServeConfig(BaseServeConfig):
"""Parameters for the serve command"""

View File

@@ -1,6 +1,11 @@
from dataclasses import dataclass, field
from typing import Optional
from dbgpt.core.awel.flow import (
TAGS_ORDER_HIGH,
ResourceCategory,
auto_register_resource,
)
from dbgpt.util.i18n_utils import _
from dbgpt_serve.core import BaseServeConfig
@@ -13,6 +18,13 @@ SERVE_SERVICE_COMPONENT_NAME = f"{SERVE_APP_NAME}_service"
SERVER_APP_TABLE_NAME = "dbgpt_serve_prompt"
@auto_register_resource(
label=_("Prompt Serve Configurations"),
category=ResourceCategory.COMMON,
tags={"order": TAGS_ORDER_HIGH},
description=_("This configuration is for the prompt serve module."),
show_in_ui=False,
)
@dataclass
class ServeConfig(BaseServeConfig):
"""Parameters for the serve command"""

View File

@@ -1,6 +1,11 @@
from dataclasses import dataclass, field
from typing import Optional
from dbgpt.core.awel.flow import (
TAGS_ORDER_HIGH,
ResourceCategory,
auto_register_resource,
)
from dbgpt.util.i18n_utils import _
from dbgpt_serve.core import BaseServeConfig
@@ -11,6 +16,13 @@ SERVE_CONFIG_KEY_PREFIX = "dbgpt_rag"
SERVE_SERVICE_COMPONENT_NAME = f"{SERVE_APP_NAME}_service"
@auto_register_resource(
label=_("RAG Serve Configurations"),
category=ResourceCategory.RAG,
tags={"order": TAGS_ORDER_HIGH},
description=_("This configuration is for the RAG serve module."),
show_in_ui=False,
)
@dataclass
class ServeConfig(BaseServeConfig):
"""Parameters for the serve command"""