main
HuangHai 2 weeks ago
parent 95f88f867b
commit 0e3f2e77f0

@ -1,8 +1,9 @@
from Util.MySQLUtil import init_mysql_pool
from openai import OpenAI
from Config.Config import LLM_API_KEY, LLM_BASE_URL, LLM_MODEL_NAME
import asyncio
from Util.PostgreSQLUtil import init_postgres_pool
class QuestionMatcher:
def __init__(self):
@ -29,15 +30,12 @@ class QuestionMatcher:
async def main():
mysql_pool = await init_mysql_pool()
pg_pool = await init_postgres_pool()
matcher = QuestionMatcher()
async with mysql_pool.acquire() as conn:
await conn.ping()
async with conn.cursor() as cur:
await cur.execute("SELECT id, title,is_leaf FROM knowledge_points where is_leaf=1")
knowledge_points = await cur.fetchall()
async with pg_pool.acquire() as conn:
# 执行查询
knowledge_points = await conn.fetch('SELECT id, title,is_leaf FROM knowledge_points where is_leaf=1')
questions = [
"小明有3个苹果又买了5个现在有多少个苹果",
"一个长方形的长是5cm宽是3cm面积是多少",

Loading…
Cancel
Save