mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-12 20:53:48 +00:00
feat(core): Add common schemas
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
"""App Client API."""
|
||||
from typing import List
|
||||
|
||||
from dbgpt.client import Client, ClientException
|
||||
from dbgpt.client.schemas import AppModel
|
||||
from dbgpt.serve.core import Result
|
||||
from dbgpt.core.schema.api import Result
|
||||
|
||||
from .client import Client, ClientException
|
||||
from .schema import AppModel
|
||||
|
||||
|
||||
async def get_app(client: Client, app_id: str) -> AppModel:
|
||||
|
@@ -5,10 +5,10 @@ from typing import Any, AsyncGenerator, List, Optional, Union
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import httpx
|
||||
from fastchat.protocol.api_protocol import ChatCompletionResponse
|
||||
|
||||
from dbgpt.app.openapi.api_view_model import ChatCompletionStreamResponse
|
||||
from dbgpt.client.schemas import ChatCompletionRequestBody
|
||||
from dbgpt.core.schema.api import ChatCompletionResponse, ChatCompletionStreamResponse
|
||||
|
||||
from .schema import ChatCompletionRequestBody
|
||||
|
||||
CLIENT_API_PATH = "/api"
|
||||
CLIENT_SERVE_PATH = "/serve"
|
||||
@@ -256,14 +256,14 @@ class Client:
|
||||
)
|
||||
yield chat_completion_response
|
||||
except Exception as e:
|
||||
yield f"data:[SERVER_ERROR]{str(e)}\n\n"
|
||||
raise e
|
||||
|
||||
else:
|
||||
try:
|
||||
error = await response.aread()
|
||||
yield json.loads(error)
|
||||
except Exception as e:
|
||||
yield f"data:[SERVER_ERROR]{str(e)}\n\n"
|
||||
raise e
|
||||
|
||||
async def get(self, path: str, *args):
|
||||
"""Get method.
|
||||
|
@@ -1,9 +1,10 @@
|
||||
"""this module contains the flow client functions."""
|
||||
from typing import List
|
||||
|
||||
from dbgpt.client import Client, ClientException
|
||||
from dbgpt.core.awel.flow.flow_factory import FlowPanel
|
||||
from dbgpt.serve.core import Result
|
||||
from dbgpt.core.schema.api import Result
|
||||
|
||||
from .client import Client, ClientException
|
||||
|
||||
|
||||
async def create_flow(client: Client, flow: FlowPanel) -> FlowPanel:
|
||||
|
@@ -2,9 +2,10 @@
|
||||
import json
|
||||
from typing import List
|
||||
|
||||
from dbgpt.client import Client, ClientException
|
||||
from dbgpt.client.schemas import DocumentModel, SpaceModel, SyncModel
|
||||
from dbgpt.serve.core import Result
|
||||
from dbgpt.core.schema.api import Result
|
||||
|
||||
from .client import Client, ClientException
|
||||
from .schema import DocumentModel, SpaceModel, SyncModel
|
||||
|
||||
|
||||
async def create_space(client: Client, space_model: SpaceModel) -> SpaceModel:
|
||||
|
@@ -4,8 +4,8 @@ from enum import Enum
|
||||
from typing import List, Optional, Union
|
||||
|
||||
from fastapi import File, UploadFile
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from dbgpt._private.pydantic import BaseModel, Field
|
||||
from dbgpt.agent.resource.resource_api import AgentResource
|
||||
from dbgpt.rag.chunk_manager import ChunkParameters
|
||||
|
Reference in New Issue
Block a user