feat(core): Support multi round conversation operator (#986)

This commit is contained in:
Fangyin Cheng
2023-12-27 23:26:28 +08:00
committed by GitHub
parent 9aec636b02
commit b13d3f6d92
63 changed files with 2011 additions and 314 deletions

View File

@@ -1,13 +1,28 @@
from dbgpt.component import SystemApp
from dbgpt._private.config import Config
def register_serve_apps(system_app: SystemApp):
def register_serve_apps(system_app: SystemApp, cfg: Config):
"""Register serve apps"""
from dbgpt.serve.prompt.serve import Serve as PromptServe, SERVE_CONFIG_KEY_PREFIX
system_app.config.set("dbgpt.app.global.language", cfg.LANGUAGE)
# ################################ Prompt Serve Register Begin ######################################
from dbgpt.serve.prompt.serve import (
Serve as PromptServe,
SERVE_CONFIG_KEY_PREFIX as PROMPT_SERVE_CONFIG_KEY_PREFIX,
)
# Replace old prompt serve
# Set config
system_app.config.set(f"{SERVE_CONFIG_KEY_PREFIX}default_user", "dbgpt")
system_app.config.set(f"{SERVE_CONFIG_KEY_PREFIX}default_sys_code", "dbgpt")
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 as ConversationServe
# Register serve app
system_app.register(ConversationServe)
# ################################ Conversation Serve Register End ########################################