DB-GPT问题记录

问题:安装社区DBGPTS报错:”DB-GPT”社区PermissionError(13, ‘另一个程序正在使用此文件,进程无法访问。’)
解决:pip install poetry

问题:保存flow流程报错:

1
2
3
4
5
dbgpt.serve.core.schemas[10072] ERROR common_exception_handler catch Exception: success=False err_code='E0003' err_msg="Unable to 
generate pydantic-core schema for <class 'dbgpt.core.awel.dag.base.DAG'>. Set `arbitrary_types_allowed=True` in the model_config to ignore this error or implement
`__get_pydantic_core_schema__` on your type to fully support it.\n\nIf you got this error by calling handler(<some type>) within `__get_pydantic_core_schema__` the
n you likely need to call `handler.generate_schema(<some type>)` since we do not call `__get_pydantic_core_schema__` on `<some type>` otherwise to avoid infinite r
ecursion.\n\nFor further information visit https://errors.pydantic.dev/2.7/u/schema-for-unknown-type" data=None

解决:pip install fastapi==0.111.0

问题:安装社区RAG聊天报错[SERVER_ERROR]No module named ‘langchain’
解决:pip install langchainpip install langchain-community

问题:导入0.6.1 dbgpt,提示缺包
解决,降低版本到0.5.10

问题:0.6.1版本的tool有bug,只有baidu_search生效,其它都不行,看了下代码,是因为在build_resource的version参数没传,导致只获取第一个注册的tool,
解决:agent_operator.py 的get_agent方法加个, version=”v1”
resource = get_resource_manager().build_resource(self.awel_agent.resources, version=”v1”)

问题:打印一堆没用的流式输出日志
解决:注释掉output_parser.py打印代码print(“un_stream ai response:”, ai_response)

问题:AWEL绑定多了资源时,无法正常运行,只能一个生效
是因为保存的时候,前端传递参数的时候,并没有把列表传给后端,这个可以用导入手动编辑改成列表的方式,再导入到AWEL流程里,再保存,但是在flow_factory.py中的def build(self, flow_panel: FlowPanel) -> DAG:方法,

1
2
3
4
5
6
7
8
9
10
11
12
for i, param in enumerate(target_node.data.parameters):  
if i == target_order:
if param.category != "resource":
err_msg = (
f"Unable to connect resource to resource, "
f"target_order: {target_order}, parameter name: "
f"{param.name}, param category: {param.category}"
)
logger.warning(err_msg)
raise ValueError(err_msg)
param.value = source_key
has_matched = True

param.value = source_key 把值给改回去了
可以把这个代码给注释掉,但是后面再保存的时候,还是会解析报错
想到一种更简单的方式,在绑定方法时候,方法名用逗号隔开,然后解析的时候,自己再循环处理下

在manage.py的build_resource方法里,修改

1
2
3
4
5
6
7
8
9
10
# 根据resource.value字符串中的,分割,获取多个资源  
for item in resource.value.split(","):
resource_inst = self.build_resource_by_type(
resource.type, AgentResource(type=resource.type, value=item), version=version
)
dependencies.append(resource_inst)
# resource_inst = self.build_resource_by_type(
# resource.type, resource, version=version
# )
# dependencies.append(resource_inst)