From ed4df23e4e6b18f29061460cb7ff21aea9ebd4b5 Mon Sep 17 00:00:00 2001 From: "magic.chen" Date: Fri, 1 Mar 2024 19:33:16 +0800 Subject: [PATCH] fix: typo error fix (#1228) --- dbgpt/_private/config.py | 4 ++-- dbgpt/agent/actions/chart_action.py | 2 +- dbgpt/agent/actions/code_action.py | 2 +- dbgpt/agent/actions/dashboard_action.py | 2 +- dbgpt/agent/actions/indicator_action.py | 2 +- dbgpt/agent/actions/plugin_action.py | 2 +- .../agents/expand/dashboard_assistant_agent.py | 2 +- .../expand/retrieve_summary_assistant_agent.py | 2 +- dbgpt/agent/memory/gpts_memory.py | 4 ++-- .../plugin/commands/built_in/audio_text.py | 2 +- .../{disply_type => display_type}/__init__.py | 0 .../show_chart_gen.py | 2 +- .../show_table_gen.py | 2 +- .../show_text_gen.py | 2 +- .../plugin/commands/built_in/image_gen.py | 2 +- .../{command_mange.py => command_manage.py} | 0 dbgpt/agent/resource/resource_plugin_api.py | 2 +- dbgpt/app/base.py | 18 +++++++++--------- dbgpt/app/dbgpt_server.py | 4 +++- dbgpt/app/scene/chat_agent/chat.py | 2 +- .../chat_data/chat_excel/excel_analyze/chat.py | 6 +++--- .../chat_excel/excel_analyze/prompt.py | 4 ++-- dbgpt/app/scene/chat_db/auto_execute/chat.py | 4 ++-- dbgpt/serve/agent/team/plan/plan_action.py | 2 +- dbgpt/vis/base.py | 2 +- 25 files changed, 39 insertions(+), 37 deletions(-) rename dbgpt/agent/plugin/commands/built_in/{disply_type => display_type}/__init__.py (100%) rename dbgpt/agent/plugin/commands/built_in/{disply_type => display_type}/show_chart_gen.py (99%) rename dbgpt/agent/plugin/commands/built_in/{disply_type => display_type}/show_table_gen.py (93%) rename dbgpt/agent/plugin/commands/built_in/{disply_type => display_type}/show_text_gen.py (96%) rename dbgpt/agent/plugin/commands/{command_mange.py => command_manage.py} (100%) diff --git a/dbgpt/_private/config.py b/dbgpt/_private/config.py index 74a0e6308..f1b418229 100644 --- a/dbgpt/_private/config.py +++ b/dbgpt/_private/config.py @@ -133,8 +133,8 @@ class Config(metaclass=Singleton): ### Related configuration of built-in commands self.command_registry = [] - ### Relate configuration of disply commands - self.command_disply = [] + ### Relate configuration of display commands + self.command_dispaly = [] disabled_command_categories = os.getenv("DISABLED_COMMAND_CATEGORIES") if disabled_command_categories: diff --git a/dbgpt/agent/actions/chart_action.py b/dbgpt/agent/actions/chart_action.py index 1387779d9..226201303 100644 --- a/dbgpt/agent/actions/chart_action.py +++ b/dbgpt/agent/actions/chart_action.py @@ -65,7 +65,7 @@ class ChartAction(Action[SqlInput]): "There is no implementation class bound to database resource execution!" ) data_df = await resource_db_client.a_query_to_df(resource.value, param.sql) - view = await self.render_protocal.disply( + view = await self.render_protocal.display( chart=json.loads(param.json()), data_df=data_df ) return ActionOutput( diff --git a/dbgpt/agent/actions/code_action.py b/dbgpt/agent/actions/code_action.py index 6a9672801..6e8dc77ab 100644 --- a/dbgpt/agent/actions/code_action.py +++ b/dbgpt/agent/actions/code_action.py @@ -65,7 +65,7 @@ class CodeAction(Action[None]): param["language"] = code_blocks[0][0] param["code"] = code_blocks param["log"] = logs - view = await self.render_protocal.disply(content=param) + view = await self.render_protocal.display(content=param) return ActionOutput(is_exe_success=exit_success, content=content, view=view) except Exception as e: logger.exception("Code Action Run Failed!") diff --git a/dbgpt/agent/actions/dashboard_action.py b/dbgpt/agent/actions/dashboard_action.py index d0472c09b..ae272824a 100644 --- a/dbgpt/agent/actions/dashboard_action.py +++ b/dbgpt/agent/actions/dashboard_action.py @@ -82,7 +82,7 @@ class DashboardAction(Action[List[ChartItem]]): logger.warn(f"Sql excute Failed!{str(e)}") chart_dict["err_msg"] = str(e) chart_params.append(chart_dict) - view = await self.render_protocal.disply(charts=chart_params) + view = await self.render_protocal.display(charts=chart_params) return ActionOutput( is_exe_success=True, content=json.dumps([chart_item.dict() for chart_item in chart_items]), diff --git a/dbgpt/agent/actions/indicator_action.py b/dbgpt/agent/actions/indicator_action.py index f244b6ff0..dcc0023d1 100644 --- a/dbgpt/agent/actions/indicator_action.py +++ b/dbgpt/agent/actions/indicator_action.py @@ -118,7 +118,7 @@ class IndicatorAction(Action[IndicatorInput]): "err_msg": err_msg, } - view = await self.render_protocal.disply(content=plugin_param) + view = await self.render_protocal.display(content=plugin_param) return ActionOutput( is_exe_success=response_success, content=response.text, view=view diff --git a/dbgpt/agent/actions/plugin_action.py b/dbgpt/agent/actions/plugin_action.py index 4fb80ef7a..ab402e451 100644 --- a/dbgpt/agent/actions/plugin_action.py +++ b/dbgpt/agent/actions/plugin_action.py @@ -106,7 +106,7 @@ class PluginAction(Action[PluginInput]): "err_msg": err_msg, } - view = await self.render_protocal.disply(content=plugin_param) + view = await self.render_protocal.display(content=plugin_param) return ActionOutput( is_exe_success=response_success, content=tool_result, view=view diff --git a/dbgpt/agent/agents/expand/dashboard_assistant_agent.py b/dbgpt/agent/agents/expand/dashboard_assistant_agent.py index e962cb717..6f122dbfd 100644 --- a/dbgpt/agent/agents/expand/dashboard_assistant_agent.py +++ b/dbgpt/agent/agents/expand/dashboard_assistant_agent.py @@ -2,7 +2,7 @@ import json from typing import Callable, Dict, List, Literal, Optional, Union from dbgpt.agent.actions.dashboard_action import DashboardAction -from dbgpt.agent.plugin.commands.command_mange import ApiCall +from dbgpt.agent.plugin.commands.command_manage import ApiCall from dbgpt.util.json_utils import find_json_objects from ...memory.gpts_memory import GptsMemory diff --git a/dbgpt/agent/agents/expand/retrieve_summary_assistant_agent.py b/dbgpt/agent/agents/expand/retrieve_summary_assistant_agent.py index f86553d3a..6d492121a 100644 --- a/dbgpt/agent/agents/expand/retrieve_summary_assistant_agent.py +++ b/dbgpt/agent/agents/expand/retrieve_summary_assistant_agent.py @@ -15,7 +15,7 @@ from bs4 import BeautifulSoup from dbgpt.agent.agents.agent import Agent, AgentContext from dbgpt.agent.agents.base_agent import ConversableAgent from dbgpt.agent.memory.gpts_memory import GptsMemory -from dbgpt.agent.plugin.commands.command_mange import ApiCall +from dbgpt.agent.plugin.commands.command_manage import ApiCall from dbgpt.configs.model_config import PILOT_PATH from dbgpt.core.interface.message import ModelMessageRoleType diff --git a/dbgpt/agent/memory/gpts_memory.py b/dbgpt/agent/memory/gpts_memory.py index 6b5a785de..94c9af19e 100644 --- a/dbgpt/agent/memory/gpts_memory.py +++ b/dbgpt/agent/memory/gpts_memory.py @@ -102,11 +102,11 @@ class GptsMemory: "markdown": view_info, } ) - return await vis_client.get(VisAgentMessages.vis_tag()).disply( + return await vis_client.get(VisAgentMessages.vis_tag()).display( content=messages_view ) async def _messages_to_plan_vis(self, messages: List[Dict]): if messages is None or len(messages) <= 0: return "" - return await vis_client.get(VisAgentPlans.vis_tag()).disply(content=messages) + return await vis_client.get(VisAgentPlans.vis_tag()).display(content=messages) diff --git a/dbgpt/agent/plugin/commands/built_in/audio_text.py b/dbgpt/agent/plugin/commands/built_in/audio_text.py index f10f940f8..b21ac3253 100644 --- a/dbgpt/agent/plugin/commands/built_in/audio_text.py +++ b/dbgpt/agent/plugin/commands/built_in/audio_text.py @@ -5,7 +5,7 @@ import requests from dbgpt._private.config import Config -from ..command_mange import command +from ..command_manage import command CFG = Config() diff --git a/dbgpt/agent/plugin/commands/built_in/disply_type/__init__.py b/dbgpt/agent/plugin/commands/built_in/display_type/__init__.py similarity index 100% rename from dbgpt/agent/plugin/commands/built_in/disply_type/__init__.py rename to dbgpt/agent/plugin/commands/built_in/display_type/__init__.py diff --git a/dbgpt/agent/plugin/commands/built_in/disply_type/show_chart_gen.py b/dbgpt/agent/plugin/commands/built_in/display_type/show_chart_gen.py similarity index 99% rename from dbgpt/agent/plugin/commands/built_in/disply_type/show_chart_gen.py rename to dbgpt/agent/plugin/commands/built_in/display_type/show_chart_gen.py index 33d4706f9..382ae418a 100644 --- a/dbgpt/agent/plugin/commands/built_in/disply_type/show_chart_gen.py +++ b/dbgpt/agent/plugin/commands/built_in/display_type/show_chart_gen.py @@ -13,7 +13,7 @@ from pandas import DataFrame from dbgpt.configs.model_config import PILOT_PATH from dbgpt.util.string_utils import is_scientific_notation -from ...command_mange import command +from ...command_manage import command matplotlib.use("Agg") diff --git a/dbgpt/agent/plugin/commands/built_in/disply_type/show_table_gen.py b/dbgpt/agent/plugin/commands/built_in/display_type/show_table_gen.py similarity index 93% rename from dbgpt/agent/plugin/commands/built_in/disply_type/show_table_gen.py rename to dbgpt/agent/plugin/commands/built_in/display_type/show_table_gen.py index d0457bb40..aa97df665 100644 --- a/dbgpt/agent/plugin/commands/built_in/disply_type/show_table_gen.py +++ b/dbgpt/agent/plugin/commands/built_in/display_type/show_table_gen.py @@ -2,7 +2,7 @@ import logging from pandas import DataFrame -from ...command_mange import command +from ...command_manage import command logger = logging.getLogger(__name__) diff --git a/dbgpt/agent/plugin/commands/built_in/disply_type/show_text_gen.py b/dbgpt/agent/plugin/commands/built_in/display_type/show_text_gen.py similarity index 96% rename from dbgpt/agent/plugin/commands/built_in/disply_type/show_text_gen.py rename to dbgpt/agent/plugin/commands/built_in/display_type/show_text_gen.py index 37caf6fe5..498ec618e 100644 --- a/dbgpt/agent/plugin/commands/built_in/disply_type/show_text_gen.py +++ b/dbgpt/agent/plugin/commands/built_in/display_type/show_text_gen.py @@ -2,7 +2,7 @@ import logging from pandas import DataFrame -from ...command_mange import command +from ...command_manage import command logger = logging.getLogger(__name__) diff --git a/dbgpt/agent/plugin/commands/built_in/image_gen.py b/dbgpt/agent/plugin/commands/built_in/image_gen.py index b0db4b8db..ec7252f67 100644 --- a/dbgpt/agent/plugin/commands/built_in/image_gen.py +++ b/dbgpt/agent/plugin/commands/built_in/image_gen.py @@ -9,7 +9,7 @@ from PIL import Image from dbgpt._private.config import Config -from ..command_mange import command +from ..command_manage import command logger = logging.getLogger(__name__) CFG = Config() diff --git a/dbgpt/agent/plugin/commands/command_mange.py b/dbgpt/agent/plugin/commands/command_manage.py similarity index 100% rename from dbgpt/agent/plugin/commands/command_mange.py rename to dbgpt/agent/plugin/commands/command_manage.py diff --git a/dbgpt/agent/resource/resource_plugin_api.py b/dbgpt/agent/resource/resource_plugin_api.py index e0eaee29a..1f5b4458d 100644 --- a/dbgpt/agent/resource/resource_plugin_api.py +++ b/dbgpt/agent/resource/resource_plugin_api.py @@ -2,7 +2,7 @@ import logging import os from typing import Optional -from dbgpt.agent.plugin.commands.command_mange import execute_command +from dbgpt.agent.plugin.commands.command_manage import execute_command from dbgpt.agent.plugin.generator import PluginPromptGenerator from dbgpt.agent.plugin.plugins_util import scan_plugin_file, scan_plugins from dbgpt.agent.resource.resource_api import AgentResource diff --git a/dbgpt/app/base.py b/dbgpt/app/base.py index 3674acca1..d92dda5ad 100644 --- a/dbgpt/app/base.py +++ b/dbgpt/app/base.py @@ -31,7 +31,7 @@ def async_db_summary(system_app: SystemApp): def server_init(param: "WebServerParameters", system_app: SystemApp): - from dbgpt.agent.plugin.commands.command_mange import CommandRegistry + from dbgpt.agent.plugin.commands.command_manage import CommandRegistry # logger.info(f"args: {args}") # init config @@ -58,15 +58,15 @@ def server_init(param: "WebServerParameters", system_app: SystemApp): cfg.command_registry = command_registry - command_disply_commands = [ - "dbgpt.agent.plugin.commands.built_in.disply_type.show_chart_gen", - "dbgpt.agent.plugin.commands.built_in.disply_type.show_table_gen", - "dbgpt.agent.plugin.commands.built_in.disply_type.show_text_gen", + command_dispaly_commands = [ + "dbgpt.agent.plugin.commands.built_in.display_type.show_chart_gen", + "dbgpt.agent.plugin.commands.built_in.display_type.show_table_gen", + "dbgpt.agent.plugin.commands.built_in.display_type.show_text_gen", ] - command_disply_registry = CommandRegistry() - for command in command_disply_commands: - command_disply_registry.import_commands(command) - cfg.command_disply = command_disply_registry + command_dispaly_registry = CommandRegistry() + for command in command_dispaly_commands: + command_dispaly_registry.import_commands(command) + cfg.command_display = command_dispaly_commands def _create_model_start_listener(system_app: SystemApp): diff --git a/dbgpt/app/dbgpt_server.py b/dbgpt/app/dbgpt_server.py index 892cd0937..df6cdb9d4 100644 --- a/dbgpt/app/dbgpt_server.py +++ b/dbgpt/app/dbgpt_server.py @@ -101,7 +101,9 @@ def mount_routers(app: FastAPI): def mount_static_files(app: FastAPI): - from dbgpt.agent.plugin.commands.built_in.disply_type import static_message_img_path + from dbgpt.agent.plugin.commands.built_in.display_type import ( + static_message_img_path, + ) os.makedirs(static_message_img_path, exist_ok=True) app.mount( diff --git a/dbgpt/app/scene/chat_agent/chat.py b/dbgpt/app/scene/chat_agent/chat.py index 7f29d6019..a41782c54 100644 --- a/dbgpt/app/scene/chat_agent/chat.py +++ b/dbgpt/app/scene/chat_agent/chat.py @@ -2,7 +2,7 @@ import logging from typing import Dict, List from dbgpt._private.config import Config -from dbgpt.agent.plugin.commands.command_mange import ApiCall +from dbgpt.agent.plugin.commands.command_manage import ApiCall from dbgpt.agent.plugin.generator import PluginPromptGenerator from dbgpt.app.scene import BaseChat, ChatScene from dbgpt.component import ComponentType diff --git a/dbgpt/app/scene/chat_data/chat_excel/excel_analyze/chat.py b/dbgpt/app/scene/chat_data/chat_excel/excel_analyze/chat.py index fa96b7a76..5ec50400d 100644 --- a/dbgpt/app/scene/chat_data/chat_excel/excel_analyze/chat.py +++ b/dbgpt/app/scene/chat_data/chat_excel/excel_analyze/chat.py @@ -3,7 +3,7 @@ import os from typing import Dict from dbgpt._private.config import Config -from dbgpt.agent.plugin.commands.command_mange import ApiCall +from dbgpt.agent.plugin.commands.command_manage import ApiCall from dbgpt.app.scene import BaseChat, ChatScene from dbgpt.app.scene.chat_data.chat_excel.excel_learning.chat import ExcelLearning from dbgpt.app.scene.chat_data.chat_excel.excel_reader import ExcelReader @@ -45,7 +45,7 @@ class ChatExcel(BaseChat): KNOWLEDGE_UPLOAD_ROOT_PATH, chat_mode.value(), self.select_param ) ) - self.api_call = ApiCall(display_registry=CFG.command_disply) + self.api_call = ApiCall(display_registry=CFG.command_display) super().__init__(chat_param=chat_param) @trace() @@ -53,7 +53,7 @@ class ChatExcel(BaseChat): input_values = { "user_input": self.current_user_input, "table_name": self.excel_reader.table_name, - "disply_type": self._generate_numbered_list(), + "display_type": self._generate_numbered_list(), } return input_values diff --git a/dbgpt/app/scene/chat_data/chat_excel/excel_analyze/prompt.py b/dbgpt/app/scene/chat_data/chat_excel/excel_analyze/prompt.py index 49eebd37e..dceac7cdb 100644 --- a/dbgpt/app/scene/chat_data/chat_excel/excel_analyze/prompt.py +++ b/dbgpt/app/scene/chat_data/chat_excel/excel_analyze/prompt.py @@ -19,7 +19,7 @@ Please use the data structure column analysis information generated in the above Constraint: 1.Please fully understand the user's problem and use duckdb sql for analysis. The analysis content is returned in the output format required below. Please output the sql in the corresponding sql parameter. - 2.Please choose the best one from the display methods given below for data rendering, and put the type name into the name parameter value that returns the required format. If you cannot find the most suitable one, use 'Table' as the display method. , the available data display methods are as follows: {disply_type} + 2.Please choose the best one from the display methods given below for data rendering, and put the type name into the name parameter value that returns the required format. If you cannot find the most suitable one, use 'Table' as the display method. , the available data display methods are as follows: {display_type} 3.The table name that needs to be used in SQL is: {table_name}. Please check the sql you generated and do not use column names that are not in the data structure. 4.Give priority to answering using data analysis. If the user's question does not involve data analysis, you can answer according to your understanding. 5.The sql part of the output content is converted to: [data display mode][correct duckdb data analysis sql] For this format, please refer to the return format requirements. @@ -36,7 +36,7 @@ _DEFAULT_TEMPLATE_ZH = """ 请使用历史对话中的数据结构信息,在满足下面约束条件下通过duckdb sql数据分析回答用户的问题。 约束条件: 1.请充分理解用户的问题,使用duckdb sql的方式进行分析, 分析内容按下面要求的输出格式返回,sql请输出在对应的sql参数中 - 2.请从如下给出的展示方式种选择最优的一种用以进行数据渲染,将类型名称放入返回要求格式的name参数值种,如果找不到最合适的则使用'Table'作为展示方式,可用数据展示方式如下: {disply_type} + 2.请从如下给出的展示方式种选择最优的一种用以进行数据渲染,将类型名称放入返回要求格式的name参数值种,如果找不到最合适的则使用'Table'作为展示方式,可用数据展示方式如下: {display_type} 3.SQL中需要使用的表名是: {table_name},请检查你生成的sql,不要使用没在数据结构中的列名 4.优先使用数据分析的方式回答,如果用户问题不涉及数据分析内容,你可以按你的理解进行回答 5.输出内容中sql部分转换为:[数据显示方式][正确的duckdb数据分析sql] 这样的格式,参考返回格式要求 diff --git a/dbgpt/app/scene/chat_db/auto_execute/chat.py b/dbgpt/app/scene/chat_db/auto_execute/chat.py index 8b59aeb42..478ccc482 100644 --- a/dbgpt/app/scene/chat_db/auto_execute/chat.py +++ b/dbgpt/app/scene/chat_db/auto_execute/chat.py @@ -1,7 +1,7 @@ from typing import Dict from dbgpt._private.config import Config -from dbgpt.agent.plugin.commands.command_mange import ApiCall +from dbgpt.agent.plugin.commands.command_manage import ApiCall from dbgpt.app.scene import BaseChat, ChatScene from dbgpt.util.executor_utils import blocking_func_to_async from dbgpt.util.tracer import root_tracer, trace @@ -40,7 +40,7 @@ class ChatWithDbAutoExecute(BaseChat): self.database = CFG.LOCAL_DB_MANAGE.get_connect(self.db_name) self.top_k: int = 50 - self.api_call = ApiCall(display_registry=CFG.command_disply) + self.api_call = ApiCall(display_registry=CFG.command_display) @trace() async def generate_input_values(self) -> Dict: diff --git a/dbgpt/serve/agent/team/plan/plan_action.py b/dbgpt/serve/agent/team/plan/plan_action.py index eae84f6e1..61b221662 100644 --- a/dbgpt/serve/agent/team/plan/plan_action.py +++ b/dbgpt/serve/agent/team/plan/plan_action.py @@ -105,7 +105,7 @@ class PlanAction(Action[List[PlanInput]]): f"- {item.serial_number}.{item.content}[{item.agent}]" ) - # view = await self.render_protocal.disply(content=plan_content) + # view = await self.render_protocal.display(content=plan_content) view = "\n".join(mk_plans) return ActionOutput( is_exe_success=True, diff --git a/dbgpt/vis/base.py b/dbgpt/vis/base.py index 7d8d0791f..1c1851044 100644 --- a/dbgpt/vis/base.py +++ b/dbgpt/vis/base.py @@ -20,7 +20,7 @@ class Vis: """ return kwargs["content"] - async def disply(self, **kwargs) -> Optional[str]: + async def display(self, **kwargs) -> Optional[str]: return f"```{self.vis_tag()}\n{json.dumps(await self.generate_param(**kwargs), default=serialize, ensure_ascii=False)}\n```" @classmethod