fix: typo error fix (#1228)

This commit is contained in:
magic.chen 2024-03-01 19:33:16 +08:00 committed by GitHub
parent 0e61c55e12
commit ed4df23e4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 39 additions and 37 deletions

View File

@ -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:

View File

@ -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(

View File

@ -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")

View File

@ -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]),

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -5,7 +5,7 @@ import requests
from dbgpt._private.config import Config
from ..command_mange import command
from ..command_manage import command
CFG = Config()

View File

@ -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")

View File

@ -2,7 +2,7 @@ import logging
from pandas import DataFrame
from ...command_mange import command
from ...command_manage import command
logger = logging.getLogger(__name__)

View File

@ -2,7 +2,7 @@ import logging
from pandas import DataFrame
from ...command_mange import command
from ...command_manage import command
logger = logging.getLogger(__name__)

View File

@ -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()

View File

@ -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

View File

@ -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):

View File

@ -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(

View File

@ -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

View File

@ -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

View File

@ -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: <api-call><name>[data display mode]</name><args><sql>[correct duckdb data analysis sql]</sql></args></api - call> 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部分转换为<api-call><name>[数据显示方式]</name><args><sql>[正确的duckdb数据分析sql]</sql></args></api- call> 这样的格式参考返回格式要求

View File

@ -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:

View File

@ -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,

View File

@ -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