Closed fywang2 closed 7 months ago
close due to duplicate
@liqul - which issue is the duplicate? When closing as duplicate please provide the other issue.
@liqul - which issue is the duplicate? When closing as duplicate please provide the other issue.
1、Docker host operating system:ubuntun 22.04 desktop
2、Run TaskWeaver using the All-in-One Docker Image: sudo docker run -it \ --name taskweaver \ --privileged \ --net=host \ -e "LLM_API_KEY=sk-0f67XXXX" \ -e "LLM_API_TYPE=qwen" \ -e "LLM_MODEL=qwen-max" \ -e "TASKWEAVER_UID=0" \ -e "TASKWEAVER_GID=0" \ -p 8000:8000 \ -v /data/workspace/vscode/vscodeProjects/taskWeaverFromContaner/project:/app/project \ --entrypoint /app/entrypoint_chainlit.sh \ taskweavercontainers/taskweaver-all-in-one:latest
3、plugin file: sql_pull_mysql_data.py import pandas as pd
from taskweaver.plugin import Plugin, register_plugin
import pymysql
@register_plugin class SqlPullMysqlData(Plugin):
class SqlPullMysqlData():
""" 常用模块:读写MySQL """ def get_conn(): omit some codes
def query_data(sql): omit some codes
4、plugin file: sql_pull_mysql_data.yaml name: sql_pull_mysql_data code: sql_pull_mysql_data enabled: true required: true description: >- 获取产业工人项目数据。 当向用户的答复涉及本插件时,请以中文答复。 不需要把用户输入的自然语言转换为数据库SQL。 以Markdown表格形式展示给用户。 (omit some descriptions)
examples: |- df, description = sql_pull_mysql_data("从数据库查询产业工人项目列表")
parameters:
returns:
5、Installing pymysql in the Docker container docker exec -it taskweaver /bin/bash pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple pip config list pip install pymysql
6、When asking “显示产业工人项目”,Taskweaver execute the plugin sql_pull_mysql_data, then the backend execption logs: 2024-04-16 15:08:06 - LLM output: {"response": [{"type": "init_plan", "content": "1. 使用sql_pull_mysql_data插件获取产业工人项目数据"}, {"type": "plan", "content": "1. 使用sql_pull_mysql_data插件获取产业工人项目数据"}, {"type": "current_plan_step", "content": "1. 使用sql_pull_mysql_data插件获取产业工人项目数据"}, {"type": "send_to", "content": "sql_pull_mysql_data"}, {"type": "message", "content": "请使用插件功能获取产业工人项目数据"}], "execute_code": true} 2024-04-16 15:08:06 - Planner talk to sql_pull_mysql_data: 请使用插件功能获取产业工人项目数据 2024-04-16 15:08:06 - Traceback (most recent call last): File "/app/playground/UI/../../taskweaver/session/session.py", line 194, in _send_text_message post = _send_message(post.send_to, post) File "/app/playground/UI/../../taskweaver/module/tracing.py", line 174, in wrapper return func(*args, **kwargs) File "/app/playground/UI/../../taskweaver/session/session.py", line 182, in _send_message raise Exception(f"Unknown recipient {recipient}") Exception: Unknown recipient sql_pull_mysql_data