eosphoros-ai / DB-GPT

AI Native Data App Development framework with AWEL(Agentic Workflow Expression Language) and Agents
http://docs.dbgpt.cn
MIT License
13.15k stars 1.74k forks source link

[Bug] [TEXT2SQL] There will be an error if there is a “<” symbol in the SQL statement. #1649

Closed LXlearning closed 1 month ago

LXlearning commented 2 months ago

Search before asking

Operating system information

Linux

Python version information

=3.11

DB-GPT version

main

Related scenes

Installation Information

Device information

GPI count 1 : 24G

Models information

LLM: chatglm3-6b

What happened

对用户说的想法摘要.[response_table]SELECT * FROM excel_data WHERE "月工资金额" < 2000--- Logging error --- Traceback (most recent call last): File "/Users/luoxin/Desktop/git_repo/DB-GPT-main/dbgpt/agent/util/api_call.py", line 283, in display_sql_llmvis self.update_from_context(llm_text) File "/Users/luoxin/Desktop/git_repo/DB-GPT-main/dbgpt/agent/util/api_call.py", line 159, in update_from_context api_call_element = ET.fromstring(api_context) File "/Users/luoxin/miniforge3/envs/lx/dbgpt_env/lib/python3.10/xml/etree/ElementTree.py", line 1347, in XML parser.feed(text) xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 90

During handling of the above exception, another exception occurred:

What you expected to happen

该输出结果应该可以被update_from_context方法所解析: <api-call><name>[response_table]</name><args><sql>SELECT * FROM excel_data WHERE "月工资金额" < 2000</sql></args></api-call>

How to reproduce

revise ./dbgpt/agent/util/api_call.py in update_from_context

    def update_from_context(self, all_context):
        """Modify the plugin status map based on the context."""
        api_context_map: Dict[int, str] = extract_content(
            all_context, self.agent_prefix, self.agent_end, True
        )
        for api_index, api_context in api_context_map.items():
            api_context = api_context.replace("\\n", "").replace("\n", "")
            api_call_element = ET.fromstring(api_context)

Additional context

No response

Are you willing to submit PR?

github-actions[bot] commented 1 month ago

This issue has been marked as stale, because it has been over 30 days without any activity.

github-actions[bot] commented 1 month ago

This issue bas been closed, because it has been marked as stale and there has been no activity for over 7 days.