Files
DB-GPT/pilot/scene/base.py
aries_ckt 71b9cd14a6 style:fmt
2023-08-29 19:57:33 +08:00

104 lines
2.7 KiB
Python

from enum import Enum
from typing import List
class Scene:
def __init__(
self,
code,
name,
describe,
param_types: List = [],
is_inner: bool = False,
show_disable=False,
prepare_scene_code: str = None,
):
self.code = code
self.name = name
self.describe = describe
self.param_types = param_types
self.is_inner = is_inner
self.show_disable = show_disable
self.prepare_scene_code = prepare_scene_code
class ChatScene(Enum):
ChatWithDbExecute = Scene(
code="chat_with_db_execute",
name="Chat Data",
describe="Dialogue with your private data through natural language.",
param_types=["DB Select"],
)
ExcelLearning = Scene(
code="excel_learning",
name="Excel Learning",
describe="Analyze and summarize your excel files.",
is_inner=True,
)
ChatExcel = Scene(
code="chat_excel",
name="Chat Excel",
describe="Dialogue with your excel, use natural language.",
param_types=["File Select"],
prepare_scene_code="excel_learning",
)
ChatWithDbQA = Scene(
code="chat_with_db_qa",
name="Chat DB",
describe="Have a Professional Conversation with Metadata.",
param_types=["DB Select"],
)
ChatExecution = Scene(
code="chat_execution",
name="Use Plugin",
describe="Use tools through dialogue to accomplish your goals.",
param_types=["Plugin Select"],
)
InnerChatDBSummary = Scene(
"inner_chat_db_summary", "DB Summary", "Db Summary.", True
)
ChatNormal = Scene(
"chat_normal", "Chat Normal", "Native LLM large model AI dialogue."
)
ChatDashboard = Scene(
"chat_dashboard",
"Dashboard",
"Provide you with professional analysis reports through natural language.",
["DB Select"],
)
ChatKnowledge = Scene(
"chat_knowledge",
"Chat Knowledge",
"Dialogue through natural language and private documents and knowledge bases.",
["Knowledge Space Select"],
)
@staticmethod
def of_mode(mode):
return [x for x in ChatScene._value_ if x.code == mode][0]
@staticmethod
def is_valid_mode(mode):
return any(mode == item.value() for item in ChatScene)
def value(self):
return self._value_.code
def scene_name(self):
return self._value_.name
def describe(self):
return self._value_.describe
def param_types(self):
return self._value_.param_types
def show_disable(self):
return self._value_.show_disable
def is_inner(self):
return self._value_.is_inner