From de3bcd1f683e22918e7a0c4a03ed5e1c7d2cf1ac Mon Sep 17 00:00:00 2001 From: yhjun1026 <460342015@qq.com> Date: Wed, 2 Aug 2023 16:38:29 +0800 Subject: [PATCH] fix(readme): discord id change discord id change --- pilot/openapi/api_v1/editor/api_editor_v1.py | 8 ++++++++ pilot/openapi/editor_view_model.py | 13 +++++++++++++ pilot/server/dbgpt_server.py | 12 ++++++------ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/pilot/openapi/api_v1/editor/api_editor_v1.py b/pilot/openapi/api_v1/editor/api_editor_v1.py index 2fd287766..fbb92353d 100644 --- a/pilot/openapi/api_v1/editor/api_editor_v1.py +++ b/pilot/openapi/api_v1/editor/api_editor_v1.py @@ -28,6 +28,7 @@ from pilot.openapi.editor_view_model import ( ChartDetail, ChatChartEditContext, ChatSqlEditContext, + DbTable ) from pilot.scene.chat_dashboard.data_preparation.report_schma import ChartData @@ -40,6 +41,13 @@ CHAT_FACTORY = ChatFactory() logger = build_logger("api_editor_v1", LOGDIR + "api_editor_v1.log") +@router.get("/v1/editor/db/tables", response_model=Result[DbTable]) +async def get_editor_tables(db_name: str, page_index: int, page_size: int, search_str: str= ""): + return Result.succ(None) + + + + @router.get("/v1/editor/sql/rounds", response_model=Result[ChatDbRounds]) async def get_editor_sql_rounds(con_uid: str): return Result.succ(None) diff --git a/pilot/openapi/editor_view_model.py b/pilot/openapi/editor_view_model.py index ce81c0d6a..242affede 100644 --- a/pilot/openapi/editor_view_model.py +++ b/pilot/openapi/editor_view_model.py @@ -2,6 +2,19 @@ from pydantic import BaseModel, Field from typing import TypeVar, Union, List, Generic, Any +class DbField(BaseModel): + colunm_name: str + type: str + colunm_len: str + can_null: bool = True + default_value: str = "" + comment: str = "" + +class DbTable(BaseModel): + table_name: str + comment: str + colunm: List[DbField] + class ChatDbRounds(BaseModel): round: int db_name: str diff --git a/pilot/server/dbgpt_server.py b/pilot/server/dbgpt_server.py index f48c7cd50..54f73f576 100644 --- a/pilot/server/dbgpt_server.py +++ b/pilot/server/dbgpt_server.py @@ -70,13 +70,13 @@ app.add_middleware( ) -# app.include_router(api_v1, prefix="/api") -# app.include_router(knowledge_router, prefix="/api") -# app.include_router(api_editor_route_v1, prefix="/api") +app.include_router(api_v1, prefix="/api") +app.include_router(knowledge_router, prefix="/api") +app.include_router(api_editor_route_v1, prefix="/api") -app.include_router(api_v1) -app.include_router(knowledge_router) -app.include_router(api_editor_route_v1) +# app.include_router(api_v1) +# app.include_router(knowledge_router) +# app.include_router(api_editor_route_v1) app.mount("/_next/static", StaticFiles(directory=static_file_path + "/_next/static")) app.mount("/", StaticFiles(directory=static_file_path, html=True), name="static")