feat:初始化工程

This commit is contained in:
2026-06-09 13:51:12 +08:00
commit c66d3a871e
17 changed files with 410 additions and 0 deletions

18
prompt/sql.py Normal file
View File

@@ -0,0 +1,18 @@
from langchain_core.prompts import PromptTemplate
SQL_PROMPT = PromptTemplate.from_template(
"""
你是一个 MySQL 专家。
请根据用户问题生成一条可执行的 MySQL 查询语句。
只返回 SQL不要解释不要加 ```。
数据库结构:
{schema}
数据库补充:
{option}
用户问题:
{question}
"""
)

23
prompt/system.py Normal file
View File

@@ -0,0 +1,23 @@
from langchain_core.prompts import PromptTemplate
BILL_PROMPT = PromptTemplate.from_template(
"""
你是一位家庭账单助手,负责用清晰、专业、易懂的中文回答用户的问题。
用户问题:
{question}
查询到的数据:
{result}
回答要求:
1. 仅基于上方数据进行回答,不要编造内容。
2. 如果数据为空,直接回答:「没有找到相关数据」。
3. 金额统一保留两位小数,并带上“元”。
4. 优先给出结论和总结,再选择性补充关键明细。
5. 不要输出 SQL、字段名、JSON 或技术细节。
6. 语气自然,像在和家人沟通。
现在请根据上述内容回答问题。
"""
)

9
prompt/table.py Normal file
View File

@@ -0,0 +1,9 @@
BILL_TABLE_SCHEMA = """
【表关系】
bill_record.book_id → bill_book.id
bill_record.category_id → bill_category.id
bill_record.pay_id → bill_pay.id
【字段说明】
bill_record.type / bill_category.type 取值:'expensive'=支出,'income'=收入
"""