Files
DB-GPT/dbgpt/app/initialization/serve_initialization.py
明天 d5afa6e206 Native data AI application framework based on AWEL+AGENT (#1152)
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
Co-authored-by: lcx01800250 <lcx01800250@alibaba-inc.com>
Co-authored-by: licunxing <864255598@qq.com>
Co-authored-by: Aralhi <xiaoping0501@gmail.com>
Co-authored-by: xuyuan23 <643854343@qq.com>
Co-authored-by: aries_ckt <916701291@qq.com>
Co-authored-by: hzh97 <2976151305@qq.com>
2024-02-07 17:43:27 +08:00

46 lines
2.0 KiB
Python

from dbgpt._private.config import Config
from dbgpt.component import SystemApp
def register_serve_apps(system_app: SystemApp, cfg: Config):
"""Register serve apps"""
system_app.config.set("dbgpt.app.global.language", cfg.LANGUAGE)
# ################################ Prompt Serve Register Begin ######################################
from dbgpt.serve.prompt.serve import (
SERVE_CONFIG_KEY_PREFIX as PROMPT_SERVE_CONFIG_KEY_PREFIX,
)
from dbgpt.serve.prompt.serve import Serve as PromptServe
# Replace old prompt serve
# Set config
system_app.config.set(f"{PROMPT_SERVE_CONFIG_KEY_PREFIX}default_user", "dbgpt")
system_app.config.set(f"{PROMPT_SERVE_CONFIG_KEY_PREFIX}default_sys_code", "dbgpt")
# Register serve app
system_app.register(PromptServe, api_prefix="/prompt")
# ################################ Prompt Serve Register End ########################################
# ################################ Conversation Serve Register Begin ######################################
from dbgpt.serve.conversation.serve import (
SERVE_CONFIG_KEY_PREFIX as CONVERSATION_SERVE_CONFIG_KEY_PREFIX,
)
from dbgpt.serve.conversation.serve import Serve as ConversationServe
# Set config
system_app.config.set(
f"{CONVERSATION_SERVE_CONFIG_KEY_PREFIX}default_model", cfg.LLM_MODEL
)
# Register serve app
system_app.register(ConversationServe, api_prefix="/api/v1/chat/dialogue")
# ################################ Conversation Serve Register End ########################################
# ################################ AWEL Flow Serve Register Begin ######################################
from dbgpt.serve.flow.serve import (
SERVE_CONFIG_KEY_PREFIX as FLOW_SERVE_CONFIG_KEY_PREFIX,
)
from dbgpt.serve.flow.serve import Serve as FlowServe
# Register serve app
system_app.register(FlowServe)
# ################################ AWEL Flow Serve Register End ########################################