Skip to content

Commit

Permalink
fix:delete unusual code
Browse files Browse the repository at this point in the history
  • Loading branch information
Aries-ckt committed Aug 21, 2024
1 parent 09a854d commit fde8805
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 614 deletions.
4 changes: 0 additions & 4 deletions dbgpt/app/dbgpt_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ def mount_routers(app: FastAPI):

app.include_router(knowledge_router, tags=["Knowledge"])

from dbgpt.app.openapi.open_api_v1 import router as openapi_v1

app.include_router(openapi_v1, prefix="/openapi", tags=["OpenApi"])

from dbgpt.serve.agent.app.recommend_question.controller import (
router as recommend_question_v1,
)
Expand Down
27 changes: 0 additions & 27 deletions dbgpt/app/openapi/api_view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,33 +166,6 @@ class OpenAPIChatCompletionRequest(BaseModel):
)


class LinksFilters(BaseModel):
chatRoomId: Optional[str] = Field(None, description="chat room id")
chatRoomIds: Optional[str] = Field(None, description="chat room ids")


class LinksChatCompletionRequest(BaseModel):
conversation_id: Optional[str] = Field(None, description="conversation uid")
message_id: Optional[str] = Field(None, description="小蜜这边用户输入的消息Id")
filters: Optional[LinksFilters] = Field(
None,
description="小蜜 filters",
examples=None,
)
query: Optional[str] = Field(default=None, description="query")


class ScriptLink(BaseModel):
sequence: Optional[str] = Field(None, description="sequence")
title: Optional[str] = Field(None, description="title")
url: Optional[str] = Field(None, description="url")


class LinksChatExtraResponse(BaseModel):
gptModel: Optional[str] = Field(None, description="gpt model")
scriptLinks: Optional[List[ScriptLink]] = Field(None, description="scriptLinks")


class ChatType(Enum):
NORMAL = "normal"
APP = "app"
Expand Down
10 changes: 0 additions & 10 deletions dbgpt/app/openapi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,10 @@

from dbgpt._private.pydantic import model_to_dict
from dbgpt.app.openapi.api_view_model import Result
from dbgpt.app.openapi.open_api_v1 import OpenAPIException


async def validation_exception_handler(request: Request, exc: RequestValidationError):
message = ""
for error in exc.errors():
message += ".".join(error.get("loc")) + ":" + error.get("msg") + ";"
return Result.failed(code="E0001", msg=message)


async def openapi_validation_exception_handler(request: Request, exc: OpenAPIException):
res = Result.failed(
code=str(exc.body["error"]["code"]), msg=exc.body["error"]["message"]
)
return JSONResponse(
status_code=exc.body["error"]["code"], content=model_to_dict(res)
)
Loading

0 comments on commit fde8805

Please sign in to comment.